2024-01-07 05:13:40 +00:00
|
|
|
import { fetchScenes } from '#/src/scenes.js';
|
2024-04-02 03:55:53 +00:00
|
|
|
import { curateScenesQuery } from '#/src/web/scenes.js';
|
2023-12-30 05:29:53 +00:00
|
|
|
|
|
|
|
export async function onBeforeRender(pageContext) {
|
2024-06-02 03:22:08 +00:00
|
|
|
const withQuery = Object.hasOwn(pageContext.urlParsed.search, 'q');
|
|
|
|
|
|
|
|
const {
|
|
|
|
scenes,
|
|
|
|
aggTags,
|
|
|
|
aggChannels,
|
|
|
|
aggActors,
|
|
|
|
limit,
|
|
|
|
total,
|
|
|
|
} = await fetchScenes(await curateScenesQuery({
|
2024-04-02 03:55:53 +00:00
|
|
|
...pageContext.urlQuery,
|
2024-01-07 05:13:40 +00:00
|
|
|
scope: pageContext.routeParams.scope || 'latest',
|
2024-06-02 03:22:08 +00:00
|
|
|
isShowcased: withQuery ? null : true,
|
2024-04-02 03:55:53 +00:00
|
|
|
tagFilter: pageContext.tagFilter,
|
|
|
|
}), {
|
2024-01-07 05:13:40 +00:00
|
|
|
page: Number(pageContext.routeParams.page) || 1,
|
|
|
|
limit: Number(pageContext.urlParsed.search.limit) || 30,
|
2024-06-02 03:22:08 +00:00
|
|
|
aggregate: withQuery,
|
2024-03-03 01:33:35 +00:00
|
|
|
}, pageContext.user);
|
2023-12-30 05:29:53 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
pageContext: {
|
|
|
|
title: pageContext.routeParams.scope,
|
|
|
|
pageProps: {
|
|
|
|
scenes,
|
2024-06-02 03:22:08 +00:00
|
|
|
aggTags,
|
|
|
|
aggChannels,
|
|
|
|
aggActors,
|
2023-12-30 05:29:53 +00:00
|
|
|
limit,
|
|
|
|
total,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|