MOBILE-4184 url.ts: Read new property from config

main
Alfonso Salces 2022-11-14 09:31:51 +01:00
parent a1dc1ec631
commit 6603db43f9
3 changed files with 4 additions and 2 deletions

View File

@ -109,5 +109,6 @@
"short": 2000, "short": 2000,
"long": 3500, "long": 3500,
"sticky": 0 "sticky": 0
} },
"disableTokenFile": false
} }

View File

@ -118,7 +118,7 @@ export class CoreUrlUtilsProvider {
canUseTokenPluginFile(url: string, siteUrl: string, accessKey?: string): boolean { canUseTokenPluginFile(url: string, siteUrl: string, accessKey?: string): boolean {
// Do not use tokenpluginfile if site doesn't use slash params, the URL doesn't work. // Do not use tokenpluginfile if site doesn't use slash params, the URL doesn't work.
// Also, only use it for "core" pluginfile endpoints. Some plugins can implement their own endpoint (like customcert). // Also, only use it for "core" pluginfile endpoints. Some plugins can implement their own endpoint (like customcert).
return !!accessKey && !url.match(/[&?]file=/) && ( return !CoreConstants.CONFIG.disableTokenFile && !!accessKey && !url.match(/[&?]file=/) && (
url.indexOf(CoreText.concatenatePaths(siteUrl, 'pluginfile.php')) === 0 || url.indexOf(CoreText.concatenatePaths(siteUrl, 'pluginfile.php')) === 0 ||
url.indexOf(CoreText.concatenatePaths(siteUrl, 'webservice/pluginfile.php')) === 0); url.indexOf(CoreText.concatenatePaths(siteUrl, 'webservice/pluginfile.php')) === 0);
} }

View File

@ -73,4 +73,5 @@ export interface EnvironmentConfig {
toastDurations: Record<ToastDuration, number>; toastDurations: Record<ToastDuration, number>;
disableCallWSInBackground?: boolean; // If true, disable calling WS in background. disableCallWSInBackground?: boolean; // If true, disable calling WS in background.
callWSInBackgroundExpirationTime?: number; // Ms to consider an entry expired when calling WS in background. Default: 1 week. callWSInBackgroundExpirationTime?: number; // Ms to consider an entry expired when calling WS in background. Default: 1 week.
disableTokenFile: boolean; // Disable the use of tokenpluginfile.php for downloading files (so it fallbacks to pluginfile.php)
} }