mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 12:50:09 +00:00
Add configurable file/dir perms and UMASK support
Introduce file and directory permission settings (fileChmod, dirChmod) end-to-end. UI: new controls in Paths settings with octal validation and defaults (664/775). API: GET exposes defaults; PUT validates octal strings and upserts configuration keys (file_chmod, dir_chmod) and clears related cache keys. Runtime: read config values in file utilities and services (FileOrganizer, direct-download, chapter-merger, epub-fixer) to apply mkdir modes and chmod files/dirs; FileOrganizer now accepts fileMode/dirMode and getFileOrganizer reads/parses DB settings. Docker: add UMASK option to docker-compose and propagate/apply UMASK in entrypoint/app-start scripts. Tests: update mocks to account for config service usage.
This commit is contained in:
@@ -17,6 +17,7 @@ import * as cheerio from 'cheerio';
|
||||
import path from 'path';
|
||||
import fs from 'fs/promises';
|
||||
import { RMABLogger } from './logger';
|
||||
import { getConfigService } from '../services/config.service';
|
||||
|
||||
const moduleLogger = RMABLogger.create('EpubFixer');
|
||||
|
||||
@@ -204,7 +205,10 @@ export async function fixEpubForKindle(
|
||||
// Create unique temp subdirectory to avoid filename conflicts
|
||||
// This preserves the original filename for the final organized file
|
||||
const uniqueDir = path.join(tempDir, `kindle-fix-${Date.now()}`);
|
||||
await fs.mkdir(uniqueDir, { recursive: true });
|
||||
const configService = getConfigService();
|
||||
const dirChmodStr = await configService.get('dir_chmod') || '775';
|
||||
const dirMode = parseInt(dirChmodStr, 8);
|
||||
await fs.mkdir(uniqueDir, { recursive: true, mode: dirMode });
|
||||
|
||||
// Keep original filename
|
||||
const sourceFilename = path.basename(sourcePath);
|
||||
|
||||
Reference in New Issue
Block a user