tkem / mopidy-mobile

Mopidy Web client extension and hybrid app for mobile devices
Apache License 2.0
78 stars 14 forks source link

All links redirect to playback page #246

Open dreamlayers opened 1 year ago

dreamlayers commented 1 year ago

When I move around in Mopidy-Mobile in a browser, the part of the URL after the # gets updated. For example the root of files is http://IP:6680/mobile/index.html#/library/file:root/. But regardless of which URL I paste into a new browser tab, I end up with the playback page, at http://IP:6680/mobile/index.html#/playback.

Once Mopidy-Mobile is open in a browser tab, then I can change the URL in that tab and actually go to that place.

This happens in both Chrome and Firefox desktop browsers.

dreamlayers commented 1 month ago

Running this in the Chrome debugger, I see that somehow, after loading the page, the URL actually changes to the root of the app (ie. something like http://127.0.0.1:6680/mobile/index.html#/). Then that '/' is the path of the first attempted matching, which fails. Then the angular-ui-router otherwise location is used, setting the location to #/playback and then successfully matching and displaying that. So, that initial change of the url to #/ needs to be prevented.

dreamlayers commented 1 month ago

This is caused by a "workaround for lost history/back view after browser reload": https://github.com/tkem/mopidy-mobile/blob/2e493cb47c2a1aa9908555e9da7b71316c4a9b11/www/app/services/router.js#L117-L125

I disabled that workaround at https://github.com/tkem/mopidy-mobile/commit/a5f44228420fef921bb158dfdcd962fc2ffe90af and now I can immediately open particular locations when loading the page. It also loads more quickly because the location change doesn't happen. I'm not submitting a pull request because I don't know if removing the workaround breaks anything else that is important.