Compare commits

..

No commits in common. "320ba3fc67519c5ac4ac6e9da2b6af0d6d463cb6" and "7ca373b020062a6bc569476b44003c60f62b6148" have entirely different histories.

6 changed files with 4 additions and 106 deletions

View File

@ -1,92 +0,0 @@
import path from "path";
import { Page, PostMetadata } from "../metadata";
import * as util from "../util";
const baseURL = process.env.BASE_URL || "shadowfacts.net";
export default async function activitypub(posts: Page[]) {
for (const post of posts) {
const object = postObject(post);
const dir = path.dirname(post.metadata.permalink);
const base = path.basename(post.metadata.permalink);
const dest = path.format({
dir,
name: base,
ext: ".json"
});
util.write(dest, JSON.stringify(object));
}
util.write("ap/actor", JSON.stringify(actorObject()))
util.write(".well-known/webfinger", JSON.stringify(webfingerObject()));
}
function postObject(post: Page): object {
const postMeta = <PostMetadata>post.metadata;
return {
"@context": [
"https://www.w3.org/ns/activitystreams"
],
"type": "Article",
"id": `https://${baseURL}${postMeta.permalink}.json`,
"published": (<Date>postMeta.date).toISOString(),
"inReplyTo": null,
"url": `https://${baseURL}${postMeta.permalink}`,
"attributedTo": `https://${baseURL}/ap/actor`,
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"cc": [],
"name": postMeta.title,
"content": post.text
};
}
function actorObject() {
return {
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1"
],
"type": "Person",
"id": `https://${baseURL}/ap/actor`,
"preferredUsername": "shadowfacts",
"name": "shadowfacts' blog",
"icon": {
"type": "Image",
"mediaType": "image/png",
"url": `https://${baseURL}/shadowfacts.png`
},
"inbox": `https://${baseURL}/ap/inbox`,
"publicKey": {
"id": `https://${baseURL}/ap/actor#main-key`,
"owner": `https://${baseURL}/ap/actor`,
"publicKeyPem":
`
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxsePhOEq6EqqgGe+5vKa
ti8cnvLoP3eJDTHENxX4M9epMIeo48cI214wkAERoNufZLtYeGOHO6YJcVydVSYN
Ud4lQxgaPwAlh0DB0BUrXR1yfcSAhHS86XBSUq86O3fY5V+vEdZiN5PfUCG5rg5t
5V/TrcbVQngXqDmwVZ/OcJ+5vUo+B62Mul7EmiNkZHKzp1VZGVtZ6nZ/4TxsdeSN
XT8Vb0f/GJQOQLzW6dV0CBupts6x7o+9oRiYiAH+cXLFyQdTQ+1TrqMSMscdfX9I
Kos5Ih7oKdj6wQt0pDEOGx090c9JzQC25RzxRk7jc1Jt1UzDi/a1U/BbucxIvPr3
PQIDAQAB
-----END PUBLIC KEY-----
`
}
};
}
function webfingerObject() {
return {
"subject": `acct:shadowfacts@${baseURL}`,
"links": [
{
"rel": "self",
"type": "application/activity+json",
"href": `https://${baseURL}/ap/actor`
}
]
};
}

View File

@ -1,4 +1,3 @@
import activitypub from "./activitypub";
import categories from "./categories";
import copy from "./copy";
import css from "./css";
@ -10,7 +9,6 @@ import rss from "./rss";
import tutorials from "./tutorials";
export = {
activitypub,
categories,
copy,
css,

View File

@ -11,9 +11,7 @@ async function generate() {
generators.homepage(posts);
generators.redirects(posts);
const categories = await generators.categories(posts);
await generators.rss(posts, categories, tutorials);
generators.activitypub(posts);
generators.rss(posts, categories, tutorials);
}
generate();

View File

@ -18,7 +18,6 @@ export interface PostMetadata extends Metadata {
category: string;
date: string | Date;
excerpt?: string;
uuid: string;
}
export async function get(path: string): Promise<Page> {

View File

@ -5,8 +5,7 @@
"license": "UNLICENSED",
"scripts": {
"generate": "tsc -p . && node built/index.js",
"serve": "npm run generate && http-server out",
"generate-post": "node bin/generate-post.js"
"serve": "npm run generate && http-server out"
},
"dependencies": {
"@sindresorhus/slugify": "^0.6.0",
@ -15,8 +14,7 @@
"highlight.js": "^9.13.1",
"markdown-it": "^8.4.2",
"node-sass": "^4.11.0",
"typescript": "^3.2.2",
"uuid": "^3.3.2"
"typescript": "^3.2.2"
},
"devDependencies": {
"@types/ejs": "^2.6.1",

View File

@ -337,12 +337,9 @@ figure {
li {
list-style: none;
display: inline;
margin-right: 1em;
font-variant: small-caps;
font-weight: bold;
&:not(:last-child) {
margin-right: 1em;
}
}
}