xcursor-pro: init at 2.0.2 (#335188)
[NixPkgs.git] / pkgs / by-name / po / porn-vault / allow-use-of-systemd-temp-path.patch
blob0b22577cce3890d99bc538ff8214d94e62c7e61f
1 diff --git a/server/binaries/ffmpeg.ts b/server/binaries/ffmpeg.ts
2 index abb4de4f..cdcc0a02 100644
3 --- a/server/binaries/ffmpeg.ts
4 +++ b/server/binaries/ffmpeg.ts
5 @@ -8,6 +8,7 @@ import { getConfig } from "../config";
6 import { mkdirpAsync, rimrafAsync, statAsync } from "../utils/fs/async";
7 import { formatMessage, handleError, logger } from "../utils/logger";
8 import { generateTimestampsAtIntervals } from "../utils/misc";
9 +import { tempPath } from "server/utils/path";
11 export async function takeScreenshot(
12 inPath: string,
13 @@ -112,7 +113,7 @@ export async function generatePreview(
14 ): Promise<void> {
15 logger.debug(`Creating 100 small previews for ${sceneId}.`);
17 - const tmpFolder = resolve("tmp", "preview", sceneId);
18 + const tmpFolder = resolve(tempPath, "preview", sceneId);
20 const timestamps = generateTimestampsAtIntervals(PREVIEW_COUNT, durationSecs * 1000, {
21 startPercentage: 2,
22 diff --git a/server/database/index.ts b/server/database/index.ts
23 index 80ff6432..c6feb11d 100755
24 --- a/server/database/index.ts
25 +++ b/server/database/index.ts
26 @@ -15,7 +15,7 @@ import Studio from "../types/studio";
27 import SceneView from "../types/watch";
28 import { mkdirpSync } from "../utils/fs/async";
29 import { logger } from "../utils/logger";
30 -import { libraryPath } from "../utils/path";
31 +import { libraryPath, tempPath } from "../utils/path";
32 import { Izzy } from "./internal";
34 export function formatCollectionName(name: string) {
35 @@ -261,11 +261,11 @@ export async function loadStore<T extends { _id: string }>(
38 export async function loadStores(): Promise<void> {
39 - if (!existsSync("tmp")) {
40 - logger.info("Creating temporary directory 'tmp'");
41 - mkdirpSync("tmp/");
42 + if (!existsSync(tempPath)) {
43 + logger.info(`Creating temporary directory '${tempPath}'`);
44 + mkdirpSync(tempPath);
45 } else {
46 - logger.debug("Temporary directory 'tmp' already exists");
47 + logger.debug(`Temporary directory '${tempPath}' already exists`);
50 const crossReferencePath = libraryPath("cross_references.db");
51 diff --git a/server/graphql/mutations/image.ts b/server/graphql/mutations/image.ts
52 index 6554f145..a7853eea 100644
53 --- a/server/graphql/mutations/image.ts
54 +++ b/server/graphql/mutations/image.ts
55 @@ -20,7 +20,7 @@ import Studio from "../../types/studio";
56 import { mapAsync } from "../../utils/async";
57 import { copyFileAsync, statAsync, unlinkAsync } from "../../utils/fs/async";
58 import { logger } from "../../utils/logger";
59 -import { getFolderPartition, libraryPath } from "../../utils/path";
60 +import { getFolderPartition, libraryPath, tempPath } from "../../utils/path";
61 import { getExtension, normalizeName } from "../../utils/string";
62 import { Dictionary, isBoolean, isNumber, isString } from "../../utils/types";
63 import { clearCaches } from "../datasources";
64 @@ -110,7 +110,7 @@ export default {
66 const image = new Image(imageName);
68 - const outPath = `tmp/${image._id}${ext}`;
69 + const outPath = resolve(tempPath, `${image._id}${ext}`);
71 logger.debug(`Getting file...`);
73 diff --git a/server/routes/scene.ts b/server/routes/scene.ts
74 index 601de160..fe8b8de5 100644
75 --- a/server/routes/scene.ts
76 +++ b/server/routes/scene.ts
77 @@ -16,7 +16,7 @@ import Scene from "../types/scene";
78 import { mkdirpAsync, readFileAsync, rimrafAsync } from "../utils/fs/async";
79 import { handleError, logger } from "../utils/logger";
80 import { generateTimestampsAtIntervals } from "../utils/misc";
81 -import { getFolderPartition, libraryPath } from "../utils/path";
82 +import { getFolderPartition, libraryPath, tempPath } from "../utils/path";
83 import { IMAGE_CACHE_CONTROL } from "./media";
85 /* function streamTranscode(
86 @@ -94,7 +94,7 @@ export async function attachScenePreviewGrid(scene: Scene): Promise<string | nul
87 return null;
90 - const gridFolder = path.resolve("tmp", "grid");
91 + const gridFolder = path.resolve(tempPath, "grid");
92 const tmpFolder = path.resolve(gridFolder, "thumbs", randomUUID());
93 await mkdirpAsync(tmpFolder);
95 diff --git a/server/utils/path.ts b/server/utils/path.ts
96 index 05619e93..64964de8 100644
97 --- a/server/utils/path.ts
98 +++ b/server/utils/path.ts
99 @@ -5,6 +5,7 @@ import { getConfig } from "../config";
100 import { mkdirpSync } from "./fs/async";
102 const configFolder = process.env.PV_CONFIG_FOLDER || process.cwd();
103 +export const tempPath = process.env.CACHE_DIRECTORY ?? "tmp";
105 export function libraryPath(str: string): string {
106 return resolve(getConfig().persistence.libraryPath, "library", str);
108 2.47.0