Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77f42b5b3e | ||
|
|
bd69f7a730 | ||
|
|
3ce6523248 | ||
|
|
2efed9dcfc | ||
|
|
88e2a0bc38 | ||
|
|
338e3f8547 | ||
|
|
d1ccc902da | ||
|
|
5e54e24b60 |
No files matched your search
@@ -1,5 +1,19 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [1.11.4](https://github.com/Masutayunikon/FanKarr/compare/v1.11.3...v1.11.4) (2026-03-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add config.ts with config variable (BASE_DIR...) ([a3eb67c](https://github.com/Masutayunikon/FanKarr/commit/a3eb67c9a0944500142a6636d57cae0acfd7543d))
|
||||||
|
|
||||||
|
## [1.11.3](https://github.com/Masutayunikon/FanKarr/compare/v1.11.2...v1.11.3) (2026-03-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* entrypoint.sh config directory ([7e4b2fa](https://github.com/Masutayunikon/FanKarr/commit/7e4b2fa60a5946d3220618f13420a07fa57e8e1b))
|
||||||
|
|
||||||
## [1.11.2](https://github.com/Masutayunikon/FanKarr/compare/v1.11.1...v1.11.2) (2026-03-20)
|
## [1.11.2](https://github.com/Masutayunikon/FanKarr/compare/v1.11.1...v1.11.2) (2026-03-20)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -7,6 +7,6 @@ PGID=${PGID:-1000}
|
|||||||
echo "[fankarr] Running as UID=${PUID} GID=${PGID}"
|
echo "[fankarr] Running as UID=${PUID} GID=${PGID}"
|
||||||
|
|
||||||
# Corriger les permissions du dossier data
|
# Corriger les permissions du dossier data
|
||||||
chown -R "$PUID:$PGID" /app/data
|
chown -R "$PUID:$PGID" /config
|
||||||
|
|
||||||
exec gosu "$PUID:$PGID" node dist/server/index.js
|
exec gosu "$PUID:$PGID" node dist/server/index.js
|
||||||
+2
-1
@@ -4,8 +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'
|
||||||
|
|
||||||
const DATA_PATH = path.join(process.cwd(), 'config', 'auth.json')
|
const DATA_PATH = path.join(BASE_DIR, 'config', 'auth.json')
|
||||||
const SALT_ROUNDS = 10
|
const SALT_ROUNDS = 10
|
||||||
|
|
||||||
interface AuthData {
|
interface AuthData {
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
|
const _isBunBinary = typeof (globalThis as any).Bun !== 'undefined'
|
||||||
|
&& path.dirname((process as any).execPath) !== process.cwd()
|
||||||
|
|
||||||
|
export const BASE_DIR = _isBunBinary
|
||||||
|
? path.dirname((process as any).execPath)
|
||||||
|
: process.cwd()
|
||||||
|
|
||||||
|
export const DATA_DIR = fs.existsSync('/.dockerenv')
|
||||||
|
? '/config'
|
||||||
|
: path.join(BASE_DIR, 'data')
|
||||||
+2
-15
@@ -12,23 +12,10 @@ 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'
|
||||||
|
|
||||||
registerDriver(qbittorrentDriver)
|
registerDriver(qbittorrentDriver)
|
||||||
|
|
||||||
// ── Base directory ─────────────────────────────────────────────
|
|
||||||
// Binaire Bun compilé : data/ et public/ sont à côté de l'exécutable
|
|
||||||
// Docker / dev : relatif au cwd (comportement inchangé)
|
|
||||||
const _isBunBinary = typeof (globalThis as any).Bun !== 'undefined'
|
|
||||||
&& path.dirname((process as any).execPath) !== process.cwd()
|
|
||||||
export const BASE_DIR = _isBunBinary
|
|
||||||
? path.dirname((process as any).execPath)
|
|
||||||
: process.cwd()
|
|
||||||
|
|
||||||
// DATA_DIR : /config
|
|
||||||
export const DATA_DIR = fs.existsSync('/.dockerenv')
|
|
||||||
? '/config'
|
|
||||||
: path.join(BASE_DIR, 'config')
|
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
const PORT = Number(process.env.PORT) || 9898
|
const PORT = Number(process.env.PORT) || 9898
|
||||||
const FANKAI_API = 'https://metadata.fankai.fr'
|
const FANKAI_API = 'https://metadata.fankai.fr'
|
||||||
@@ -416,7 +403,7 @@ app.get('/api/downloads', requireAuth, async (_req, res) => {
|
|||||||
|
|
||||||
let torrentFinal: any[] = []
|
let torrentFinal: any[] = []
|
||||||
try {
|
try {
|
||||||
const tfPath = path.join(process.cwd(), 'config', 'torrent_final.json')
|
const tfPath = path.join(BASE_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
-1
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { BASE_DIR } from './config.js'
|
||||||
|
|
||||||
export type LogLevel = 'debug' | 'info' | 'warn' | 'error'
|
export type LogLevel = 'debug' | 'info' | 'warn' | 'error'
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ export interface LogEntry {
|
|||||||
meta? : Record<string, any>
|
meta? : Record<string, any>
|
||||||
}
|
}
|
||||||
|
|
||||||
const LOGS_PATH = path.join(process.cwd(), 'config', 'logs.jsonl')
|
const LOGS_PATH = path.join(BASE_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,13 +15,7 @@ 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'
|
||||||
// Base directory : binaire Bun ou cwd (Docker/dev)
|
|
||||||
const _isBunBinary = typeof (globalThis as any).Bun !== 'undefined'
|
|
||||||
&& path.dirname((process as any).execPath) !== process.cwd()
|
|
||||||
const BASE_DIR = _isBunBinary
|
|
||||||
? path.dirname((process as any).execPath)
|
|
||||||
: process.cwd()
|
|
||||||
|
|
||||||
const TORRENTS_PATH = path.join(BASE_DIR, 'config', 'torrent_final.json')
|
const TORRENTS_PATH = path.join(BASE_DIR, 'config', 'torrent_final.json')
|
||||||
const ORGANIZED_PATH = path.join(BASE_DIR, 'config', 'organized.json')
|
const ORGANIZED_PATH = path.join(BASE_DIR, 'config', 'organized.json')
|
||||||
@@ -39,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(process.cwd(), 'config', 'settings.json')
|
const p = path.join(BASE_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
-1
@@ -9,8 +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'
|
||||||
|
|
||||||
const SECRET_PATH = path.join(process.cwd(), 'config', 'secret.key')
|
const SECRET_PATH = path.join(BASE_DIR, 'config', 'secret.key')
|
||||||
|
|
||||||
function generateSecret(): string {
|
function generateSecret(): string {
|
||||||
return crypto.randomBytes(48).toString('hex')
|
return crypto.randomBytes(48).toString('hex')
|
||||||
|
|||||||
+1
-5
@@ -1,11 +1,7 @@
|
|||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { BASE_DIR, _isBunBinary } from './config.js'
|
||||||
|
|
||||||
const _isBunBinary = typeof (globalThis as any).Bun !== 'undefined'
|
|
||||||
&& path.dirname((process as any).execPath) !== process.cwd()
|
|
||||||
const BASE_DIR = _isBunBinary
|
|
||||||
? path.dirname((process as any).execPath)
|
|
||||||
: process.cwd()
|
|
||||||
const DATA_PATH = path.join(BASE_DIR, 'config', 'settings.json')
|
const DATA_PATH = path.join(BASE_DIR, 'config', 'settings.json')
|
||||||
|
|
||||||
export interface Settings {
|
export interface Settings {
|
||||||
|
|||||||
@@ -9,6 +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'
|
||||||
|
|
||||||
// ─── Types ────────────────────────────────────────────────────────────────────
|
// ─── Types ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -77,7 +78,7 @@ export function getAvailableClients(): TorrentClientDefinition[] {
|
|||||||
|
|
||||||
// ─── Persistence (clients enregistrés) ────────────────────────────────────────
|
// ─── Persistence (clients enregistrés) ────────────────────────────────────────
|
||||||
|
|
||||||
const CLIENTS_PATH = path.join(process.cwd(), 'config', 'torrent_clients.json')
|
const CLIENTS_PATH = path.join(BASE_DIR, 'config', 'torrent_clients.json')
|
||||||
|
|
||||||
function loadClients(): SavedClient[] {
|
function loadClients(): SavedClient[] {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in new issue
Block a user