Добавки для правильной работы с nginx

This commit is contained in:
Book Pauk
2020-10-28 20:42:47 +07:00
parent 1121f9c918
commit 37e0e1d42f
2 changed files with 19 additions and 10 deletions

View File

@@ -193,9 +193,16 @@ class App extends Vue {
} }
redirectIfNeeded() { redirectIfNeeded() {
if ((this.mode == 'reader' || this.mode == 'omnireader' || this.mode == 'liberama.top') && (!this.isReaderActive)) { if ((this.mode == 'reader' || this.mode == 'omnireader' || this.mode == 'liberama.top')) {
//старый url
const search = window.location.search.substr(1); const search = window.location.search.substr(1);
//распознавание параметра p , если присутствует, должен совпадать с rootRoute (необходимо для nginx)
const q = utils.parseQuery(search);
if (q.p && `/${q.p}` != this.rootRoute) {
this.$router.replace('/404');
}
//распознавание параметра url вида "?url=<link>" и редирект при необходимости
if (!this.isReaderActive) {
const s = search.split('url='); const s = search.split('url=');
const url = s[1] || ''; const url = s[1] || '';
const q = utils.parseQuery(s[0] || ''); const q = utils.parseQuery(s[0] || '');
@@ -207,6 +214,7 @@ class App extends Vue {
this.$router.replace({ path: '/reader', query: q }); this.$router.replace({ path: '/reader', query: q });
} }
} }
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
</script> </script>

View File

@@ -17,7 +17,7 @@ const Income = () => import('./components/Income/Income.vue');
const Sources = () => import('./components/Sources/Sources.vue'); const Sources = () => import('./components/Sources/Sources.vue');
const Settings = () => import('./components/Settings/Settings.vue'); const Settings = () => import('./components/Settings/Settings.vue');
const Help = () => import('./components/Help/Help.vue'); const Help = () => import('./components/Help/Help.vue');
//const NotFound404 = () => import('./components/NotFound404/NotFound404.vue'); const NotFound404 = () => import('./components/NotFound404/NotFound404.vue');
const myRoutes = [ const myRoutes = [
['/', null, null, '/cardindex'], ['/', null, null, '/cardindex'],
@@ -35,6 +35,7 @@ const myRoutes = [
['/sources', Sources], ['/sources', Sources],
['/settings', Settings], ['/settings', Settings],
['/help', Help], ['/help', Help],
['/404', NotFound404],
['*', null, null, '/cardindex'], ['*', null, null, '/cardindex'],
]; ];