Skip to content

Commit 5d472f5

Browse files
committed
Fix GitHub Pages routing: base-href, SPA 404 redirect
1 parent 2491026 commit 5d472f5

5 files changed

Lines changed: 38 additions & 6 deletions

File tree

docs/.last_build_id

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e7a7a4d51b727909b65db4964a04965f
1+
372b1b047c0f7130bda08e43b3aede5d

docs/404.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Roster Radar Admin</title>
6+
<script>
7+
var pathSegmentsToKeep = 1;
8+
var l = window.location;
9+
l.replace(
10+
l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
11+
l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' +
12+
l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') +
13+
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
14+
l.hash
15+
);
16+
</script>
17+
</head>
18+
<body></body>
19+
</html>

docs/flutter_bootstrap.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/flutter_service_worker.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ const MANIFEST = 'flutter-app-manifest';
33
const TEMP = 'flutter-temp-cache';
44
const CACHE_NAME = 'flutter-app-cache';
55

6-
const RESOURCES = {"flutter_bootstrap.js": "e53a1818076a49dc5b83ebd2be1c9ea5",
6+
const RESOURCES = {"flutter_bootstrap.js": "7c4b0b01ce951aa379e1d6b7be0fe675",
77
"version.json": "598fef14e3cedacde6404fcea07eada6",
8-
"index.html": "c825448b74e36464647b89ce9f44b28b",
9-
"/": "c825448b74e36464647b89ce9f44b28b",
8+
"index.html": "5bed5538ceb0a373579a6a6db838332e",
9+
"/": "5bed5538ceb0a373579a6a6db838332e",
1010
"main.dart.js": "0af2f316a8a5e629d0f8de19796f588e",
1111
"flutter.js": "888483df48293866f9f41d3d9274a779",
1212
"favicon.png": "5dcef449791fa27946b3d35ad8803796",

docs/index.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,20 @@
1414
This is a placeholder for base href that will be replaced by the value of
1515
the `--base-href` argument provided to `flutter build`.
1616
-->
17-
<base href="/">
17+
<base href="/roaster-admin-panel/">
18+
19+
<script>
20+
(function(l) {
21+
if (l.search[1] === '/' ) {
22+
var decoded = l.search.slice(1).split('&').map(function(s) {
23+
return s.replace(/~and~/g, '&')
24+
}).join('?');
25+
window.history.replaceState(null, null,
26+
l.pathname.slice(0, -1) + decoded + l.hash
27+
);
28+
}
29+
}(window.location))
30+
</script>
1831

1932
<meta charset="UTF-8">
2033
<meta content="IE=Edge" http-equiv="X-UA-Compatible">

0 commit comments

Comments
 (0)