mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +02:00
Add plugin static files cache
This commit is contained in:
parent
7663e55a2c
commit
a8b666e9f1
6 changed files with 36 additions and 20 deletions
|
@ -19,18 +19,14 @@ async function generateRandomString (size: number) {
|
|||
return raw.toString('hex')
|
||||
}
|
||||
|
||||
interface FormattableToJSON { toFormattedJSON (args?: any) }
|
||||
function getFormattedObjects<U, T extends FormattableToJSON> (objects: T[], objectsTotal: number, formattedArg?: any) {
|
||||
const formattedObjects: U[] = []
|
||||
|
||||
objects.forEach(object => {
|
||||
formattedObjects.push(object.toFormattedJSON(formattedArg))
|
||||
})
|
||||
interface FormattableToJSON<U, V> { toFormattedJSON (args?: U): V }
|
||||
function getFormattedObjects<U, V, T extends FormattableToJSON<U, V>> (objects: T[], objectsTotal: number, formattedArg?: U) {
|
||||
const formattedObjects = objects.map(o => o.toFormattedJSON(formattedArg))
|
||||
|
||||
return {
|
||||
total: objectsTotal,
|
||||
data: formattedObjects
|
||||
} as ResultList<U>
|
||||
} as ResultList<V>
|
||||
}
|
||||
|
||||
const getServerActor = memoizee(async function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue