From fd1fcbb1c00960453ba5ffcba4b6d0ca88396a02 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Sun, 6 Jun 2021 16:36:11 +0530 Subject: Extracted common string into constant. --- src/config.js | 4 ++++ src/electron/ipc-api/autoUpdate.js | 5 +++-- src/features/announcements/api.js | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/config.js b/src/config.js index da2eff0cc..8930c755f 100644 --- a/src/config.js +++ b/src/config.js @@ -179,6 +179,10 @@ export const FRANZ_SERVICE_REQUEST = `${GITHUB_FERDI_URL}/recipes/issues`; export const FRANZ_TRANSLATION = 'https://crowdin.com/project/getferdi'; export const FRANZ_DEV_DOCS = 'http://bit.ly/franz-dev-hub'; +export const GITHUB_ORG_NAME = 'getferdi'; +export const GITHUB_FERDI_REPO_NAME = 'ferdi'; +export const GITHUB_NIGHTLIES_REPO_NAME = 'nightlies'; + export const FILE_SYSTEM_SETTINGS_TYPES = [ 'app', 'proxy', diff --git a/src/electron/ipc-api/autoUpdate.js b/src/electron/ipc-api/autoUpdate.js index 58eda801c..603049c4e 100644 --- a/src/electron/ipc-api/autoUpdate.js +++ b/src/electron/ipc-api/autoUpdate.js @@ -1,5 +1,6 @@ import { app, ipcMain } from 'electron'; import { autoUpdater } from 'electron-updater'; +import { GITHUB_NIGHTLIES_REPO_NAME, GITHUB_ORG_NAME } from '../../config'; import { isMac, isWindows } from '../../environment'; const debug = require('debug')('Ferdi:ipcApi:autoUpdate'); @@ -21,8 +22,8 @@ export default (params) => { autoUpdater.allowPrerelease = Boolean(params.settings.app.get('nightly')); autoUpdater.setFeedURL({ provider: 'github', - repo: 'nightlies', - owner: 'getferdi', + owner: GITHUB_ORG_NAME, + repo: GITHUB_NIGHTLIES_REPO_NAME, }); } diff --git a/src/features/announcements/api.js b/src/features/announcements/api.js index 2c4d11d05..f34a62745 100644 --- a/src/features/announcements/api.js +++ b/src/features/announcements/api.js @@ -1,6 +1,7 @@ import { app } from '@electron/remote'; import Request from '../../stores/lib/Request'; import apiBase from '../../api/apiBase'; +import { GITHUB_FERDI_REPO_NAME, GITHUB_ORG_NAME } from '../../config'; const debug = require('debug')('Ferdi:feature:announcements:api'); @@ -11,7 +12,7 @@ export const announcementsApi = { }, async getChangelog(version) { - const url = `https://api.github.com/repos/getferdi/ferdi/releases/tags/v${version}`; + const url = `https://api.github.com/repos/${GITHUB_ORG_NAME}/${GITHUB_FERDI_REPO_NAME}/releases/tags/v${version}`; debug(`fetching release changelog from Github url: ${url}`); const request = await window.fetch(url, { method: 'GET' }); if (!request.ok) return null; -- cgit v1.2.3-70-g09d2