diff --git a/.eleventy.js b/.eleventy.js
index 0671434..669ff84 100644
--- a/.eleventy.js
+++ b/.eleventy.js
@@ -1,4 +1,4 @@
-const { ACTOR_OBJ } = require("./src/env")
+const ACTOR = require("./actor")
module.exports = function(eleventyConfig) {
// I'm .gitignoring my content for now, so 11ty should not ignore that
@@ -11,7 +11,8 @@ module.exports = function(eleventyConfig) {
// and collections
addCollections(eleventyConfig)
- eleventyConfig.addGlobalData("actor_obj", () => ACTOR_OBJ);
+ // add the actor data, accessible globally
+ eleventyConfig.addGlobalData("ACTOR", ACTOR);
// TODO: assets?
// files to passthrough copy
@@ -22,6 +23,8 @@ module.exports = function(eleventyConfig) {
// plugins
eleventyConfig.addPlugin(require("@11ty/eleventy-plugin-rss"))
+ const { EleventyHtmlBasePlugin } = require("@11ty/eleventy")
+ eleventyConfig.addPlugin(EleventyHtmlBasePlugin)
// Return your Object options:
return {
@@ -40,7 +43,7 @@ function addCollections(eleventyConfig) {
if(!item.data.published) return false
return item.filePathStem.startsWith('/posts/')
}).map(item => {
- item.data.author = ACTOR_OBJ
+ item.data.author = ACTOR
return item
}).sort((a, b) => new Date(b.published).getTime() - new Date(a.published).getTime())
})
diff --git a/_content/_includes/layout-main.njk b/_content/_includes/layout-main.njk
index 658fecc..c0f0795 100644
--- a/_content/_includes/layout-main.njk
+++ b/_content/_includes/layout-main.njk
@@ -18,9 +18,9 @@ title: Mon Repos (Death's Domain)
#}
-
-
-
+
+
+
{{ title }}
diff --git a/_content/atom.njk b/_content/atom.njk
new file mode 100644
index 0000000..1712210
--- /dev/null
+++ b/_content/atom.njk
@@ -0,0 +1,37 @@
+---json
+{
+ "layout": null,
+ "permalink": "atom.xml",
+ "eleventyExcludeFromCollections": true,
+ "metadata": {
+ "subtitle": "A feed of all my posts on the fediverse",
+ "language": "en"
+ }
+}
+---
+
+{% from "macro-summary.njk" import summaryMacro %}
+
+ {{ ACTOR.name }}'s feed
+ {{ metadata.subtitle }}
+
+
+ {{ collections.feed[0].date | dateToRfc822 }}
+ {{ ACTOR.url }}
+
+ {{ ACTOR.name }}
+
+ {%- for post in collections.feed %}
+ {%- set absolutePostUrl = post.url | absoluteUrl(ACTOR.url) %}
+
+ {{ post.data.title }}
+
+ {{ post.date | dateToRfc822 }}
+ {{ absolutePostUrl }}
+
+ {{ summaryMacro(post.data, post.url) | htmlToAbsoluteUrls(absolutePostUrl) }}
+ {{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}
+
+
+ {%- endfor %}
+
\ No newline at end of file
diff --git a/_content/index.html b/_content/index.html
index d1f810e..b663fd1 100644
--- a/_content/index.html
+++ b/_content/index.html
@@ -4,13 +4,20 @@ eleventyExcludeFromCollections: true
---
-
-
+
+
- I'm Gordon Pedersen , a.k.a death.au
+ I'm {{ ACTOR.name }}
+ {% if ACTOR.name != ACTOR.preferredUsername %}
+ (a.k.a {{ ACTOR.preferredUsername }} )
+ {% endif %}
- ...and I am a human on the Internet.
+ {% if ACTOR.summary %}
+ {{ ACTOR.summary }}
+ {% else %}
+ ...and I am a human on the Internet.
+ {% endif %}
Go check out some stuff I wrote
@@ -22,21 +29,24 @@ eleventyExcludeFromCollections: true
data-success="Thanks for the follow!"
onsubmit="handleFollow(event.value)">
- Follow @death.au@death.id.au
+ Follow @{{ ACTOR.preferredUsername }}@{{ ACTOR.hostname }}
RSS Feed
Atom Feed
JSON Feed
-
+
+ ...or elsewhere on the Internet:
+
+
{% layoutblock 'foot' %}
@@ -48,7 +58,7 @@ eleventyExcludeFromCollections: true
})
function handleFollow(handle) {
try{
- follow('@death.au@death.id.au', handle)
+ follow(`@${ACTOR.preferredUsername}@${ACTOR.hostname}`, handle)
}
catch(e){
alert(e)
diff --git a/_content/json.njk b/_content/json.njk
new file mode 100644
index 0000000..e4dfd6e
--- /dev/null
+++ b/_content/json.njk
@@ -0,0 +1,36 @@
+---json
+{
+ "layout": null,
+ "permalink": "feed.json",
+ "eleventyExcludeFromCollections": true,
+ "metadata": {
+ "subtitle": "A feed of all my posts on the fediverse",
+ "language": "en"
+ }
+}
+---
+{ {% from "macro-summary.njk" import summaryMacro %}
+ "version": "https://jsonfeed.org/version/1.1",
+ "title": "{{ ACTOR.name }}'s feed",
+ "language": "{{ metadata.language }}",
+ "home_page_url": "{{ ACTOR.url }}",
+ "feed_url": "{{ permalink | absoluteUrl(ACTOR.url) }}",
+ "description": "{{ metadata.subtitle }}",
+ "author": {
+ "name": "{{ ACTOR.name }}",
+ "url": "{{ ACTOR.url }}"
+ },
+ "items": [
+ {%- for post in collections.feed %}
+ {%- set absolutePostUrl = post.url | absoluteUrl(ACTOR.url) %}
+ {
+ "id": "{{ absolutePostUrl }}",
+ "url": "{{ absolutePostUrl }}",
+ "title": "{{ post.data.title }}",
+ "content_html": {{ summaryMacro(post.data, post.url) | concat(post.templateContent) | htmlToAbsoluteUrls(absolutePostUrl) | dump | safe }},
+ "date_published": "{{ post.date | dateToRfc3339 }}"
+ }
+ {% if not loop.last %},{% endif %}
+ {%- endfor %}
+ ]
+}
\ No newline at end of file
diff --git a/_content/rss.njk b/_content/rss.njk
new file mode 100644
index 0000000..9945f45
--- /dev/null
+++ b/_content/rss.njk
@@ -0,0 +1,36 @@
+---js
+{
+ "layout": null,
+ "permalink": "rss.xml",
+ "eleventyExcludeFromCollections": true,
+ "metadata": {
+ "subtitle": "A feed of all my posts on the fediverse",
+ "language": "en"
+ }
+}
+---
+
+{% from "macro-summary.njk" import summaryMacro %}
+
+
+ {{ ACTOR.name }}'s feed
+ {{ ACTOR.url }}
+
+ {{ metadata.subtitle }}
+ {{ metadata.language }}
+ {%- for post in collections.feed | reverse %}
+ {%- set absolutePostUrl = post.url | absoluteUrl(ACTOR.url) %}
+ -
+
{{ post.data.title }}
+ {{ absolutePostUrl }}
+
+ {{ summaryMacro(post.data, post.url) | htmlToAbsoluteUrls(absolutePostUrl) }}
+ {{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}
+
+ {{ post.date | dateToRfc822 }}
+ {{ ACTOR.name }}
+ {{ absolutePostUrl }}
+
+ {%- endfor %}
+
+
diff --git a/actor.ts b/actor.ts
index 171e658..b3f8e48 100644
--- a/actor.ts
+++ b/actor.ts
@@ -1,4 +1,4 @@
-import { BASE_URL, PUBLIC_KEY } from "./src/env"
+import { BASE_URL, HOSTNAME, PUBLIC_KEY } from "./src/env"
// change "activitypub" to whatever you want your account name to be
export const preferredUsername:string = process.env.ACCOUNT || "activitypub"
@@ -6,17 +6,19 @@ export const name = process.env.REAL_NAME || preferredUsername
export const summary = ""
// avatar image
-const icon:{ type:"Image", mediaType:string, url:string } = {
+const icon:{ type:"Image", mediaType:string, url:string, name:string } = {
type: "Image",
mediaType: "image/svg+xml",
- url: BASE_URL + "/assets/img/avatar-tt.svg"
+ url: BASE_URL + "/assets/img/avatar-tt.svg",
+ name: "My profile photo — a pixelated version of me"
}
// banner image
-const image:{ type:"Image", mediaType:string, url:string } = {
+const image:{ type:"Image", mediaType:string, url:string, name:string } = {
type: "Image",
mediaType: "image/jpeg",
- url: BASE_URL + "/assets/img/banner-1500x500.jpg"
+ url: BASE_URL + "/assets/img/banner-1500x500.jpg",
+ name: "A grim reaper in a decorated cubicle, writing and daydreaming, surrounded by many other grim reapers in bland, grey, cubicles"
}
// This is a list of other actor ids you identify as
@@ -72,6 +74,7 @@ export default {
preferredUsername,
name,
summary,
+ hostname: HOSTNAME,
url: BASE_URL,
manuallyApprovesFollowers: false,
discoverable: true,
diff --git a/src/request.ts b/src/request.ts
index 555c30f..6db4716 100644
--- a/src/request.ts
+++ b/src/request.ts
@@ -64,7 +64,7 @@ async function fetchActor(url:string) {
export async function fetchObject(object_url:string) {
console.log(`fetch ${object_url}`)
- const res = await fetch(object_url);
+ const res = await signedFetch(object_url);
if (res.status < 200 || 299 < res.status) {
throw new Error(res.statusText + ": " + (await res.text()));