mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-22 00:07:52 +01:00
Fix:Downloader sets file permission and owner on files #286
This commit is contained in:
parent
405d333d60
commit
590dbe3991
@ -5,16 +5,18 @@ const archiver = require('archiver')
|
|||||||
const workerThreads = require('worker_threads')
|
const workerThreads = require('worker_threads')
|
||||||
const Logger = require('./Logger')
|
const Logger = require('./Logger')
|
||||||
const Download = require('./objects/Download')
|
const Download = require('./objects/Download')
|
||||||
|
const filePerms = require('./utils/filePerms')
|
||||||
const { getId } = require('./utils/index')
|
const { getId } = require('./utils/index')
|
||||||
const { writeConcatFile, writeMetadataFile } = require('./utils/ffmpegHelpers')
|
const { writeConcatFile, writeMetadataFile } = require('./utils/ffmpegHelpers')
|
||||||
const { getFileSize } = require('./utils/fileUtils')
|
const { getFileSize } = require('./utils/fileUtils')
|
||||||
const TAG = 'DownloadManager'
|
const TAG = 'DownloadManager'
|
||||||
class DownloadManager {
|
class DownloadManager {
|
||||||
constructor(db, MetadataPath, AudiobookPath, emitter) {
|
constructor(db, MetadataPath, AudiobookPath, Uid, Gid) {
|
||||||
|
this.Uid = Uid
|
||||||
|
this.Gid = Gid
|
||||||
this.db = db
|
this.db = db
|
||||||
this.MetadataPath = MetadataPath
|
this.MetadataPath = MetadataPath
|
||||||
this.AudiobookPath = AudiobookPath
|
this.AudiobookPath = AudiobookPath
|
||||||
this.emitter = emitter
|
|
||||||
|
|
||||||
this.downloadDirPath = Path.join(this.MetadataPath, 'downloads')
|
this.downloadDirPath = Path.join(this.MetadataPath, 'downloads')
|
||||||
|
|
||||||
@ -343,6 +345,9 @@ class DownloadManager {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set file permissions and ownership
|
||||||
|
await filePerms(download.fullPath, 0o774, this.Uid, this.Gid)
|
||||||
|
|
||||||
var filesize = await getFileSize(download.fullPath)
|
var filesize = await getFileSize(download.fullPath)
|
||||||
download.setComplete(filesize)
|
download.setComplete(filesize)
|
||||||
if (download.socket) {
|
if (download.socket) {
|
||||||
|
@ -54,7 +54,7 @@ class Server {
|
|||||||
|
|
||||||
this.streamManager = new StreamManager(this.db, this.MetadataPath, this.emitter.bind(this), this.clientEmitter.bind(this))
|
this.streamManager = new StreamManager(this.db, this.MetadataPath, this.emitter.bind(this), this.clientEmitter.bind(this))
|
||||||
this.rssFeeds = new RssFeeds(this.Port, this.db)
|
this.rssFeeds = new RssFeeds(this.Port, this.db)
|
||||||
this.downloadManager = new DownloadManager(this.db, this.MetadataPath, this.AudiobookPath, this.emitter.bind(this))
|
this.downloadManager = new DownloadManager(this.db, this.MetadataPath, this.AudiobookPath, this.Uid, this.Gid)
|
||||||
this.apiController = new ApiController(this.MetadataPath, this.db, this.auth, this.streamManager, this.rssFeeds, this.downloadManager, this.coverController, this.backupManager, this.watcher, this.cacheManager, this.emitter.bind(this), this.clientEmitter.bind(this))
|
this.apiController = new ApiController(this.MetadataPath, this.db, this.auth, this.streamManager, this.rssFeeds, this.downloadManager, this.coverController, this.backupManager, this.watcher, this.cacheManager, this.emitter.bind(this), this.clientEmitter.bind(this))
|
||||||
this.hlsController = new HlsController(this.db, this.auth, this.streamManager, this.emitter.bind(this), this.streamManager.StreamsPath)
|
this.hlsController = new HlsController(this.db, this.auth, this.streamManager, this.emitter.bind(this), this.streamManager.StreamsPath)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user