Added georestriction with SFW mode.

This commit is contained in:
2026-02-04 05:39:14 +01:00
parent ce107e6b65
commit 1a84f899e7
35 changed files with 777 additions and 112 deletions

View File

@@ -3,7 +3,9 @@ import { fetchEntities } from '#/src/entities.js';
export async function onBeforeRender(pageContext) {
const networks = await fetchEntities(pageContext.urlParsed.search.q
? { query: pageContext.urlParsed.search.q }
: { type: 'primary' });
: { type: 'primary' }, {
restriction: pageContext.restriction,
});
return {
pageContext: {

View File

@@ -20,7 +20,9 @@ async function fetchReleases(pageContext, entityId) {
page: Number(pageContext.routeParams.page) || 1,
limit: Number(pageContext.urlParsed.search.limit) || 30,
aggregate: true,
}, pageContext.user);
}, pageContext.user, {
restriction: pageContext.restriction,
});
}
return fetchScenes(await curateScenesQuery({
@@ -32,7 +34,9 @@ async function fetchReleases(pageContext, entityId) {
page: Number(pageContext.routeParams.page) || 1,
limit: Number(pageContext.urlParsed.search.limit) || 30,
aggregate: true,
}, pageContext.user);
}, pageContext.user, {
restriction: pageContext.restriction,
});
}
export async function onBeforeRender(pageContext) {
@@ -47,7 +51,9 @@ export async function onBeforeRender(pageContext) {
[entity],
entityReleases,
] = await Promise.all([
fetchEntitiesById([Number(entityId)], { includeChildren: true }, pageContext.user),
fetchEntitiesById([Number(entityId)], { includeChildren: true }, pageContext.user, {
restriction: pageContext.restriction,
}),
fetchReleases(pageContext, entityId),
]);

View File

@@ -9,7 +9,9 @@ export async function onBeforeRender(pageContext) {
page: Number(pageContext.routeParams.page) || 1,
limit: Number(pageContext.urlParsed.search.limit) || 50,
dedupe: true,
}, pageContext.user);
}, pageContext.user, {
restriction: pageContext.restriction,
});
return {
pageContext: {

View File

@@ -18,7 +18,7 @@ function getTitle(movie) {
export async function onBeforeRender(pageContext) {
const [[movie], movieScenes] = await Promise.all([
fetchMoviesById([Number(pageContext.routeParams.movieId)], pageContext.user),
fetchMoviesById([Number(pageContext.routeParams.movieId)], pageContext.user, { restriction: pageContext.restriction }),
fetchScenes(await curateScenesQuery({
...pageContext.urlQuery,
scope: 'oldest',
@@ -27,7 +27,9 @@ export async function onBeforeRender(pageContext) {
page: Number(pageContext.routeParams.page) || 1,
limit: Number(pageContext.urlParsed.search.limit) || 30,
aggregate: true,
}, pageContext.user),
}, pageContext.user, {
restriction: pageContext.restriction,
}),
]);
if (!movie) {

View File

@@ -25,6 +25,7 @@ export async function onBeforeRender(pageContext) {
includeAssets: true,
includePartOf: true,
actorStashes: true,
restriction: pageContext.restriction,
});
const [campaigns, tagIds] = await Promise.all([

View File

@@ -17,7 +17,9 @@ export async function onBeforeRender(pageContext) {
limit: Number(pageContext.urlParsed.search.limit) || 29,
aggregate: true,
dedupe: true,
}, pageContext.user),
}, pageContext.user, {
restriction: pageContext.restriction,
}),
getRandomCampaigns([
{ minRatio: 0.75, maxRatio: 1.25 },
{ minRatio: 1.5 },

View File

@@ -75,8 +75,8 @@
>
<img
v-if="tag.poster"
:src="`/${tag.poster.thumbnail}`"
:style="{ 'background-image': `url(/${tag.poster.lazy})` }"
:src="getPath(tag.poster, 'thumbnail')"
:style="{ 'background-image': `url(/${getPath(tag.poster, 'lazy')})` }"
:title="tag.poster.comment"
class="thumb"
loading="lazy"
@@ -111,6 +111,7 @@ import { ref, onMounted, inject } from 'vue';
import navigate from '#/src/navigate.js';
import events from '#/src/events.js';
import getPath from '#/src/get-path.js';
import Logo from '#/components/tags/logo.vue';
@@ -324,6 +325,7 @@ onMounted(() => {
width: 100%;
height: 100%;
object-fit: cover;
aspect-ratio: 5/3;
border-radius: .25rem;
background-size: cover;
background-position: center;

View File

@@ -1,4 +1,5 @@
import { fetchTags, fetchTagsById } from '#/src/tags.js';
import { censor } from '#/src/censor.js';
const tagSlugs = {
popular: [
@@ -136,13 +137,13 @@ export async function onBeforeRender(pageContext) {
return searchTags(pageContext);
}
const tags = await fetchTagsById(Object.values(tagSlugs).flat());
const tags = await fetchTagsById(Object.values(tagSlugs).flat(), {}, pageContext.user, { restriction: pageContext.restriction });
const filteredTags = tags.filter((tag) => !pageContext.tagFilter.includes(tag.name) && !pageContext.tagFilter.includes(tag.slug));
const tagsBySlug = Object.fromEntries(filteredTags.map((tag) => [tag.slug, tag]));
const tagShowcase = Object.fromEntries(Object.entries(tagSlugs).map(([category, categorySlugs]) => [
category,
censor(category, pageContext.restriction),
categorySlugs.map((slug) => tagsBySlug[slug]).filter(Boolean),
]));

View File

@@ -21,7 +21,9 @@ async function fetchReleases(pageContext) {
page: Number(pageContext.routeParams.page) || 1,
limit: Number(pageContext.urlParsed.search.limit) || 30,
aggregate: true,
}, pageContext.user);
}, pageContext.user, {
restriction: pageContext.restriction,
});
}
return fetchScenes(await curateScenesQuery({
@@ -33,14 +35,16 @@ async function fetchReleases(pageContext) {
page: Number(pageContext.routeParams.page) || 1,
limit: Number(pageContext.urlParsed.search.limit) || 30,
aggregate: true,
}, pageContext.user);
}, pageContext.user, {
restriction: pageContext.restriction,
});
}
export async function onBeforeRender(pageContext) {
const tagSlug = pageContext.routeParams.tagSlug;
const [[tag], tagReleases, campaigns] = await Promise.all([
fetchTagsById([tagSlug], {}, pageContext.user),
fetchTagsById([tagSlug], {}, pageContext.user, { restriction: pageContext.restriction }),
fetchReleases(pageContext),
getRandomCampaigns([
{ tagSlugs: [tagSlug], minRatio: 0.75, maxRatio: 1.25 },

View File

@@ -19,7 +19,7 @@ export async function onBeforeRender(pageContext) {
limit: Number(pageContext.urlParsed.search.limit) || 29,
aggregate: withQuery,
dedupe: true,
}, pageContext.user),
}, pageContext.user, { restriction: pageContext.restriction }),
getRandomCampaigns([
{ minRatio: 2.0, maxRatio: 5 },
{ minRatio: 0.75, maxRatio: 1.25 },