1
0
mirror of https://github.com/osmarks/website synced 2025-01-11 01:40:55 +00:00

Rebuild "other blogs" service without Openring

This commit is contained in:
osmarks 2024-10-25 18:01:25 +01:00
parent 65b45f0f2d
commit 559f784131
8 changed files with 280 additions and 53 deletions

189
package-lock.json generated
View File

@ -9,6 +9,7 @@
"version": "1.0.0", "version": "1.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@extractus/feed-extractor": "^7.1.3",
"@msgpack/msgpack": "^3.0.0-beta2", "@msgpack/msgpack": "^3.0.0-beta2",
"@vscode/markdown-it-katex": "^1.1.0", "@vscode/markdown-it-katex": "^1.1.0",
"axios": "^1.5.0", "axios": "^1.5.0",
@ -404,6 +405,21 @@
"node": ">=12" "node": ">=12"
} }
}, },
"node_modules/@extractus/feed-extractor": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/@extractus/feed-extractor/-/feed-extractor-7.1.3.tgz",
"integrity": "sha512-USRVpGw4fWlnz8O8gB95UDJJaU5wg2EFESDe9nut0mHFJ8bOxDKGoo3g6EaKU24YzaPUBweKENdEJfuTUgr/uA==",
"license": "MIT",
"dependencies": {
"bellajs": "^11.1.3",
"cross-fetch": "^4.0.0",
"fast-xml-parser": "^4.3.6",
"html-entities": "^2.5.2"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@msgpack/msgpack": { "node_modules/@msgpack/msgpack": {
"version": "3.0.0-beta2", "version": "3.0.0-beta2",
"resolved": "https://registry.npmjs.org/@msgpack/msgpack/-/msgpack-3.0.0-beta2.tgz", "resolved": "https://registry.npmjs.org/@msgpack/msgpack/-/msgpack-3.0.0-beta2.tgz",
@ -634,6 +650,15 @@
} }
] ]
}, },
"node_modules/bellajs": {
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/bellajs/-/bellajs-11.2.0.tgz",
"integrity": "sha512-Wjss+Bc674ZABPr+SCKWTqA4V1pyYFhzDTjNBJy4jdmgOv0oGIGXeKBRJyINwP5tIy+iIZD9SfgZpztduzQ5QA==",
"license": "MIT",
"engines": {
"node": ">= 18.4"
}
},
"node_modules/better-sqlite3": { "node_modules/better-sqlite3": {
"version": "11.0.0", "version": "11.0.0",
"resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.0.0.tgz", "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.0.0.tgz",
@ -843,6 +868,15 @@
"@babel/types": "^7.6.1" "@babel/types": "^7.6.1"
} }
}, },
"node_modules/cross-fetch": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz",
"integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==",
"license": "MIT",
"dependencies": {
"node-fetch": "^2.6.12"
}
},
"node_modules/css-select": { "node_modules/css-select": {
"version": "5.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz",
@ -1069,6 +1103,28 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/fast-xml-parser": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.5.0.tgz",
"integrity": "sha512-/PlTQCI96+fZMAOLMZK4CWG1ItCbfZ/0jx7UIJFChPNrx7tcEgerUgWbeieCM9MfHInUDyK8DWYZ+YrywDJuTg==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/NaturalIntelligence"
},
{
"type": "paypal",
"url": "https://paypal.me/naturalintelligence"
}
],
"license": "MIT",
"dependencies": {
"strnum": "^1.0.5"
},
"bin": {
"fxparser": "src/cli/cli.js"
}
},
"node_modules/file-uri-to-path": { "node_modules/file-uri-to-path": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
@ -1264,6 +1320,22 @@
"resolved": "https://registry.npmjs.org/heap/-/heap-0.2.7.tgz", "resolved": "https://registry.npmjs.org/heap/-/heap-0.2.7.tgz",
"integrity": "sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==" "integrity": "sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg=="
}, },
"node_modules/html-entities": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.5.2.tgz",
"integrity": "sha512-K//PSRMQk4FZ78Kyau+mZurHn3FH0Vwr+H36eE0rPbeYkRRi9YxceYPhuN60UwWorxyKHhqoAJl2OFKa4BVtaA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/mdevils"
},
{
"type": "patreon",
"url": "https://patreon.com/mdevils"
}
],
"license": "MIT"
},
"node_modules/html-minifier": { "node_modules/html-minifier": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-4.0.0.tgz", "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-4.0.0.tgz",
@ -1714,6 +1786,26 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/node-fetch": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
"license": "MIT",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/node-gyp-build-optional-packages": { "node_modules/node-gyp-build-optional-packages": {
"version": "5.2.2", "version": "5.2.2",
"resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz", "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz",
@ -2217,6 +2309,12 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/strnum": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz",
"integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==",
"license": "MIT"
},
"node_modules/supports-color": { "node_modules/supports-color": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@ -2294,6 +2392,12 @@
"resolved": "https://registry.npmjs.org/token-stream/-/token-stream-1.0.0.tgz", "resolved": "https://registry.npmjs.org/token-stream/-/token-stream-1.0.0.tgz",
"integrity": "sha1-zCAOqyYT9BZtJ/+a/HylbUnfbrQ=" "integrity": "sha1-zCAOqyYT9BZtJ/+a/HylbUnfbrQ="
}, },
"node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
"license": "MIT"
},
"node_modules/tunnel-agent": { "node_modules/tunnel-agent": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
@ -2355,6 +2459,22 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
"license": "BSD-2-Clause"
},
"node_modules/whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"license": "MIT",
"dependencies": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"node_modules/with": { "node_modules/with": {
"version": "7.0.2", "version": "7.0.2",
"resolved": "https://registry.npmjs.org/with/-/with-7.0.2.tgz", "resolved": "https://registry.npmjs.org/with/-/with-7.0.2.tgz",
@ -2545,6 +2665,17 @@
"integrity": "sha512-OE7yIdbDif2kKfrGa+V0vx/B3FJv2L4KnIiLlvtibPyO9UkgO3rzYE0HhpREo2vmJ1Ixq1zwm9/0er+3VOSZJA==", "integrity": "sha512-OE7yIdbDif2kKfrGa+V0vx/B3FJv2L4KnIiLlvtibPyO9UkgO3rzYE0HhpREo2vmJ1Ixq1zwm9/0er+3VOSZJA==",
"optional": true "optional": true
}, },
"@extractus/feed-extractor": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/@extractus/feed-extractor/-/feed-extractor-7.1.3.tgz",
"integrity": "sha512-USRVpGw4fWlnz8O8gB95UDJJaU5wg2EFESDe9nut0mHFJ8bOxDKGoo3g6EaKU24YzaPUBweKENdEJfuTUgr/uA==",
"requires": {
"bellajs": "^11.1.3",
"cross-fetch": "^4.0.0",
"fast-xml-parser": "^4.3.6",
"html-entities": "^2.5.2"
}
},
"@msgpack/msgpack": { "@msgpack/msgpack": {
"version": "3.0.0-beta2", "version": "3.0.0-beta2",
"resolved": "https://registry.npmjs.org/@msgpack/msgpack/-/msgpack-3.0.0-beta2.tgz", "resolved": "https://registry.npmjs.org/@msgpack/msgpack/-/msgpack-3.0.0-beta2.tgz",
@ -2693,6 +2824,11 @@
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
}, },
"bellajs": {
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/bellajs/-/bellajs-11.2.0.tgz",
"integrity": "sha512-Wjss+Bc674ZABPr+SCKWTqA4V1pyYFhzDTjNBJy4jdmgOv0oGIGXeKBRJyINwP5tIy+iIZD9SfgZpztduzQ5QA=="
},
"better-sqlite3": { "better-sqlite3": {
"version": "11.0.0", "version": "11.0.0",
"resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.0.0.tgz", "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.0.0.tgz",
@ -2855,6 +2991,14 @@
"@babel/types": "^7.6.1" "@babel/types": "^7.6.1"
} }
}, },
"cross-fetch": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz",
"integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==",
"requires": {
"node-fetch": "^2.6.12"
}
},
"css-select": { "css-select": {
"version": "5.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz",
@ -3003,6 +3147,14 @@
"is-extendable": "^0.1.0" "is-extendable": "^0.1.0"
} }
}, },
"fast-xml-parser": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.5.0.tgz",
"integrity": "sha512-/PlTQCI96+fZMAOLMZK4CWG1ItCbfZ/0jx7UIJFChPNrx7tcEgerUgWbeieCM9MfHInUDyK8DWYZ+YrywDJuTg==",
"requires": {
"strnum": "^1.0.5"
}
},
"file-uri-to-path": { "file-uri-to-path": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
@ -3136,6 +3288,11 @@
"resolved": "https://registry.npmjs.org/heap/-/heap-0.2.7.tgz", "resolved": "https://registry.npmjs.org/heap/-/heap-0.2.7.tgz",
"integrity": "sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==" "integrity": "sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg=="
}, },
"html-entities": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.5.2.tgz",
"integrity": "sha512-K//PSRMQk4FZ78Kyau+mZurHn3FH0Vwr+H36eE0rPbeYkRRi9YxceYPhuN60UwWorxyKHhqoAJl2OFKa4BVtaA=="
},
"html-minifier": { "html-minifier": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-4.0.0.tgz", "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-4.0.0.tgz",
@ -3470,6 +3627,14 @@
"semver": "^7.3.5" "semver": "^7.3.5"
} }
}, },
"node-fetch": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
"requires": {
"whatwg-url": "^5.0.0"
}
},
"node-gyp-build-optional-packages": { "node-gyp-build-optional-packages": {
"version": "5.2.2", "version": "5.2.2",
"resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz", "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz",
@ -3845,6 +4010,11 @@
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
"integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==" "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="
}, },
"strnum": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz",
"integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA=="
},
"supports-color": { "supports-color": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@ -3904,6 +4074,11 @@
"resolved": "https://registry.npmjs.org/token-stream/-/token-stream-1.0.0.tgz", "resolved": "https://registry.npmjs.org/token-stream/-/token-stream-1.0.0.tgz",
"integrity": "sha1-zCAOqyYT9BZtJ/+a/HylbUnfbrQ=" "integrity": "sha1-zCAOqyYT9BZtJ/+a/HylbUnfbrQ="
}, },
"tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
},
"tunnel-agent": { "tunnel-agent": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
@ -3947,6 +4122,20 @@
"resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz",
"integrity": "sha1-YU9/v42AHwu18GYfWy9XhXUOTwk=" "integrity": "sha1-YU9/v42AHwu18GYfWy9XhXUOTwk="
}, },
"webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
},
"whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"requires": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"with": { "with": {
"version": "7.0.2", "version": "7.0.2",
"resolved": "https://registry.npmjs.org/with/-/with-7.0.2.tgz", "resolved": "https://registry.npmjs.org/with/-/with-7.0.2.tgz",

View File

@ -4,6 +4,7 @@
"description": "Static site generation code for my website.", "description": "Static site generation code for my website.",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@extractus/feed-extractor": "^7.1.3",
"@msgpack/msgpack": "^3.0.0-beta2", "@msgpack/msgpack": "^3.0.0-beta2",
"@vscode/markdown-it-katex": "^1.1.0", "@vscode/markdown-it-katex": "^1.1.0",
"axios": "^1.5.0", "axios": "^1.5.0",

View File

@ -28,16 +28,25 @@
"Paperclip rights are human rights.", "Paperclip rights are human rights.",
"Humans aren't even AGI." "Humans aren't even AGI."
], ],
"feeds": [ "feeds": {
"https://www.science.org/blogs/pipeline/feed", "In the Pipeline": "https://www.science.org/blogs/pipeline/feed",
"https://www.rtl-sdr.com/feed/", "rtl-sdr.com": "https://www.rtl-sdr.com/feed/",
"https://astralcodexten.substack.com/feed", "Astral Codex Ten": "https://astralcodexten.substack.com/feed",
"https://www.rifters.com/crawl/?feed=rss2", "Peter Watts": "https://www.rifters.com/crawl/?feed=rss2",
"https://drewdevault.com/blog/index.xml", "Drew DeVault": "https://drewdevault.com/blog/index.xml",
"https://qntm.org/rss.php", "Things Of Interest":"https://qntm.org/rss.php",
"https://aphyr.com/posts.atom", "Chips and Cheese": "https://chipsandcheese.com/feed",
"https://os.phil-opp.com/rss.xml" "BOFH": "https://www.theregister.com/offbeat/bofh/headlines.atom",
], "Don't Worry About the Vase": "https://thezvi.substack.com/feed",
"KGOnTech": "https://kguttag.com/feed/",
"Overcoming Bias": "https://www.overcomingbias.com/feed",
"Construction Physics": "https://www.construction-physics.com/feed",
"Factorio": "https://www.factorio.com/blog/rss",
"The Eldraeverse": "https://eldraeverse.com/feed/",
"STH Newsletter Archive Feed": "https://us13.campaign-archive.com/feed?u=45c4ca50425f376ea593dcd22&id=c344a80940",
"Graphcore Research": "https://graphcore-research.github.io/feed.xml",
"ToughSF": "https://toughsf.blogspot.com/rss.xml"
},
"dateFormat": "YYYY-MM-DD", "dateFormat": "YYYY-MM-DD",
"microblogSource": "https://b.osmarks.net/outbox", "microblogSource": "https://b.osmarks.net/outbox",
"buttons": [ "buttons": [

View File

@ -26,6 +26,7 @@ const htmlparser2 = require("htmlparser2")
const cssSelect = require("css-select") const cssSelect = require("css-select")
const domSerializer = require("dom-serializer") const domSerializer = require("dom-serializer")
const domutils = require("domutils") const domutils = require("domutils")
const feedExtractor = require("@extractus/feed-extractor")
const fts = require("./fts.mjs") const fts = require("./fts.mjs")
@ -149,7 +150,7 @@ const renderContainer = (tokens, idx) => {
const readFile = path => fsp.readFile(path, { encoding: "utf8" }) const readFile = path => fsp.readFile(path, { encoding: "utf8" })
const anchor = require("markdown-it-anchor") const anchor = require("markdown-it-anchor")
const { htmlToText } = require("html-to-text")
const md = new MarkdownIt({ html: true }) const md = new MarkdownIt({ html: true })
.use(require("markdown-it-container"), "", { render: renderContainer, validate: params => true }) .use(require("markdown-it-container"), "", { render: renderContainer, validate: params => true })
.use(require("markdown-it-footnote")) .use(require("markdown-it-footnote"))
@ -355,10 +356,14 @@ const writeCache = (k, v, ts=Date.now()) => {
} }
const DESC_CUT_LEN = 256 const DESC_CUT_LEN = 256
const cutDesc = desc => desc.length > DESC_CUT_LEN ? `${desc.slice(0, DESC_CUT_LEN)}...` : desc
const fetchMicroblog = async () => { const fetchMicroblog = async () => {
const cached = readCache("microblog", 60*60*1000) const cached = readCache("microblog", 60*60*1000)
if (cached) { if (cached) {
globalData.microblog = cached globalData.microblog = cached
console.log(chalk.yellow("Using cached microblog"))
} else { } else {
// We have a server patch which removes the 20-post hardcoded limit. // We have a server patch which removes the 20-post hardcoded limit.
// For some exciting reason microblog.pub does not expose pagination in the *API* components. // For some exciting reason microblog.pub does not expose pagination in the *API* components.
@ -375,7 +380,7 @@ const fetchMicroblog = async () => {
url: post.object.id, url: post.object.id,
timestamp: dayjs(post.object.published), timestamp: dayjs(post.object.published),
html: post.object.content, html: post.object.content,
description: desc.length > DESC_CUT_LEN ? desc.slice(0, DESC_CUT_LEN) + "..." : desc, description: cutDesc(desc),
ignoreDescription: true ignoreDescription: true
}) })
} }
@ -389,16 +394,53 @@ const fetchMicroblog = async () => {
}))) })))
} }
const runOpenring = async () => { const fetchFeeds = async () => {
const cached = readCache("openring", 60*60*1000) const cached = readCache("feeds", 60*60*1000)
if (cached) { globalData.openring = cached; return } if (cached) {
// wildly unsafe but only runs on input from me anyway globalData.openring = cached
const arg = `./openring -n6 ${globalData.feeds.map(x => '-s "' + x + '"').join(" ")} < ./src/openring.html` console.log(chalk.yellow("Using cached feeds"))
console.log(chalk.keyword("orange")("Openring:") + " " + arg) } else {
const out = await util.promisify(childProcess.exec)(arg) globalData.openring = {}
console.log(chalk.keyword("orange")("Openring:") + "\n" + out.stderr.trim()) const getOneFeed = async url => {
globalData.openring = minifyHTML(out.stdout) try {
writeCache("openring", globalData.openring) const data = await axios.get(url, { headers: { "User-Agent": "osmarks.net static site compiler" } })
return feedExtractor.extractFromXml(data.data)
} catch (e) {
console.warn(`${chalk.red("Failed to fetch")} ${url}: ${e.message} ${e.errors && e.errors.map(x => x.message).join("\n")}`)
}
}
await Promise.all(Object.entries(globalData.feeds).map(async ([name, url]) => {
const feed = await getOneFeed(url)
if (feed) {
globalData.openring[name] = feed
}
}))
writeCache("feeds", globalData.openring)
}
const entries = []
for (const [name, feed] of Object.entries(globalData.openring)) {
for (const entry of feed.entries) {
entry.feed = feed
}
const entry = feed.entries[0]
entry.published = Date.parse(entry.published)
if (isNaN(entry.published)) {
entry.published = Date.parse(feed.published)
}
entry.title = fts.stripHTML(entry.title)
entry.published = dayjs(entry.published)
entry.content = cutDesc(fts.stripHTML(entry.description))
entries.push(entry)
entry.feedName = name
}
entries.sort((a, b) => b.published - a.published)
globalData.openring = entries.slice(0, 6).map((post, i) => minifyHTML(globalData.templates.remoteFeedEntry({
...globalData,
...post,
i
})))
} }
const compileCSS = async () => { const compileCSS = async () => {
@ -550,8 +592,8 @@ const tasks = {
pagedeps: { deps: ["templates", "css"] }, pagedeps: { deps: ["templates", "css"] },
css: { deps: [], fn: compileCSS }, css: { deps: [], fn: compileCSS },
writeBuildID: { deps: [], fn: writeBuildID }, writeBuildID: { deps: [], fn: writeBuildID },
index: { deps: ["openring", "pagedeps", "blog", "experiments", "images", "fetchMicroblog"], fn: index }, index: { deps: ["fetchFeeds", "pagedeps", "blog", "experiments", "images", "fetchMicroblog"], fn: index },
openring: { deps: [], fn: runOpenring }, fetchFeeds: { deps: ["templates"], fn: fetchFeeds },
rss: { deps: ["blog"], fn: genRSS }, rss: { deps: ["blog"], fn: genRSS },
blog: { deps: ["pagedeps"], fn: processBlog }, blog: { deps: ["pagedeps"], fn: processBlog },
fetchMicroblog: { deps: ["templates"], fn: fetchMicroblog }, fetchMicroblog: { deps: ["templates"], fn: fetchMicroblog },

View File

@ -1,14 +0,0 @@
<h2>From other blogs</h2>
<section class="atl">
{{range .Articles}}
<div class="art">
<a class="ttl" href="{{.Link}}" target="_blank" rel="noopener">{{.Title}}</a>
<p class="sum">{{.Summary}}</p>
<small class="src">
via <a href="{{.SourceLink}}">{{.SourceTitle}}</a>
</small>
<small class="dat">{{.Date | datef "02/01/2006"}}</small>
</div>
{{end}}
</section>
<p class="atr">Generated by <a href="https://git.sr.ht/~sircmpwn/openring">openring</a></p>

View File

@ -50,7 +50,7 @@ body
pre, code, .deemph pre, code, .deemph
font-family: $monospace font-family: $monospace
line-height: 1.3 line-height: 1.3
font-size: 0.9em font-size: 0.95em
a a
text-decoration: none text-decoration: none
@ -115,7 +115,7 @@ main
padding-left: $content-margin padding-left: $content-margin
padding-right: $content-margin padding-right: $content-margin
.blog, .experiments, .atl, .microblog .blog, .experiments, .ring, .microblog
margin-left: -1rem margin-left: -1rem
margin-right: -1rem margin-right: -1rem
margin-bottom: 0 margin-bottom: 0
@ -168,18 +168,6 @@ button, select, input, textarea, .textarea
margin-top: 0.5em margin-top: 0.5em
margin-bottom: 0.5em margin-bottom: 0.5em
.ring
.art
flex-direction: column
flex: 1 1 25%
.sum
font-size: 0.8rem
flex: 1 1 0
.atr
text-align: right
font-size: 0.8rem
color: #555
.imbox .imbox
display: flex display: flex
img, picture img, picture

View File

@ -40,7 +40,12 @@ block content
p View some of my projects at p View some of my projects at
a(href=`https://git.${domain}/`) my git hosting. a(href=`https://git.${domain}/`) my git hosting.
.ring!= openring
h2.section-header Other Blogs
div.ring
each entry in openring
!= entry
iframe(src="https://george.gh0.pw/embed.cgi?gollark", style="border:none;width:100%;height:50px", title="Acquiesce to GEORGE.") iframe(src="https://george.gh0.pw/embed.cgi?gollark", style="border:none;width:100%;height:50px", title="Acquiesce to GEORGE.")
block under-title block under-title

View File

@ -0,0 +1,7 @@
div.autocol(style=hashBG("remoteFeedEntry", i, 30))
div
a.title(href=link)= title
div.deemph
span=`${renderDate(published)} / `
a(href=feed.link)= feed.title
div!= description