diff options
author | Vijay A <avijayr@protonmail.com> | 2021-08-08 20:42:22 +0530 |
---|---|---|
committer | Vijay A <avijayr@protonmail.com> | 2021-08-08 20:42:22 +0530 |
commit | a77c1533f73199287990f83ce9fb16416c056c46 (patch) | |
tree | 4584bb9d61553436bde77db9aafe1b0a0233030b | |
parent | refactor(docker): remove unnecessary copy of package config files into Docker... (diff) | |
download | ferdium-app-a77c1533f73199287990f83ce9fb16416c056c46.tar.gz ferdium-app-a77c1533f73199287990f83ce9fb16416c056c46.tar.zst ferdium-app-a77c1533f73199287990f83ce9fb16416c056c46.zip |
fix: fix the changelog api to handle nightly builds
-rw-r--r-- | src/api/apiBase.js | 5 | ||||
-rw-r--r-- | src/api/server/ServerApi.js | 2 | ||||
-rw-r--r-- | src/features/announcements/api.js | 8 |
3 files changed, 6 insertions, 9 deletions
diff --git a/src/api/apiBase.js b/src/api/apiBase.js index db974c96f..ad37ca02c 100644 --- a/src/api/apiBase.js +++ b/src/api/apiBase.js | |||
@@ -30,10 +30,7 @@ const apiBase = (withVersion = true) => { | |||
30 | url = window.ferdi.stores.settings.all.app.server; | 30 | url = window.ferdi.stores.settings.all.app.server; |
31 | } | 31 | } |
32 | 32 | ||
33 | if (withVersion) { | 33 | return withVersion ? `${url}/${API_VERSION}` : url; |
34 | return `${url}/${API_VERSION}`; | ||
35 | } | ||
36 | return url; | ||
37 | }; | 34 | }; |
38 | 35 | ||
39 | export default apiBase; | 36 | export default apiBase; |
diff --git a/src/api/server/ServerApi.js b/src/api/server/ServerApi.js index 2111eb80b..bc0b0dff9 100644 --- a/src/api/server/ServerApi.js +++ b/src/api/server/ServerApi.js | |||
@@ -447,7 +447,7 @@ export default class ServerApi { | |||
447 | } | 447 | } |
448 | 448 | ||
449 | async hideNews(id) { | 449 | async hideNews(id) { |
450 | const request = await sendAuthRequest(`${apiBase(true)}/news/${id}/read`); | 450 | const request = await sendAuthRequest(`${apiBase()}/news/${id}/read`); |
451 | if (!request.ok) throw request; | 451 | if (!request.ok) throw request; |
452 | debug('ServerApi::hideNews resolves', id); | 452 | debug('ServerApi::hideNews resolves', id); |
453 | } | 453 | } |
diff --git a/src/features/announcements/api.js b/src/features/announcements/api.js index 53df69eed..a7fe24bb1 100644 --- a/src/features/announcements/api.js +++ b/src/features/announcements/api.js | |||
@@ -1,7 +1,7 @@ | |||
1 | import { app } from '@electron/remote'; | 1 | import { app } from '@electron/remote'; |
2 | import Request from '../../stores/lib/Request'; | 2 | import Request from '../../stores/lib/Request'; |
3 | import apiBase from '../../api/apiBase'; | 3 | import apiBase from '../../api/apiBase'; |
4 | import { GITHUB_FERDI_REPO_NAME, GITHUB_ORG_NAME } from '../../config'; | 4 | import { GITHUB_FERDI_REPO_NAME, GITHUB_NIGHTLIES_REPO_NAME, GITHUB_ORG_NAME } from '../../config'; |
5 | 5 | ||
6 | const debug = require('debug')('Ferdi:feature:announcements:api'); | 6 | const debug = require('debug')('Ferdi:feature:announcements:api'); |
7 | 7 | ||
@@ -12,8 +12,8 @@ export const announcementsApi = { | |||
12 | }, | 12 | }, |
13 | 13 | ||
14 | async getChangelog(version) { | 14 | async getChangelog(version) { |
15 | // TODO: This doesn't seem to handle the different 'nightlies' repo that we currently use. Needs to be fixed. | 15 | const ferdiRepoName = version.includes('nightly') ? GITHUB_NIGHTLIES_REPO_NAME : GITHUB_FERDI_REPO_NAME; |
16 | const url = `https://api.github.com/repos/${GITHUB_ORG_NAME}/${GITHUB_FERDI_REPO_NAME}/releases/tags/v${version}`; | 16 | const url = `https://api.github.com/repos/${GITHUB_ORG_NAME}/${ferdiRepoName}/releases/tags/v${version}`; |
17 | debug(`fetching release changelog from Github url: ${url}`); | 17 | debug(`fetching release changelog from Github url: ${url}`); |
18 | const request = await window.fetch(url, { method: 'GET' }); | 18 | const request = await window.fetch(url, { method: 'GET' }); |
19 | if (!request.ok) return null; | 19 | if (!request.ok) return null; |
@@ -22,7 +22,7 @@ export const announcementsApi = { | |||
22 | }, | 22 | }, |
23 | 23 | ||
24 | async getAnnouncement(version) { | 24 | async getAnnouncement(version) { |
25 | const url = `${apiBase(true)}/announcements/${version}`; | 25 | const url = `${apiBase()}/announcements/${version}`; |
26 | debug(`fetching release announcement from api url: ${url}`); | 26 | debug(`fetching release announcement from api url: ${url}`); |
27 | const response = await window.fetch(url, { method: 'GET' }); | 27 | const response = await window.fetch(url, { method: 'GET' }); |
28 | if (!response.ok) return null; | 28 | if (!response.ok) return null; |