Skip to content

Commit

Permalink
Merge pull request #67 from dxos/burdon/pwa
Browse files Browse the repository at this point in the history
Fix path for PWA
  • Loading branch information
richburdon authored Dec 20, 2020
2 parents 54f3dd7 + 5f9f759 commit c1e9a5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/console-app/src/components/AppLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const getAppUrl = (config, { wrn }) => {
pathComponents.push(prefix.substring(1));
}

pathComponents.push(encodeURIComponent(wrn));
// TODO(burdon): Make names URL safe so that encoding is not required.
// pathComponents.push(encodeURIComponent(wrn));
pathComponents.push(wrn);
return `${pathComponents.join('/')}/`;
};

Expand Down
7 changes: 6 additions & 1 deletion packages/console-app/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ debug.enable(config.system.debug);
// https://webpack.js.org/guides/progressive-web-application
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
// TODO(burdon): Remove "wrn:" from registry path so encoding is not required.
// TODO(burdon): Remove "wrn:" from path so that escape characters are not required.
// main.js?56d7:23 SW registration failed: TypeError: Failed to register a ServiceWorker:
// The provided scope ('https://apollo1.kube.moon.dxos.network/app/wrn%3A%2F%2Fdxos%2Fapplication%2Fconsole%40alpha/')
// or scriptURL ('https://apollo1.kube.moon.dxos.network/app/wrn%3A%2F%2Fdxos%2Fapplication%2Fconsole%40alpha/service_worker.js')
// includes a disallowed escape character.
// at eval (main.js?56d7:20)
const path = window.location.pathname + 'service_worker.js';
navigator.serviceWorker.register(path).then(registration => {
console.log('SW registered:', registration);
Expand Down

0 comments on commit c1e9a5f

Please sign in to comment.