MOBILE-3320 config: Update old config references
parent
61b3cface6
commit
836e866443
|
@ -15,7 +15,7 @@
|
|||
const { execSync } = require('child_process');
|
||||
const { resolve } = require('path');
|
||||
|
||||
export function getConfig(environment) {
|
||||
function getConfig(environment) {
|
||||
const { parse: parseJsonc } = require('jsonc-parser');
|
||||
const { readFileSync, existsSync } = require('fs');
|
||||
const envSuffixesMap = {
|
||||
|
@ -38,11 +38,14 @@ export function getConfig(environment) {
|
|||
return config;
|
||||
}
|
||||
|
||||
export function getBuild(environment) {
|
||||
function getBuild(environment) {
|
||||
return {
|
||||
environment,
|
||||
isProduction: environment === 'production',
|
||||
isTesting: environment === 'testing',
|
||||
isDevelopment: environment === 'development',
|
||||
lastCommitHash: execSync('git log -1 --pretty=format:"%H"').toString(),
|
||||
compilationTime: Date.now(),
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = { getConfig, getBuild };
|
||||
|
|
|
@ -22,7 +22,7 @@ import { CoreSites } from '@services/sites';
|
|||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CoreLoginHelper, CoreLoginHelperProvider } from '@core/login/services/helper';
|
||||
import CoreConfigConstants from '@app/config.json';
|
||||
import { CoreConstants } from '@/app/core/constants';
|
||||
import { Translate } from '@singletons/core.singletons';
|
||||
import { CoreSiteIdentityProvider, CoreSitePublicConfigResponse } from '@/app/classes/site';
|
||||
import { CoreEvents, CoreEventsProvider } from '@/app/services/events';
|
||||
|
@ -66,10 +66,10 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
|
|||
|
||||
const canScanQR = CoreUtils.instance.canScanQR();
|
||||
if (canScanQR) {
|
||||
if (typeof CoreConfigConstants['displayqroncredentialscreen'] == 'undefined') {
|
||||
if (typeof CoreConstants.CONFIG.displayqroncredentialscreen == 'undefined') {
|
||||
this.showScanQR = CoreLoginHelper.instance.isFixedUrlSet();
|
||||
} else {
|
||||
this.showScanQR = !!CoreConfigConstants['displayqroncredentialscreen'];
|
||||
this.showScanQR = !!CoreConstants.CONFIG.displayqroncredentialscreen;
|
||||
}
|
||||
} else {
|
||||
this.showScanQR = false;
|
||||
|
@ -83,7 +83,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
|
|||
this.route.queryParams.subscribe(params => {
|
||||
this.siteUrl = params['siteUrl'];
|
||||
this.siteName = params['siteName'] || undefined;
|
||||
this.logoUrl = !CoreConfigConstants.forceLoginLogo && params['logoUrl'] || undefined;
|
||||
this.logoUrl = !CoreConstants.CONFIG.forceLoginLogo && params['logoUrl'] || undefined;
|
||||
this.siteConfig = params['siteConfig'];
|
||||
this.urlToOpen = params['urlToOpen'];
|
||||
|
||||
|
@ -160,7 +160,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
|
|||
*/
|
||||
protected treatSiteConfig(): void {
|
||||
if (this.siteConfig) {
|
||||
this.siteName = CoreConfigConstants.sitename ? CoreConfigConstants.sitename : this.siteConfig.sitename;
|
||||
this.siteName = CoreConstants.CONFIG.sitename ?? this.siteConfig.sitename;
|
||||
this.logoUrl = CoreLoginHelper.instance.getLogoUrl(this.siteConfig);
|
||||
this.authInstructions = this.siteConfig.authinstructions || Translate.instance.instant('core.login.loginsteps');
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import { CoreDomUtils } from '@services/utils/dom';
|
|||
import { CoreLoginHelper, CoreLoginHelperProvider } from '@core/login/services/helper';
|
||||
import { CoreSite } from '@classes/site';
|
||||
import { CoreError } from '@classes/errors/error';
|
||||
import CoreConfigConstants from '@app/config.json';
|
||||
import { CoreConstants } from '@/app/core/constants';
|
||||
import { Translate } from '@singletons/core.singletons';
|
||||
import { CoreUrl } from '@singletons/url';
|
||||
import { CoreUrlUtils } from '@/app/services/utils/url';
|
||||
|
@ -63,9 +63,9 @@ export class CoreLoginSitePage implements OnInit {
|
|||
) {
|
||||
|
||||
let url = '';
|
||||
this.siteSelector = CoreConfigConstants.multisitesdisplay;
|
||||
this.siteSelector = CoreConstants.CONFIG.multisitesdisplay;
|
||||
|
||||
const siteFinderSettings: Partial<SiteFinderSettings> = CoreConfigConstants['sitefindersettings'] || {};
|
||||
const siteFinderSettings: Partial<SiteFinderSettings> = CoreConstants.CONFIG.sitefindersettings || {};
|
||||
this.siteFinderSettings = {
|
||||
displaysitename: true,
|
||||
displayimage: true,
|
||||
|
@ -79,12 +79,12 @@ export class CoreLoginSitePage implements OnInit {
|
|||
// Load fixed sites if they're set.
|
||||
if (CoreLoginHelper.instance.hasSeveralFixedSites()) {
|
||||
url = this.initSiteSelector();
|
||||
} else if (CoreConfigConstants.enableonboarding && !CoreApp.instance.isIOS() && !CoreApp.instance.isMac()) {
|
||||
} else if (CoreConstants.CONFIG.enableonboarding && !CoreApp.instance.isIOS() && !CoreApp.instance.isMac()) {
|
||||
this.initOnboarding();
|
||||
}
|
||||
|
||||
this.showScanQR = CoreUtils.instance.canScanQR() && (typeof CoreConfigConstants['displayqronsitescreen'] == 'undefined' ||
|
||||
!!CoreConfigConstants['displayqronsitescreen']);
|
||||
this.showScanQR = CoreUtils.instance.canScanQR() && (typeof CoreConstants.CONFIG.displayqronsitescreen == 'undefined' ||
|
||||
!!CoreConstants.CONFIG.displayqronsitescreen);
|
||||
|
||||
this.siteForm = this.formBuilder.group({
|
||||
siteUrl: [url, this.moodleUrlValidator()],
|
||||
|
|
|
@ -27,7 +27,6 @@ import { CoreDomUtils } from '@services/utils/dom';
|
|||
import { CoreTextUtils } from '@services/utils/text';
|
||||
import { CoreUrlParams, CoreUrlUtils } from '@services/utils/url';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import CoreConfigConstants from '@app/config.json';
|
||||
import { CoreConstants } from '@core/constants';
|
||||
import { CoreSite, CoreSiteConfig, CoreSiteIdentityProvider, CoreSitePublicConfigResponse } from '@classes/site';
|
||||
import { CoreError } from '@classes/errors/error';
|
||||
|
@ -304,7 +303,7 @@ export class CoreLoginHelperProvider {
|
|||
* @return Logo URL.
|
||||
*/
|
||||
getLogoUrl(config: CoreSitePublicConfigResponse): string | undefined {
|
||||
return !CoreConfigConstants.forceLoginLogo && config ? (config.logourl || config.compactlogourl) : undefined;
|
||||
return !CoreConstants.CONFIG.forceLoginLogo && config ? (config.logourl || config.compactlogourl) : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -368,7 +367,7 @@ export class CoreLoginHelperProvider {
|
|||
* @return Fixed site or list of fixed sites.
|
||||
*/
|
||||
getFixedSites(): string | CoreLoginSiteInfo[] {
|
||||
return CoreConfigConstants.siteurl;
|
||||
return CoreConstants.CONFIG.siteurl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -489,8 +488,8 @@ export class CoreLoginHelperProvider {
|
|||
* @return Whether there are several fixed URLs.
|
||||
*/
|
||||
hasSeveralFixedSites(): boolean {
|
||||
return !!(CoreConfigConstants.siteurl && Array.isArray(CoreConfigConstants.siteurl) &&
|
||||
CoreConfigConstants.siteurl.length > 1);
|
||||
return !!(CoreConstants.CONFIG.siteurl && Array.isArray(CoreConstants.CONFIG.siteurl) &&
|
||||
CoreConstants.CONFIG.siteurl.length > 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -528,11 +527,11 @@ export class CoreLoginHelperProvider {
|
|||
* @return Whether there is 1 fixed URL.
|
||||
*/
|
||||
isFixedUrlSet(): boolean {
|
||||
if (Array.isArray(CoreConfigConstants.siteurl)) {
|
||||
return CoreConfigConstants.siteurl.length == 1;
|
||||
if (Array.isArray(CoreConstants.CONFIG.siteurl)) {
|
||||
return CoreConstants.CONFIG.siteurl.length == 1;
|
||||
}
|
||||
|
||||
return !!CoreConfigConstants.siteurl;
|
||||
return !!CoreConstants.CONFIG.siteurl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -585,7 +584,7 @@ export class CoreLoginHelperProvider {
|
|||
const sites = <CoreLoginSiteInfo[]> this.getFixedSites();
|
||||
|
||||
return sites.some((site) => CoreUrl.sameDomainAndPath(siteUrl, site.url));
|
||||
} else if (CoreConfigConstants.multisitesdisplay == 'sitefinder' && CoreConfigConstants.onlyallowlistedsites) {
|
||||
} else if (CoreConstants.CONFIG.multisitesdisplay == 'sitefinder' && CoreConstants.CONFIG.onlyallowlistedsites) {
|
||||
// Call the sites finder to validate the site.
|
||||
const result = await CoreSites.instance.findSites(siteUrl.replace(/^https?:\/\/|\.\w{2,3}\/?$/g, ''));
|
||||
|
||||
|
@ -852,14 +851,14 @@ export class CoreLoginHelperProvider {
|
|||
urlParams?: CoreUrlParams,
|
||||
): string {
|
||||
|
||||
service = service || CoreConfigConstants.wsextservice;
|
||||
service = service || CoreConstants.CONFIG.wsextservice;
|
||||
launchUrl = launchUrl || siteUrl + '/local/mobile/launch.php';
|
||||
|
||||
const passport = Math.random() * 1000;
|
||||
let loginUrl = launchUrl + '?service=' + service;
|
||||
|
||||
loginUrl += '&passport=' + passport;
|
||||
loginUrl += '&urlscheme=' + CoreConfigConstants.customurlscheme;
|
||||
loginUrl += '&urlscheme=' + CoreConstants.CONFIG.customurlscheme;
|
||||
|
||||
if (urlParams) {
|
||||
loginUrl = CoreUrlUtils.instance.addParamsToUrl(loginUrl, urlParams);
|
||||
|
@ -1033,7 +1032,7 @@ export class CoreLoginHelperProvider {
|
|||
*/
|
||||
shouldShowSSOConfirm(typeOfLogin: number): boolean {
|
||||
return !this.isSSOEmbeddedBrowser(typeOfLogin) &&
|
||||
(!CoreConfigConstants.skipssoconfirmation || String(CoreConfigConstants.skipssoconfirmation) === 'false');
|
||||
(!CoreConstants.CONFIG.skipssoconfirmation || String(CoreConstants.CONFIG.skipssoconfirmation) === 'false');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1053,7 +1052,7 @@ export class CoreLoginHelperProvider {
|
|||
* @param message The warning message.
|
||||
*/
|
||||
protected showMoodleAppNoticeModal(message: string): void {
|
||||
const storesConfig: CoreStoreConfig = CoreConfigConstants.appstores;
|
||||
const storesConfig: CoreStoreConfig = CoreConstants.CONFIG.appstores;
|
||||
storesConfig.desktop = 'https://download.moodle.org/desktop/';
|
||||
storesConfig.mobile = 'https://download.moodle.org/mobile/';
|
||||
storesConfig.default = 'https://download.moodle.org/mobile/';
|
||||
|
|
|
@ -38,7 +38,7 @@ declare global {
|
|||
languages: Record<string, string>;
|
||||
wsservice: string;
|
||||
wsextservice: string;
|
||||
demo_sites: Record<string, Record<string, CoreSitesDemoSiteData>>;
|
||||
demo_sites: Record<string, CoreSitesDemoSiteData>;
|
||||
font_sizes: number[];
|
||||
customurlscheme: string;
|
||||
siteurl: string;
|
||||
|
@ -64,6 +64,8 @@ declare global {
|
|||
forceLoginLogo: boolean;
|
||||
ioswebviewscheme: string;
|
||||
appstores: Record<string, string>;
|
||||
displayqroncredentialscreen?: boolean;
|
||||
displayqronsitescreen?: boolean;
|
||||
};
|
||||
|
||||
BUILD: {
|
||||
|
|
Loading…
Reference in New Issue