1
0
Fork 0
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:
Chocobozzz 2023-07-19 16:02:49 +02:00
parent c6867725fb
commit 12dc3a942a
No known key found for this signature in database
GPG key ID: 583A612D890159BE
55 changed files with 1547 additions and 325 deletions

View file

@ -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,

View file

@ -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)))
}