diff --git a/assets/components/container/warning.vue b/assets/components/container/warning.vue
index 092241b6..3d47ab23 100644
--- a/assets/components/container/warning.vue
+++ b/assets/components/container/warning.vue
@@ -11,7 +11,7 @@
By entering, you agree to the following
- - You are at least 18 years old, and legally permitted to consume adult material in your jurisdiction.
+ - You are at least 18 years old, and legally permitted to view adult material in your jurisdiction.
- You are prepared see, hear and read erotic and sexual material, and do not regard such content as obscene or offensive.
- You understand that most sexual scenarios depicted on this website are fictional, performed by professional actors for the purpose of entertainment, and not representative of real-life interactions.
- Respect your sexual partners, communicate about each other's desires and limits, and take precautions to prevent sexually transmitted infections and unintended pregnancies.
diff --git a/src/releases.js b/src/releases.js
index 8d9d99e1..35fd8e70 100644
--- a/src/releases.js
+++ b/src/releases.js
@@ -99,7 +99,7 @@ function withRelations(queryBuilder, withMedia = false) {
}
}
-async function fetchRelease(releaseId) {
+async function fetchScene(releaseId) {
const release = await knex('releases')
.where('releases.id', releaseId)
.modify(withRelations, true)
@@ -108,7 +108,7 @@ async function fetchRelease(releaseId) {
return curateRelease(release, true);
}
-async function fetchReleases(limit = 100) {
+async function fetchScenes(limit = 100) {
const releases = await knex('releases')
.modify(withRelations, false)
.limit(Math.min(limit, 1000000));
@@ -116,7 +116,7 @@ async function fetchReleases(limit = 100) {
return releases.map(release => curateRelease(release));
}
-async function searchReleases(query, limit = 100) {
+async function searchScenes(query, limit = 100) {
const releases = await knex
.from(knex.raw('search_releases(?) as releases', [query]))
.modify(withRelations, false)
@@ -189,10 +189,10 @@ async function flushBatches(batchIds) {
module.exports = {
curateRelease,
- fetchRelease,
- fetchReleases,
+ fetchScene,
+ fetchScenes,
flushBatches,
- searchReleases,
+ searchScenes,
deleteScenes,
deleteMovies,
};
diff --git a/src/web/releases.js b/src/web/releases.js
index 59a16ac5..78bee416 100644
--- a/src/web/releases.js
+++ b/src/web/releases.js
@@ -1,49 +1,46 @@
'use strict';
-const { fetchRelease, fetchReleases, searchReleases } = require('../releases');
+const config = require('config');
+const path = require('path');
-async function fetchReleaseApi(req, res, type = 'scene') {
- const release = await fetchRelease(req.params.releaseId, type);
+const { fetchScene, fetchScenes, searchScenes } = require('../releases');
+
+async function fetchSceneApi(req, res) {
+ const release = await fetchScene(req.params.releaseId);
if (release) {
- res.send({ [type]: release });
+ res.send({ scene: release });
return;
}
- res.status(404).send({ [type]: null });
-}
-
-async function fetchReleasesApi(req, res, type = 'scene') {
- const query = req.query.query || req.query.q;
-
- const releases = query
- ? await searchReleases(query, req.query.limit, type)
- : await fetchReleases(req.query.limit, type);
-
- res.send({ [`${type}s`]: releases });
-}
-
-async function fetchSceneApi(req, res) {
- return fetchReleaseApi(req, res, 'scene');
+ res.status(404).send({ scene: null });
}
async function fetchScenesApi(req, res) {
- return fetchReleasesApi(req, res, 'scene');
+ const query = req.query.query || req.query.q;
+
+ const releases = query
+ ? await searchScenes(query, req.query.limit)
+ : await fetchScenes(req.query.limit);
+
+ res.send({ scenes: releases });
}
-async function fetchMovieApi(req, res) {
- return fetchReleaseApi(req, res, 'movie');
-}
+async function fetchScenePosterApi(req, res) {
+ const scene = await fetchScene(req.params.releaseId);
+ const posterPath = scene?.poster?.path;
-async function fetchMoviesApi(req, res) {
- return fetchReleasesApi(req, res, 'movie');
+ if (posterPath) {
+ res.sendFile(path.resolve(config.media.path, posterPath));
+
+ return;
+ }
+
+ res.status(404).send();
}
module.exports = {
- fetchRelease: fetchReleaseApi,
- fetchReleases: fetchReleasesApi,
fetchScene: fetchSceneApi,
- fetchMovie: fetchMovieApi,
fetchScenes: fetchScenesApi,
- fetchMovies: fetchMoviesApi,
+ fetchScenePoster: fetchScenePosterApi,
};
diff --git a/src/web/server.js b/src/web/server.js
index 62b06015..765c1c27 100644
--- a/src/web/server.js
+++ b/src/web/server.js
@@ -17,8 +17,7 @@ const { ActorPlugins, SitePlugins, ReleasePlugins } = require('./plugins/plugins
const {
fetchScene,
fetchScenes,
- fetchMovie,
- fetchMovies,
+ fetchScenePoster,
} = require('./releases');
const {
@@ -81,9 +80,10 @@ async function initServer() {
router.get('/api/scenes', fetchScenes);
router.get('/api/scenes/:releaseId', fetchScene);
+ router.get('/api/scenes/:releaseId/poster', fetchScenePoster);
- router.get('/api/movies', fetchMovies);
- router.get('/api/movies/:releaseId', fetchMovie);
+ // router.get('/api/movies', fetchMovies);
+ // router.get('/api/movies/:releaseId', fetchMovie);
router.get('/api/actors', fetchActors);
router.get('/api/actors/:actorId', fetchActor);