1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Fix config storage paths

This commit is contained in:
Chocobozzz 2018-01-16 08:46:44 +01:00
parent 2d13b29965
commit 0b4204f983
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 16 additions and 9 deletions

View file

@ -8,7 +8,7 @@ import * as createTorrent from 'create-torrent'
import { pseudoRandomBytes } from 'crypto'
import { readdir, readFile, rename, stat, Stats, unlink, writeFile } from 'fs'
import * as mkdirp from 'mkdirp'
import { join } from 'path'
import { isAbsolute, join } from 'path'
import * as pem from 'pem'
import * as rimraf from 'rimraf'
import { URL } from 'url'
@ -70,6 +70,12 @@ function pageToStartAndCount (page: number, itemsPerPage: number) {
return { start, count: itemsPerPage }
}
function buildPath (path: string) {
if (isAbsolute(path)) return path
return join(root(), path)
}
function promisify0<A> (func: (cb: (err: any, result: A) => void) => void): () => Promise<A> {
return function promisified (): Promise<A> {
return new Promise<A>((resolve: (arg: A) => void, reject: (err: any) => void) => {
@ -136,6 +142,7 @@ export {
pageToStartAndCount,
sanitizeUrl,
sanitizeHost,
buildPath,
promisify0,
promisify1,