Добавки для правильной работы с nginx
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
@@ -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'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user