Merge pull request #5749 from featheredtoast/service-worker-registration-fixes
Fix - service worker registrations
This commit is contained in:
commit
4c6d2ed59a
|
@ -2,7 +2,6 @@ export default {
|
||||||
name: 'register-service-worker',
|
name: 'register-service-worker',
|
||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
window.addEventListener('load', () => {
|
|
||||||
const isSecured = (document.location.protocol === 'https:') ||
|
const isSecured = (document.location.protocol === 'https:') ||
|
||||||
(location.hostname === "localhost");
|
(location.hostname === "localhost");
|
||||||
|
|
||||||
|
@ -23,6 +22,5 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
Discourse.ThemeSettings = ps.get('themeSettings');
|
Discourse.ThemeSettings = ps.get('themeSettings');
|
||||||
Discourse.LetterAvatarVersion = '<%= LetterAvatar.version %>';
|
Discourse.LetterAvatarVersion = '<%= LetterAvatar.version %>';
|
||||||
Discourse.MarkdownItURL = '<%= asset_url('markdown-it-bundle.js') %>';
|
Discourse.MarkdownItURL = '<%= asset_url('markdown-it-bundle.js') %>';
|
||||||
Discourse.ServiceWorkerURL = '<%= Rails.application.assets_manifest.assets['service-worker.js'] %>'
|
Discourse.ServiceWorkerURL = Discourse.Environment != "development" ? '<%= Rails.application.assets_manifest.assets['service-worker.js'] %>' : 'service-worker.js';
|
||||||
I18n.defaultLocale = '<%= SiteSetting.default_locale %>';
|
I18n.defaultLocale = '<%= SiteSetting.default_locale %>';
|
||||||
Discourse.start();
|
Discourse.start();
|
||||||
Discourse.set('assetVersion','<%= Discourse.assets_digest %>');
|
Discourse.set('assetVersion','<%= Discourse.assets_digest %>');
|
||||||
|
|
|
@ -734,6 +734,8 @@ Discourse::Application.routes.draw do
|
||||||
# logs.
|
# logs.
|
||||||
get "/service-worker.js" => redirect(relative_url_root + service_worker_asset), format: :js
|
get "/service-worker.js" => redirect(relative_url_root + service_worker_asset), format: :js
|
||||||
get service_worker_asset => "static#service_worker_asset", format: :js
|
get service_worker_asset => "static#service_worker_asset", format: :js
|
||||||
|
elsif Rails.env.development?
|
||||||
|
get "/service-worker.js" => "static#service_worker_asset", format: :js
|
||||||
end
|
end
|
||||||
|
|
||||||
get "cdn_asset/:site/*path" => "static#cdn_asset", format: false
|
get "cdn_asset/:site/*path" => "static#cdn_asset", format: false
|
||||||
|
|
Loading…
Reference in New Issue