diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-27 10:36:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-27 10:36:16 +0200 |
commit | 41e74ec9cd6076109c91128047d8b866c36a3005 (patch) | |
tree | c70c6c00913f42c19064e24cd725ded83f71a70a /shared/server-commands/feeds/feeds-command.ts | |
parent | 7a5c3d77fedd9099d1711feecfa975856750bcdf (diff) | |
download | PeerTube-41e74ec9cd6076109c91128047d8b866c36a3005.tar.gz PeerTube-41e74ec9cd6076109c91128047d8b866c36a3005.tar.zst PeerTube-41e74ec9cd6076109c91128047d8b866c36a3005.zip |
Fix broken feeds with published live
Diffstat (limited to 'shared/server-commands/feeds/feeds-command.ts')
-rw-r--r-- | shared/server-commands/feeds/feeds-command.ts | 21 |
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 | 1 | import { buildUUID } from '@shared/extra-utils' | |
2 | import { HttpStatusCode } from '@shared/models' | 2 | import { HttpStatusCode } from '@shared/models' |
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 3 | import { 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 |