mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Implement replace file in server side
This commit is contained in:
parent
c6867725fb
commit
12dc3a942a
55 changed files with 1547 additions and 325 deletions
|
@ -74,6 +74,28 @@ export class ConfigCommand extends AbstractCommand {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
disableFileUpdate () {
|
||||
return this.setFileUpdateEnabled(false)
|
||||
}
|
||||
|
||||
enableFileUpdate () {
|
||||
return this.setFileUpdateEnabled(true)
|
||||
}
|
||||
|
||||
private setFileUpdateEnabled (enabled: boolean) {
|
||||
return this.updateExistingSubConfig({
|
||||
newConfig: {
|
||||
videoFile: {
|
||||
update: {
|
||||
enabled
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
enableChannelSync () {
|
||||
return this.setChannelSyncEnabled(true)
|
||||
}
|
||||
|
@ -466,6 +488,11 @@ export class ConfigCommand extends AbstractCommand {
|
|||
enabled: false
|
||||
}
|
||||
},
|
||||
videoFile: {
|
||||
update: {
|
||||
enabled: false
|
||||
}
|
||||
},
|
||||
import: {
|
||||
videos: {
|
||||
concurrency: 3,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { exec } from 'child_process'
|
||||
import { copy, ensureDir, readFile, remove } from 'fs-extra'
|
||||
import { copy, ensureDir, readFile, readdir, remove } from 'fs-extra'
|
||||
import { basename, join } from 'path'
|
||||
import { isGithubCI, root, wait } from '@shared/core-utils'
|
||||
import { getFileSize } from '@shared/extra-utils'
|
||||
|
@ -77,6 +77,12 @@ export class ServersCommand extends AbstractCommand {
|
|||
return join(root(), 'test' + this.server.internalServerNumber, directory)
|
||||
}
|
||||
|
||||
async countFiles (directory: string) {
|
||||
const files = await readdir(this.buildDirectory(directory))
|
||||
|
||||
return files.length
|
||||
}
|
||||
|
||||
buildWebVideoFilePath (fileUrl: string) {
|
||||
return this.buildDirectory(join('web-videos', basename(fileUrl)))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue