Browse Source

Replace state to /web when root path (#4009)

pull/4/head
Yamagishi Kazutoshi 6 years ago
committed by Eugen Rochko
parent
commit
a27879c0cf
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      app/javascript/mastodon/main.js

+ 8
- 0
app/javascript/mastodon/main.js View File

@ -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'));

Loading…
Cancel
Save