1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 02:09:37 +02:00

Add house-keeping script

This commit is contained in:
Chocobozzz 2024-06-05 14:43:41 +02:00
parent 9b483bcb78
commit 2b189131fa
No known key found for this signature in database
GPG key ID: 583A612D890159BE
22 changed files with 368 additions and 133 deletions

View file

@ -0,0 +1,30 @@
import prompt from 'prompt'
export async function askConfirmation (message: string) {
return new Promise((res, rej) => {
prompt.start()
const schema = {
properties: {
confirm: {
type: 'string',
description: message + ' (y/n)',
default: 'n',
validator: /y[es]*|n[o]?/,
warning: 'Must respond yes or no',
required: true
}
}
}
prompt.get(schema, function (err, result) {
if (err) return rej(err)
return res(result.confirm?.match(/y/) !== null)
})
})
}
export function displayPeerTubeMustBeStoppedWarning () {
console.log(`/!\\ PeerTube must be stopped before running this script /!\\\n`)
}