Upgrade @koa/router

This also fixes our routes so that we're listening on `/foo` instead of
`/foo/` with an accidental trailing slash.
This commit is contained in:
Christian Bundy 2020-11-21 20:15:03 -08:00
parent 3600e09ab0
commit 781e647fce
3 changed files with 25 additions and 34 deletions

43
package-lock.json generated
View File

@ -288,42 +288,38 @@
}
},
"@koa/router": {
"version": "8.0.8",
"resolved": "https://registry.npmjs.org/@koa/router/-/router-8.0.8.tgz",
"integrity": "sha512-FnT93N4NUehnXr+juupDmG2yfi0JnWdCmNEuIXpCG4TtG+9xvtrLambBH3RclycopVUOEYAim2lydiNBI7IRVg==",
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/@koa/router/-/router-10.0.0.tgz",
"integrity": "sha512-z9ytrKWn/j/qUApMSJzZbUwkbLcN2ZXGq6UsqWkZb50Us+/Qpu0RwgZ6ytawVOhfFBZ1ai5iVWeD2Dcu0qcnJw==",
"requires": {
"debug": "^4.1.1",
"http-errors": "^1.7.3",
"koa-compose": "^4.1.0",
"methods": "^1.1.2",
"path-to-regexp": "1.x",
"urijs": "^1.19.2"
"path-to-regexp": "^6.1.0"
},
"dependencies": {
"http-errors": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz",
"integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==",
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.0.tgz",
"integrity": "sha512-4I8r0C5JDhT5VkvI47QktDW75rNlGVsUf/8hzjCC/wkWI/jdTRmBb9aI7erSG82r1bjKY3F6k28WnsVxB1C73A==",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.4",
"setprototypeof": "1.1.1",
"setprototypeof": "1.2.0",
"statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.0"
}
},
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
},
"path-to-regexp": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
"integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
"requires": {
"isarray": "0.0.1"
}
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.0.tgz",
"integrity": "sha512-f66KywYG6+43afgE/8j/GoiNyygk/bnoCbps++3ErRKsIYkGGupyv07R2Ok5m9i67Iqc+T2g1eAUGUPzWhYTyg=="
},
"setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
}
}
},
@ -433,7 +429,7 @@
},
"@types/debug": {
"version": "4.1.5",
"resolved": false,
"resolved": "",
"integrity": "sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ=="
},
"@types/events": {
@ -11773,11 +11769,6 @@
"static-module": "^3.0.0"
}
},
"urijs": {
"version": "1.19.2",
"resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.2.tgz",
"integrity": "sha512-s/UIq9ap4JPZ7H1EB5ULo/aOUbWqfDi7FKzMC2Nz+0Si8GiT1rIEaprt8hy3Vy2Ex2aJPpOQv4P4DuOZ+K1c6w=="
},
"url-parse-lax": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz",

View File

@ -23,7 +23,7 @@
"dependencies": {
"@fraction/base16-css": "^1.1.0",
"@fraction/flotilla": "^5.2.0",
"@koa/router": "^8.0.0",
"@koa/router": "^10.0.0",
"debug": "^4.1.1",
"env-paths": "^2.2.0",
"file-type": "^16.0.1",

View File

@ -493,7 +493,7 @@ router
};
ctx.body = await author(feed);
})
.get("/search/", async (ctx) => {
.get("/search", async (ctx) => {
let { query } = ctx.query;
if (isMsg(query)) {
@ -548,7 +548,7 @@ router
ctx.type = "text/css";
ctx.body = requireStyle(filePath);
})
.get("/profile/", async (ctx) => {
.get("/profile", async (ctx) => {
const myFeedId = await meta.myFeedId();
const gt = Number(ctx.request.query["gt"] || -1);
@ -600,7 +600,7 @@ router
});
ctx.redirect("/profile");
})
.get("/publish/custom/", async (ctx) => {
.get("/publish/custom", async (ctx) => {
ctx.body = await publishCustomView();
})
.get("/json/:message", async (ctx) => {
@ -710,7 +710,7 @@ router
};
ctx.body = await image({ blobId, imageSize: Number(imageSize) });
})
.get("/settings/", async (ctx) => {
.get("/settings", async (ctx) => {
const theme = ctx.cookies.get("theme") || config.theme;
const getMeta = async ({ theme }) => {
const status = await meta.status();
@ -745,13 +745,13 @@ router
};
ctx.body = await likes({ feed });
})
.get("/settings/readme/", async (ctx) => {
.get("/settings/readme", async (ctx) => {
const status = async (text) => {
return markdownView({ text });
};
ctx.body = await status(readme);
})
.get("/mentions/", async (ctx) => {
.get("/mentions", async (ctx) => {
const mentions = async () => {
const messages = await post.mentionsMe();
@ -889,7 +889,7 @@ router
const previewData = await preparePreview(ctx);
ctx.body = await previewView({ previewData, contentWarning });
})
.post("/publish/", koaBody(), async (ctx) => {
.post("/publish", koaBody(), async (ctx) => {
const text = String(ctx.request.body.text);
const rawContentWarning = String(ctx.request.body.contentWarning);