[Constants] Full self rewrite

This commit is contained in:
Ducko 2022-01-28 18:59:14 +00:00
parent fd76179fc1
commit a8c019efff

View file

@ -1,34 +1,20 @@
// Bootstrap consts, heavily copied as don't want to mess with it
const { releaseChannel } = require('./utils/buildInfo');
const settings = require('./appSettings').getSettings();
const { getSettings } = require('./appSettings');
const titleCase = (s) => s[0].toUpperCase() + s.slice(1);
const settings = getSettings();
function capitalizeFirstLetter(s) {
return s.charAt(0).toUpperCase() + s.slice(1);
}
const appNameSuffix = releaseChannel === 'stable' ? '' : capitalizeFirstLetter(releaseChannel);
const APP_COMPANY = 'Discord Inc';
const APP_DESCRIPTION = 'Discord - https://discord.com';
const appNameSuffix = releaseChannel === 'stable' ? '' : titleCase(releaseChannel);
const APP_NAME = 'Discord' + appNameSuffix;
const APP_NAME_FOR_HUMANS = 'Discord' + (appNameSuffix !== '' ? ' ' + appNameSuffix : '');
const APP_ID_BASE = 'com.squirrel';
const APP_ID = `${APP_ID_BASE}.${APP_NAME}.${APP_NAME}`;
const APP_PROTOCOL = 'Discord';
const API_ENDPOINT = settings.get('API_ENDPOINT') || 'https://discord.com/api';
const UPDATE_ENDPOINT = settings.get('UPDATE_ENDPOINT') || API_ENDPOINT;
const NEW_UPDATE_ENDPOINT = settings.get('NEW_UPDATE_ENDPOINT') || 'https://discord.com/api/updates/';
module.exports = {
APP_COMPANY,
APP_DESCRIPTION,
APP_COMPANY: 'Discord Inc',
APP_DESCRIPTION: 'Discord - https://discord.com',
APP_NAME,
APP_NAME_FOR_HUMANS,
APP_ID,
APP_PROTOCOL,
API_ENDPOINT,
NEW_UPDATE_ENDPOINT,
UPDATE_ENDPOINT
APP_NAME_FOR_HUMANS: 'Discord' + (appNameSuffix !== '' ? ' ' + appNameSuffix : ''),
APP_ID: [ 'com', 'squirrel', APP_NAME, APP_NAME ].join('.'),
APP_PROTOCOL: 'Discord',
API_ENDPOINT: settings.get('API_ENDPOINT') || 'https://discord.com/api',
NEW_UPDATE_ENDPOINT: settings.get('NEW_UPDATE_ENDPOINT') || 'https://discord.com/api/updates/',
UPDATE_ENDPOINT: settings.get('UPDATE_ENDPOINT') || 'https://discord.com/api'
};