web-manager 3.0.2 → 3.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +18 -6
- package/package.json +1 -1
package/index.js
CHANGED
@@ -287,10 +287,17 @@ function Manager() {
|
|
287
287
|
}
|
288
288
|
}
|
289
289
|
|
290
|
+
function _isValidRedirectUrl(This, url) {
|
291
|
+
var returnUrlObject = new URL(decodeURIComponent(url));
|
292
|
+
var currentUrlObject = new URL(window.location.href);
|
293
|
+
return returnUrlObject.host === currentUrlObject.host
|
294
|
+
|| returnUrlObject.protocol === This.properties.global.app + ':'
|
295
|
+
}
|
296
|
+
|
290
297
|
function _authHandle_in_normal(This, user) {
|
291
298
|
var domLib = This.dom();
|
292
299
|
var returnUrl = This.properties.page.queryString.get('auth_redirect');
|
293
|
-
if (returnUrl) {
|
300
|
+
if (returnUrl && _isValidRedirectUrl(This, returnUrl)) {
|
294
301
|
window.location.href = decodeURIComponent(returnUrl);
|
295
302
|
return;
|
296
303
|
}
|
@@ -615,17 +622,22 @@ function Manager() {
|
|
615
622
|
This.properties.global.brand.name = configuration.global.brand.name;
|
616
623
|
This.properties.meta.environment = utilities.get(configuration, 'global.settings.debug.environment', This.properties.meta.environment);
|
617
624
|
|
625
|
+
// This.properties.global.cacheBreaker = This.properties.meta.environment === 'development'
|
626
|
+
// ? new Date().getTime()
|
627
|
+
// : This.properties.global.cacheBreaker;
|
618
628
|
// This.log('Config: ', options_user);
|
619
629
|
|
620
630
|
// parse query stringify
|
621
631
|
This.properties.page.queryString = new URLSearchParams(window.location.search);
|
622
632
|
var pageQueryString = This.properties.page.queryString
|
623
633
|
var pagePathname = window.location.pathname;
|
624
|
-
|
625
|
-
|
634
|
+
var qsAff = pageQueryString.get('aff');
|
635
|
+
if (qsAff) {
|
636
|
+
This.storage().set('auth.affiliateCode', qsAff);
|
626
637
|
}
|
627
|
-
|
628
|
-
|
638
|
+
var qsRedirect = pageQueryString.get('redirect');
|
639
|
+
if (qsRedirect && _isValidRedirectUrl(This, qsRedirect)) {
|
640
|
+
window.location.href = decodeURIComponent(qsRedirect);
|
629
641
|
return;
|
630
642
|
}
|
631
643
|
var authRegex = /\/(signin|signup|forgot)\//;
|
@@ -1162,7 +1174,7 @@ function Manager() {
|
|
1162
1174
|
if (!('serviceWorker' in navigator) || !(typeof firebase.messaging !== 'undefined')) {return}
|
1163
1175
|
|
1164
1176
|
// service worker guide: https://developers.google.com/web/updates/2018/06/fresher-sw
|
1165
|
-
navigator.serviceWorker.register('/' + (options_user.serviceWorker.path || 'master-service-worker.js') + '?config=' + encodeURIComponent(JSON.stringify({name: This.properties.global.brand.name, env: This.properties.meta.environment, v: This.properties.global.version, firebase: options_user.libraries.firebase_app.config})) )
|
1177
|
+
navigator.serviceWorker.register('/' + (options_user.serviceWorker.path || 'master-service-worker.js') + '?config=' + encodeURIComponent(JSON.stringify({name: This.properties.global.brand.name, app: This.properties.global.app, env: This.properties.meta.environment, v: This.properties.global.version, cb: This.properties.global.cacheBreaker, firebase: options_user.libraries.firebase_app.config})) )
|
1166
1178
|
.then(function (registration) {
|
1167
1179
|
// firebase.messaging().useServiceWorker(registration);
|
1168
1180
|
// console.log('----TEST registration', registration);
|
package/package.json
CHANGED