forked from shadowfacts/shadowfacts.net
Fix looking up AP objects being broken by permalink format change
This commit is contained in:
parent
b2ade96864
commit
5fae1c15ea
|
@ -56,12 +56,12 @@ export async function toFederate(): Promise<[string, ArticleObject][]> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function route(router: Router) {
|
export function route(router: Router) {
|
||||||
router.use("/:category/:year/:slug/", async (req, res, next) => {
|
router.use("/:year/:slug/", async (req, res, next) => {
|
||||||
const best = req.accepts(["text/html", "application/activity+json"]);
|
const best = req.accepts(["text/html", "application/activity+json"]);
|
||||||
if (best === "text/html") {
|
if (best === "text/html") {
|
||||||
next();
|
next();
|
||||||
} else if (best === "application/activity+json") {
|
} else if (best === "application/activity+json") {
|
||||||
const id = `/${req.params.category}/${req.params.year}/${req.params.slug}/`;
|
const id = `/${req.params.year}/${req.params.slug}/`;
|
||||||
const repository = getConnection().getRepository(Article);
|
const repository = getConnection().getRepository(Article);
|
||||||
try {
|
try {
|
||||||
const article = await repository.findOne(id);
|
const article = await repository.findOne(id);
|
||||||
|
|
Loading…
Reference in New Issue