fix: path
This commit is contained in:
1 parent
418d09b07f
commit
77d918fbe0
8 files changed
+17
-17
No files matched your search
+2
-2
@@ -4,9 +4,9 @@ import bcrypt from 'bcryptjs'
|
|||||||
import jwt from 'jsonwebtoken'
|
import jwt from 'jsonwebtoken'
|
||||||
import type { Request, Response, NextFunction } from 'express'
|
import type { Request, Response, NextFunction } from 'express'
|
||||||
import { JWT_SECRET } from './secret.js'
|
import { JWT_SECRET } from './secret.js'
|
||||||
import { BASE_DIR } from './config.js'
|
import { DATA_DIR } from './config.js'
|
||||||
|
|
||||||
const DATA_PATH = path.join(BASE_DIR, 'config', 'auth.json')
|
const DATA_PATH = path.join(DATA_DIR, 'config', 'auth.json')
|
||||||
const SALT_ROUNDS = 10
|
const SALT_ROUNDS = 10
|
||||||
|
|
||||||
interface AuthData {
|
interface AuthData {
|
||||||
|
|||||||
+1
-1
@@ -10,4 +10,4 @@ export const BASE_DIR = _isBunBinary
|
|||||||
|
|
||||||
export const DATA_DIR = fs.existsSync('/.dockerenv')
|
export const DATA_DIR = fs.existsSync('/.dockerenv')
|
||||||
? '/config'
|
? '/config'
|
||||||
: path.join(BASE_DIR, 'data')
|
: path.join(BASE_DIR, 'config')
|
||||||
+2
-2
@@ -12,7 +12,7 @@ import {
|
|||||||
import qbittorrentDriver from './torrent-clients/qbittorrent.js'
|
import qbittorrentDriver from './torrent-clients/qbittorrent.js'
|
||||||
import { organizeTorrent, autoOrganizeAll, scanMediaPath } from './organize.js'
|
import { organizeTorrent, autoOrganizeAll, scanMediaPath } from './organize.js'
|
||||||
import { logger, readLogs, clearLogs, logsFileSize } from './logger.js'
|
import { logger, readLogs, clearLogs, logsFileSize } from './logger.js'
|
||||||
import { DATA_DIR, BASE_DIR, _isBunBinary } from './config.js'
|
import { DATA_DIR, BASE_DIR } from './config.js'
|
||||||
|
|
||||||
registerDriver(qbittorrentDriver)
|
registerDriver(qbittorrentDriver)
|
||||||
|
|
||||||
@@ -403,7 +403,7 @@ app.get('/api/downloads', requireAuth, async (_req, res) => {
|
|||||||
|
|
||||||
let torrentFinal: any[] = []
|
let torrentFinal: any[] = []
|
||||||
try {
|
try {
|
||||||
const tfPath = path.join(BASE_DIR, 'config', 'torrent_final.json')
|
const tfPath = path.join(DATA_DIR, 'config', 'torrent_final.json')
|
||||||
if (fs.existsSync(tfPath))
|
if (fs.existsSync(tfPath))
|
||||||
torrentFinal = JSON.parse(fs.readFileSync(tfPath, 'utf-8'))
|
torrentFinal = JSON.parse(fs.readFileSync(tfPath, 'utf-8'))
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|||||||
+2
-2
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { BASE_DIR } from './config.js'
|
import { DATA_DIR } from './config.js'
|
||||||
|
|
||||||
export type LogLevel = 'debug' | 'info' | 'warn' | 'error'
|
export type LogLevel = 'debug' | 'info' | 'warn' | 'error'
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ export interface LogEntry {
|
|||||||
meta? : Record<string, any>
|
meta? : Record<string, any>
|
||||||
}
|
}
|
||||||
|
|
||||||
const LOGS_PATH = path.join(BASE_DIR, 'config', 'logs.jsonl')
|
const LOGS_PATH = path.join(DATA_DIR, 'config', 'logs.jsonl')
|
||||||
const MAX_LINES = 2000 // rotation auto au-delà
|
const MAX_LINES = 2000 // rotation auto au-delà
|
||||||
const IS_PROD = process.env.NODE_ENV === 'production'
|
const IS_PROD = process.env.NODE_ENV === 'production'
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ import fs from 'fs'
|
|||||||
import fsp from 'fs/promises'
|
import fsp from 'fs/promises'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { parentPort } from 'worker_threads'
|
import { parentPort } from 'worker_threads'
|
||||||
import { BASE_DIR, _isBunBinary } from './config.js'
|
import { DATA_DIR } from './config.js'
|
||||||
|
|
||||||
const TORRENTS_PATH = path.join(BASE_DIR, 'config', 'torrent_final.json')
|
const TORRENTS_PATH = path.join(DATA_DIR, 'config', 'torrent_final.json')
|
||||||
const ORGANIZED_PATH = path.join(BASE_DIR, 'config', 'organized.json')
|
const ORGANIZED_PATH = path.join(DATA_DIR, 'config', 'organized.json')
|
||||||
|
|
||||||
// ─── Utils log ────────────────────────────────────────────────
|
// ─── Utils log ────────────────────────────────────────────────
|
||||||
// Le worker tourne dans un thread séparé — il passe les logs au thread principal
|
// Le worker tourne dans un thread séparé — il passe les logs au thread principal
|
||||||
@@ -33,7 +33,7 @@ function debug(msg: string) { parentPort?.postMessage({ type: 'log', level: 'deb
|
|||||||
|
|
||||||
function readSettings(): { mediaPath: string; completePath: string; organizeMode: string; nfoSupport: boolean } {
|
function readSettings(): { mediaPath: string; completePath: string; organizeMode: string; nfoSupport: boolean } {
|
||||||
try {
|
try {
|
||||||
const p = path.join(BASE_DIR, 'config', 'settings.json')
|
const p = path.join(DATA_DIR, 'config', 'settings.json')
|
||||||
if (!fs.existsSync(p)) return { mediaPath: '', completePath: '', organizeMode: 'hardlink', nfoSupport: false }
|
if (!fs.existsSync(p)) return { mediaPath: '', completePath: '', organizeMode: 'hardlink', nfoSupport: false }
|
||||||
return JSON.parse(fs.readFileSync(p, 'utf-8'))
|
return JSON.parse(fs.readFileSync(p, 'utf-8'))
|
||||||
} catch { return { mediaPath: '', completePath: '', organizeMode: 'hardlink', nfoSupport: false } }
|
} catch { return { mediaPath: '', completePath: '', organizeMode: 'hardlink', nfoSupport: false } }
|
||||||
|
|||||||
+2
-2
@@ -9,9 +9,9 @@
|
|||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import crypto from 'crypto'
|
import crypto from 'crypto'
|
||||||
import { BASE_DIR } from './config.js'
|
import { DATA_DIR } from './config.js'
|
||||||
|
|
||||||
const SECRET_PATH = path.join(BASE_DIR, 'config', 'secret.key')
|
const SECRET_PATH = path.join(DATA_DIR, 'config', 'secret.key')
|
||||||
|
|
||||||
function generateSecret(): string {
|
function generateSecret(): string {
|
||||||
return crypto.randomBytes(48).toString('hex')
|
return crypto.randomBytes(48).toString('hex')
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { BASE_DIR, _isBunBinary } from './config.js'
|
import { DATA_DIR } from './config.js'
|
||||||
|
|
||||||
const DATA_PATH = path.join(BASE_DIR, 'config', 'settings.json')
|
const DATA_PATH = path.join(DATA_DIR, 'config', 'settings.json')
|
||||||
|
|
||||||
export interface Settings {
|
export interface Settings {
|
||||||
mediaPath : string
|
mediaPath : string
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
import { randomUUID } from 'crypto'
|
import { randomUUID } from 'crypto'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { BASE_DIR } from '../config.js'
|
import { DATA_DIR } from '../config.js'
|
||||||
|
|
||||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ export function getAvailableClients(): TorrentClientDefinition[] {
|
|||||||
|
|
||||||
// ─── Persistence (clients enregistrés) ────────────────────────────────────────
|
// ─── Persistence (clients enregistrés) ────────────────────────────────────────
|
||||||
|
|
||||||
const CLIENTS_PATH = path.join(BASE_DIR, 'config', 'torrent_clients.json')
|
const CLIENTS_PATH = path.join(DATA_DIR, 'config', 'torrent_clients.json')
|
||||||
|
|
||||||
function loadClients(): SavedClient[] {
|
function loadClients(): SavedClient[] {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in new issue
Block a user