aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/server-commands
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-06-27 10:36:31 +0200
committerChocobozzz <me@florianbigard.com>2022-06-27 10:36:31 +0200
commite722fb5923ddf11d72e48cec9788abc64327c22f (patch)
tree8f95b17fb3b7a1ea1809d5329be7483883102017 /shared/server-commands
parent00fe5d61369b1769c62686e5bd8e6e666f867598 (diff)
parent41e74ec9cd6076109c91128047d8b866c36a3005 (diff)
downloadPeerTube-e722fb5923ddf11d72e48cec9788abc64327c22f.tar.gz
PeerTube-e722fb5923ddf11d72e48cec9788abc64327c22f.tar.zst
PeerTube-e722fb5923ddf11d72e48cec9788abc64327c22f.zip
Merge branch 'release/4.2.0' into develop
Diffstat (limited to 'shared/server-commands')
-rw-r--r--shared/server-commands/feeds/feeds-command.ts21
1 files changed, 16 insertions, 5 deletions
diff --git a/shared/server-commands/feeds/feeds-command.ts b/shared/server-commands/feeds/feeds-command.ts
index 3c95f9536..939b18dee 100644
--- a/shared/server-commands/feeds/feeds-command.ts
+++ b/shared/server-commands/feeds/feeds-command.ts
@@ -1,4 +1,4 @@
1 1import { buildUUID } from '@shared/extra-utils'
2import { HttpStatusCode } from '@shared/models' 2import { HttpStatusCode } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 4
@@ -8,16 +8,22 @@ export class FeedCommand extends AbstractCommand {
8 8
9 getXML (options: OverrideCommandOptions & { 9 getXML (options: OverrideCommandOptions & {
10 feed: FeedType 10 feed: FeedType
11 ignoreCache: boolean
11 format?: string 12 format?: string
12 }) { 13 }) {
13 const { feed, format } = options 14 const { feed, format, ignoreCache } = options
14 const path = '/feeds/' + feed + '.xml' 15 const path = '/feeds/' + feed + '.xml'
15 16
17 const query: { [id: string]: string } = {}
18
19 if (ignoreCache) query.v = buildUUID()
20 if (format) query.format = format
21
16 return this.getRequestText({ 22 return this.getRequestText({
17 ...options, 23 ...options,
18 24
19 path, 25 path,
20 query: format ? { format } : undefined, 26 query,
21 accept: 'application/xml', 27 accept: 'application/xml',
22 implicitToken: false, 28 implicitToken: false,
23 defaultExpectedStatus: HttpStatusCode.OK_200 29 defaultExpectedStatus: HttpStatusCode.OK_200
@@ -26,16 +32,21 @@ export class FeedCommand extends AbstractCommand {
26 32
27 getJSON (options: OverrideCommandOptions & { 33 getJSON (options: OverrideCommandOptions & {
28 feed: FeedType 34 feed: FeedType
35 ignoreCache: boolean
29 query?: { [ id: string ]: any } 36 query?: { [ id: string ]: any }
30 }) { 37 }) {
31 const { feed, query } = options 38 const { feed, query = {}, ignoreCache } = options
32 const path = '/feeds/' + feed + '.json' 39 const path = '/feeds/' + feed + '.json'
33 40
41 const cacheQuery = ignoreCache
42 ? { v: buildUUID() }
43 : {}
44
34 return this.getRequestText({ 45 return this.getRequestText({
35 ...options, 46 ...options,
36 47
37 path, 48 path,
38 query, 49 query: { ...query, ...cacheQuery },
39 accept: 'application/json', 50 accept: 'application/json',
40 implicitToken: false, 51 implicitToken: false,
41 defaultExpectedStatus: HttpStatusCode.OK_200 52 defaultExpectedStatus: HttpStatusCode.OK_200