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:
parent
3600e09ab0
commit
781e647fce
|
@ -288,42 +288,38 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@koa/router": {
|
"@koa/router": {
|
||||||
"version": "8.0.8",
|
"version": "10.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@koa/router/-/router-8.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/@koa/router/-/router-10.0.0.tgz",
|
||||||
"integrity": "sha512-FnT93N4NUehnXr+juupDmG2yfi0JnWdCmNEuIXpCG4TtG+9xvtrLambBH3RclycopVUOEYAim2lydiNBI7IRVg==",
|
"integrity": "sha512-z9ytrKWn/j/qUApMSJzZbUwkbLcN2ZXGq6UsqWkZb50Us+/Qpu0RwgZ6ytawVOhfFBZ1ai5iVWeD2Dcu0qcnJw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"http-errors": "^1.7.3",
|
"http-errors": "^1.7.3",
|
||||||
"koa-compose": "^4.1.0",
|
"koa-compose": "^4.1.0",
|
||||||
"methods": "^1.1.2",
|
"methods": "^1.1.2",
|
||||||
"path-to-regexp": "1.x",
|
"path-to-regexp": "^6.1.0"
|
||||||
"urijs": "^1.19.2"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"http-errors": {
|
"http-errors": {
|
||||||
"version": "1.7.3",
|
"version": "1.8.0",
|
||||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz",
|
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.0.tgz",
|
||||||
"integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==",
|
"integrity": "sha512-4I8r0C5JDhT5VkvI47QktDW75rNlGVsUf/8hzjCC/wkWI/jdTRmBb9aI7erSG82r1bjKY3F6k28WnsVxB1C73A==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"depd": "~1.1.2",
|
"depd": "~1.1.2",
|
||||||
"inherits": "2.0.4",
|
"inherits": "2.0.4",
|
||||||
"setprototypeof": "1.1.1",
|
"setprototypeof": "1.2.0",
|
||||||
"statuses": ">= 1.5.0 < 2",
|
"statuses": ">= 1.5.0 < 2",
|
||||||
"toidentifier": "1.0.0"
|
"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": {
|
"path-to-regexp": {
|
||||||
"version": "1.8.0",
|
"version": "6.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.0.tgz",
|
||||||
"integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
|
"integrity": "sha512-f66KywYG6+43afgE/8j/GoiNyygk/bnoCbps++3ErRKsIYkGGupyv07R2Ok5m9i67Iqc+T2g1eAUGUPzWhYTyg=="
|
||||||
"requires": {
|
},
|
||||||
"isarray": "0.0.1"
|
"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": {
|
"@types/debug": {
|
||||||
"version": "4.1.5",
|
"version": "4.1.5",
|
||||||
"resolved": false,
|
"resolved": "",
|
||||||
"integrity": "sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ=="
|
"integrity": "sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ=="
|
||||||
},
|
},
|
||||||
"@types/events": {
|
"@types/events": {
|
||||||
|
@ -11773,11 +11769,6 @@
|
||||||
"static-module": "^3.0.0"
|
"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": {
|
"url-parse-lax": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz",
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fraction/base16-css": "^1.1.0",
|
"@fraction/base16-css": "^1.1.0",
|
||||||
"@fraction/flotilla": "^5.2.0",
|
"@fraction/flotilla": "^5.2.0",
|
||||||
"@koa/router": "^8.0.0",
|
"@koa/router": "^10.0.0",
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"env-paths": "^2.2.0",
|
"env-paths": "^2.2.0",
|
||||||
"file-type": "^16.0.1",
|
"file-type": "^16.0.1",
|
||||||
|
|
14
src/index.js
14
src/index.js
|
@ -493,7 +493,7 @@ router
|
||||||
};
|
};
|
||||||
ctx.body = await author(feed);
|
ctx.body = await author(feed);
|
||||||
})
|
})
|
||||||
.get("/search/", async (ctx) => {
|
.get("/search", async (ctx) => {
|
||||||
let { query } = ctx.query;
|
let { query } = ctx.query;
|
||||||
|
|
||||||
if (isMsg(query)) {
|
if (isMsg(query)) {
|
||||||
|
@ -548,7 +548,7 @@ router
|
||||||
ctx.type = "text/css";
|
ctx.type = "text/css";
|
||||||
ctx.body = requireStyle(filePath);
|
ctx.body = requireStyle(filePath);
|
||||||
})
|
})
|
||||||
.get("/profile/", async (ctx) => {
|
.get("/profile", async (ctx) => {
|
||||||
const myFeedId = await meta.myFeedId();
|
const myFeedId = await meta.myFeedId();
|
||||||
|
|
||||||
const gt = Number(ctx.request.query["gt"] || -1);
|
const gt = Number(ctx.request.query["gt"] || -1);
|
||||||
|
@ -600,7 +600,7 @@ router
|
||||||
});
|
});
|
||||||
ctx.redirect("/profile");
|
ctx.redirect("/profile");
|
||||||
})
|
})
|
||||||
.get("/publish/custom/", async (ctx) => {
|
.get("/publish/custom", async (ctx) => {
|
||||||
ctx.body = await publishCustomView();
|
ctx.body = await publishCustomView();
|
||||||
})
|
})
|
||||||
.get("/json/:message", async (ctx) => {
|
.get("/json/:message", async (ctx) => {
|
||||||
|
@ -710,7 +710,7 @@ router
|
||||||
};
|
};
|
||||||
ctx.body = await image({ blobId, imageSize: Number(imageSize) });
|
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 theme = ctx.cookies.get("theme") || config.theme;
|
||||||
const getMeta = async ({ theme }) => {
|
const getMeta = async ({ theme }) => {
|
||||||
const status = await meta.status();
|
const status = await meta.status();
|
||||||
|
@ -745,13 +745,13 @@ router
|
||||||
};
|
};
|
||||||
ctx.body = await likes({ feed });
|
ctx.body = await likes({ feed });
|
||||||
})
|
})
|
||||||
.get("/settings/readme/", async (ctx) => {
|
.get("/settings/readme", async (ctx) => {
|
||||||
const status = async (text) => {
|
const status = async (text) => {
|
||||||
return markdownView({ text });
|
return markdownView({ text });
|
||||||
};
|
};
|
||||||
ctx.body = await status(readme);
|
ctx.body = await status(readme);
|
||||||
})
|
})
|
||||||
.get("/mentions/", async (ctx) => {
|
.get("/mentions", async (ctx) => {
|
||||||
const mentions = async () => {
|
const mentions = async () => {
|
||||||
const messages = await post.mentionsMe();
|
const messages = await post.mentionsMe();
|
||||||
|
|
||||||
|
@ -889,7 +889,7 @@ router
|
||||||
const previewData = await preparePreview(ctx);
|
const previewData = await preparePreview(ctx);
|
||||||
ctx.body = await previewView({ previewData, contentWarning });
|
ctx.body = await previewView({ previewData, contentWarning });
|
||||||
})
|
})
|
||||||
.post("/publish/", koaBody(), async (ctx) => {
|
.post("/publish", koaBody(), async (ctx) => {
|
||||||
const text = String(ctx.request.body.text);
|
const text = String(ctx.request.body.text);
|
||||||
const rawContentWarning = String(ctx.request.body.contentWarning);
|
const rawContentWarning = String(ctx.request.body.contentWarning);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue