mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Merge branch 'release/4.2.0' into develop
This commit is contained in:
commit
e722fb5923
3 changed files with 97 additions and 45 deletions
|
@ -1,4 +1,4 @@
|
|||
|
||||
import { buildUUID } from '@shared/extra-utils'
|
||||
import { HttpStatusCode } from '@shared/models'
|
||||
import { AbstractCommand, OverrideCommandOptions } from '../shared'
|
||||
|
||||
|
@ -8,16 +8,22 @@ export class FeedCommand extends AbstractCommand {
|
|||
|
||||
getXML (options: OverrideCommandOptions & {
|
||||
feed: FeedType
|
||||
ignoreCache: boolean
|
||||
format?: string
|
||||
}) {
|
||||
const { feed, format } = options
|
||||
const { feed, format, ignoreCache } = options
|
||||
const path = '/feeds/' + feed + '.xml'
|
||||
|
||||
const query: { [id: string]: string } = {}
|
||||
|
||||
if (ignoreCache) query.v = buildUUID()
|
||||
if (format) query.format = format
|
||||
|
||||
return this.getRequestText({
|
||||
...options,
|
||||
|
||||
path,
|
||||
query: format ? { format } : undefined,
|
||||
query,
|
||||
accept: 'application/xml',
|
||||
implicitToken: false,
|
||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||
|
@ -26,16 +32,21 @@ export class FeedCommand extends AbstractCommand {
|
|||
|
||||
getJSON (options: OverrideCommandOptions & {
|
||||
feed: FeedType
|
||||
ignoreCache: boolean
|
||||
query?: { [ id: string ]: any }
|
||||
}) {
|
||||
const { feed, query } = options
|
||||
const { feed, query = {}, ignoreCache } = options
|
||||
const path = '/feeds/' + feed + '.json'
|
||||
|
||||
const cacheQuery = ignoreCache
|
||||
? { v: buildUUID() }
|
||||
: {}
|
||||
|
||||
return this.getRequestText({
|
||||
...options,
|
||||
|
||||
path,
|
||||
query,
|
||||
query: { ...query, ...cacheQuery },
|
||||
accept: 'application/json',
|
||||
implicitToken: false,
|
||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue