mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2024-11-26 09:37:28 +00:00
parent
a903647eb1
commit
49ad9ee434
37
package-lock.json
generated
37
package-lock.json
generated
@ -1618,9 +1618,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"in-publish": {
|
"in-publish": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.1.tgz",
|
||||||
"integrity": "sha1-4g/146KvwmkDILbcVSaCqcf631E="
|
"integrity": "sha512-oDM0kUSNFC31ShNxHKUyfZKy8ZeXZBWMjMdZHKLOk13uvT27VTL/QzRGfRUcevJhpkZAvlhPYuXkF7eNWrtyxQ=="
|
||||||
},
|
},
|
||||||
"indent-string": {
|
"indent-string": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
@ -2287,9 +2287,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||||
},
|
},
|
||||||
"minipass": {
|
"minipass": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
@ -2328,18 +2328,11 @@
|
|||||||
"integrity": "sha512-imbHQNRglyaplMmjBLL3V5R6Bfq5oM+ivds3SKgc6oRtzErEnBUUc5No11Z2pilkUvl42gJvi285xTNswcKCMA=="
|
"integrity": "sha512-imbHQNRglyaplMmjBLL3V5R6Bfq5oM+ivds3SKgc6oRtzErEnBUUc5No11Z2pilkUvl42gJvi285xTNswcKCMA=="
|
||||||
},
|
},
|
||||||
"mkdirp": {
|
"mkdirp": {
|
||||||
"version": "0.5.1",
|
"version": "0.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
|
||||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
"integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"minimist": "0.0.8"
|
"minimist": "^1.2.5"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"minimist": {
|
|
||||||
"version": "0.0.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
|
||||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ms": {
|
"ms": {
|
||||||
@ -2940,8 +2933,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pinski": {
|
"pinski": {
|
||||||
"version": "github:cloudrac3r/pinski#1193025936cac58ac329b30e0749884bba6abb11",
|
"version": "github:cloudrac3r/pinski#4baee0a52b809ff9ac9767dbccc5addebc6c842a",
|
||||||
"from": "github:cloudrac3r/pinski#1193025936cac58ac329b30e0749884bba6abb11",
|
"from": "github:cloudrac3r/pinski#4baee0a52b809ff9ac9767dbccc5addebc6c842a",
|
||||||
"requires": {
|
"requires": {
|
||||||
"mime": "^2.4.4",
|
"mime": "^2.4.4",
|
||||||
"node-sass": "^4.13.1",
|
"node-sass": "^4.13.1",
|
||||||
@ -5241,9 +5234,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "7.2.1",
|
"version": "7.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz",
|
||||||
"integrity": "sha512-sucePNSafamSKoOqoNfBd8V0StlkzJKL2ZAhGQinCfNQ+oacw+Pk7lcdAElecBF2VkLNZRiIb5Oi1Q5lVUVt2A=="
|
"integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ=="
|
||||||
},
|
},
|
||||||
"xml-js": {
|
"xml-js": {
|
||||||
"version": "1.6.11",
|
"version": "1.6.11",
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"mixin-deep": "^2.0.1",
|
"mixin-deep": "^2.0.1",
|
||||||
"node-dir": "^0.1.17",
|
"node-dir": "^0.1.17",
|
||||||
"node-fetch": "^2.6.0",
|
"node-fetch": "^2.6.0",
|
||||||
"pinski": "github:cloudrac3r/pinski#1193025936cac58ac329b30e0749884bba6abb11",
|
"pinski": "github:cloudrac3r/pinski#4baee0a52b809ff9ac9767dbccc5addebc6c842a",
|
||||||
"pug": "^2.0.4",
|
"pug": "^2.0.4",
|
||||||
"semver": "^7.1.2",
|
"semver": "^7.1.2",
|
||||||
"sharp": "^0.24.0",
|
"sharp": "^0.24.0",
|
||||||
|
@ -29,7 +29,8 @@ function request(url, options = {}, settings = {}) {
|
|||||||
headers: {
|
headers: {
|
||||||
"User-Agent": userAgent
|
"User-Agent": userAgent
|
||||||
},
|
},
|
||||||
followRedirect: false
|
followRedirect: false,
|
||||||
|
throwHttpErrors: false
|
||||||
}, options))
|
}, options))
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Invalid value for setting `request_backend`.")
|
throw new Error("Invalid value for setting `request_backend`.")
|
||||||
|
10
src/site/api/404.js
Normal file
10
src/site/api/404.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
const {render} = require("pinski/plugins")
|
||||||
|
const constants = require("../../lib/constants")
|
||||||
|
|
||||||
|
module.exports = [
|
||||||
|
{route: "/404", methods: ["GET", "POST", "PATCH", "DELETE"], code: async ({url}) => {
|
||||||
|
const path = url.searchParams.get("pathname")
|
||||||
|
const couldBeUsername = path.match(`^/${constants.external.username_regex}$`)
|
||||||
|
return render(404, "pug/404.pug", {path, couldBeUsername})
|
||||||
|
}}
|
||||||
|
]
|
@ -1,3 +1,5 @@
|
|||||||
|
//- Needs path, couldBeUsername
|
||||||
|
|
||||||
include includes/error
|
include includes/error
|
||||||
|
|
||||||
doctype html
|
doctype html
|
||||||
@ -8,3 +10,5 @@ html
|
|||||||
|
|
||||||
body.error-page
|
body.error-page
|
||||||
+error(404, "Page not found.")
|
+error(404, "Page not found.")
|
||||||
|
if couldBeUsername
|
||||||
|
| Trying to access a user? #[a(href=`/u${path}`) Visit @#{path.slice(1)}]
|
||||||
|
@ -19,7 +19,6 @@ subdirs("pug", async (err, dirs) => {
|
|||||||
// need to check for and run db upgrades before anything starts using it
|
// need to check for and run db upgrades before anything starts using it
|
||||||
await require("../lib/utils/upgradedb")()
|
await require("../lib/utils/upgradedb")()
|
||||||
|
|
||||||
pinski.addRoute("/404", "pug/404.pug", "pug")
|
|
||||||
pinski.setNotFoundTarget("/404")
|
pinski.setNotFoundTarget("/404")
|
||||||
pinski.addRoute("/static/css/main.css", "sass/main.sass", "sass")
|
pinski.addRoute("/static/css/main.css", "sass/main.sass", "sass")
|
||||||
pinski.addPugDir("pug", dirs)
|
pinski.addPugDir("pug", dirs)
|
||||||
|
Loading…
Reference in New Issue
Block a user