mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2026-03-02 02:41:34 +00:00
Implement caption on right (closes #51)
This commit is contained in:
parent
2244c219a4
commit
13339efa9e
4 changed files with 16 additions and 9 deletions
|
|
@ -25,7 +25,6 @@ module.exports = [
|
|||
},
|
||||
{
|
||||
route: "/privacy", methods: ["GET"], code: async ({req}) => {
|
||||
|
||||
if (constants.has_privacy_policy && pugCache.has("pug/privacy.pug")) {
|
||||
const settings = getSettings(req)
|
||||
return render(200, "pug/privacy.pug", {settings})
|
||||
|
|
@ -107,13 +106,14 @@ module.exports = [
|
|||
}
|
||||
},
|
||||
{
|
||||
route: `/fragment/user/(${constants.external.username_regex})/(\\d+)`, methods: ["GET"], code: async ({url, fill}) => {
|
||||
route: `/fragment/user/(${constants.external.username_regex})/(\\d+)`, methods: ["GET"], code: async ({req, url, fill}) => {
|
||||
return fetchUser(fill[0]).then(async user => {
|
||||
const pageNumber = +fill[1]
|
||||
const pageIndex = pageNumber - 1
|
||||
await user.timeline.fetchUpToPage(pageIndex)
|
||||
if (user.timeline.pages[pageIndex]) {
|
||||
return render(200, "pug/fragments/timeline_page.pug", {page: user.timeline.pages[pageIndex], pageIndex, user, url})
|
||||
const settings = getSettings(req)
|
||||
return render(200, "pug/fragments/timeline_page.pug", {page: user.timeline.pages[pageIndex], pageIndex, user, url, settings})
|
||||
} else {
|
||||
return {
|
||||
statusCode: 400,
|
||||
|
|
@ -136,17 +136,18 @@ module.exports = [
|
|||
}
|
||||
},
|
||||
{
|
||||
route: `/fragment/post/(${constants.external.shortcode_regex})`, methods: ["GET"], code: ({fill}) => {
|
||||
route: `/fragment/post/(${constants.external.shortcode_regex})`, methods: ["GET"], code: ({req, fill}) => {
|
||||
return getOrFetchShortcode(fill[0]).then(async post => {
|
||||
await post.fetchChildren()
|
||||
await post.fetchExtendedOwnerP() // serial await is okay since intermediate fetch result is cached
|
||||
if (post.isVideo()) await post.fetchVideoURL()
|
||||
const settings = getSettings(req)
|
||||
return {
|
||||
statusCode: 200,
|
||||
contentType: "application/json",
|
||||
content: {
|
||||
title: getPageTitle(post),
|
||||
html: pugCache.get("pug/fragments/post.pug").web({post})
|
||||
html: pugCache.get("pug/fragments/post.pug").web({post, settings})
|
||||
}
|
||||
}
|
||||
}).catch(error => {
|
||||
|
|
@ -186,9 +187,7 @@ module.exports = [
|
|||
await post.fetchChildren()
|
||||
await post.fetchExtendedOwnerP() // serial await is okay since intermediate fetch result is cached
|
||||
if (post.isVideo()) await post.fetchVideoURL()
|
||||
|
||||
const settings = getSettings(req)
|
||||
|
||||
return render(200, "pug/post.pug", {
|
||||
title: getPageTitle(post),
|
||||
post,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue