about summary refs log tree commit diff
path: root/app/javascript/mastodon/main.js
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2017-06-30 12:37:41 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-06-30 05:37:41 +0200
commita27879c0cf89d99fb79e2ffbe7ecfdf72733a1c4 (patch)
tree343ff7e0d0b29d8316ee2ea28c5c626cc9ca607d /app/javascript/mastodon/main.js
parent049cea30b0f3900484d45b0d88a0f073ad0c6cc6 (diff)
Replace state to /web when root path (#4009)
Diffstat (limited to 'app/javascript/mastodon/main.js')
-rw-r--r--app/javascript/mastodon/main.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/javascript/mastodon/main.js b/app/javascript/mastodon/main.js
index 02e0f56f9..aca64c075 100644
--- a/app/javascript/mastodon/main.js
+++ b/app/javascript/mastodon/main.js
@@ -20,6 +20,14 @@ function main() {
 
   require.context('../images/', true);
 
+  if (window.history && history.replaceState) {
+    const { pathname, search, hash } = window.location;
+    const path = pathname + search + hash;
+    if (!(/^\/web[$/]/).test(path)) {
+      history.replaceState(null, document.title, `/web${path}`);
+    }
+  }
+
   onDomContentLoaded(() => {
     const mountNode = document.getElementById('mastodon');
     const props = JSON.parse(mountNode.getAttribute('data-props'));