diff --git a/client/components/App.vue b/client/components/App.vue index 5ec738f6..fe3cf3e8 100644 --- a/client/components/App.vue +++ b/client/components/App.vue @@ -193,18 +193,26 @@ class App extends Vue { } redirectIfNeeded() { - if ((this.mode == 'reader' || this.mode == 'omnireader' || this.mode == 'liberama.top') && (!this.isReaderActive)) { - //старый url + if ((this.mode == 'reader' || this.mode == 'omnireader' || this.mode == 'liberama.top')) { const search = window.location.search.substr(1); - const s = search.split('url='); - const url = s[1] || ''; - const q = utils.parseQuery(s[0] || ''); - if (url) { - q.url = decodeURIComponent(url); + //распознавание параметра p , если присутствует, должен совпадать с rootRoute (необходимо для nginx) + const q = utils.parseQuery(search); + if (q.p && `/${q.p}` != this.rootRoute) { + this.$router.replace('/404'); } - window.history.replaceState({}, '', '/'); - this.$router.replace({ path: '/reader', query: q }); + //распознавание параметра url вида "?url=" и редирект при необходимости + if (!this.isReaderActive) { + const s = search.split('url='); + const url = s[1] || ''; + const q = utils.parseQuery(s[0] || ''); + if (url) { + q.url = decodeURIComponent(url); + } + + window.history.replaceState({}, '', '/'); + this.$router.replace({ path: '/reader', query: q }); + } } } } diff --git a/client/router.js b/client/router.js index 73b44c0e..e7b7bc3b 100644 --- a/client/router.js +++ b/client/router.js @@ -17,7 +17,7 @@ const Income = () => import('./components/Income/Income.vue'); const Sources = () => import('./components/Sources/Sources.vue'); const Settings = () => import('./components/Settings/Settings.vue'); const Help = () => import('./components/Help/Help.vue'); -//const NotFound404 = () => import('./components/NotFound404/NotFound404.vue'); +const NotFound404 = () => import('./components/NotFound404/NotFound404.vue'); const myRoutes = [ ['/', null, null, '/cardindex'], @@ -35,6 +35,7 @@ const myRoutes = [ ['/sources', Sources], ['/settings', Settings], ['/help', Help], + ['/404', NotFound404], ['*', null, null, '/cardindex'], ];