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