2024-02-22 04:09:24 +00:00
|
|
|
import { fetchScenes } from '#/src/scenes.js';
|
|
|
|
import { curateScenesQuery } from '#/src/web/scenes.js';
|
|
|
|
|
|
|
|
export async function onBeforeRender(pageContext) {
|
|
|
|
const searchScenes = await fetchScenes(await curateScenesQuery({
|
|
|
|
...pageContext.urlQuery,
|
|
|
|
query: pageContext.urlParsed.search.q,
|
|
|
|
scope: pageContext.urlParsed.search.scope || 'results',
|
2024-04-02 17:07:43 +00:00
|
|
|
tagFilter: pageContext.tagFilter,
|
2024-02-22 04:09:24 +00:00
|
|
|
}), {
|
|
|
|
page: Number(pageContext.routeParams.page) || 1,
|
|
|
|
limit: Number(pageContext.urlParsed.search.limit) || 30,
|
2024-05-01 01:57:12 +00:00
|
|
|
}, pageContext.user);
|
2024-02-22 04:09:24 +00:00
|
|
|
|
|
|
|
const {
|
|
|
|
scenes,
|
|
|
|
aggActors,
|
|
|
|
aggTags,
|
|
|
|
aggChannels,
|
|
|
|
total,
|
|
|
|
limit,
|
|
|
|
} = searchScenes;
|
|
|
|
|
|
|
|
return {
|
|
|
|
pageContext: {
|
2024-03-27 22:54:23 +00:00
|
|
|
title: `Search '${pageContext.urlParsed.search.q || ''}'`,
|
2024-02-22 04:09:24 +00:00
|
|
|
pageProps: {
|
|
|
|
scenes,
|
|
|
|
aggActors,
|
|
|
|
aggTags,
|
|
|
|
aggChannels,
|
|
|
|
limit,
|
|
|
|
total,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|