Настройки перенаправления
This commit is contained in:
@@ -38,7 +38,8 @@ class App extends Vue {
|
|||||||
'/sources': 'Источники',
|
'/sources': 'Источники',
|
||||||
'/settings': 'Параметры',
|
'/settings': 'Параметры',
|
||||||
'/help': 'Справка',
|
'/help': 'Справка',
|
||||||
}
|
};
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.commit = this.$store.commit;
|
this.commit = this.$store.commit;
|
||||||
this.dispatch = this.$store.dispatch;
|
this.dispatch = this.$store.dispatch;
|
||||||
@@ -54,10 +55,20 @@ class App extends Vue {
|
|||||||
cachedPath = this.$route.path;
|
cachedPath = this.$route.path;
|
||||||
const m = cachedPath.match(/^(\/[^/]*).*$/i);
|
const m = cachedPath.match(/^(\/[^/]*).*$/i);
|
||||||
cachedRoute = (m ? m[1] : this.$route.path);
|
cachedRoute = (m ? m[1] : this.$route.path);
|
||||||
|
|
||||||
}
|
}
|
||||||
return cachedRoute;
|
return cachedRoute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$router.beforeEach((to, from, next) => {
|
||||||
|
//распознавание хоста, если присутствует домен 3-уровня "b.", то разрешена только определенная страница
|
||||||
|
if (window.location.host.indexOf('b.') == 0 && to.path != '/external-libs' && to.path != '/404') {
|
||||||
|
next('/404');
|
||||||
|
} else {
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// set-app-title
|
// set-app-title
|
||||||
this.$root.$on('set-app-title', this.setAppTitle);
|
this.$root.$on('set-app-title', this.setAppTitle);
|
||||||
|
|
||||||
@@ -196,13 +207,6 @@ class App extends Vue {
|
|||||||
if ((this.mode == 'reader' || this.mode == 'omnireader' || this.mode == 'liberama.top')) {
|
if ((this.mode == 'reader' || this.mode == 'omnireader' || this.mode == 'liberama.top')) {
|
||||||
const search = window.location.search.substr(1);
|
const search = window.location.search.substr(1);
|
||||||
|
|
||||||
//распознавание хоста, если присутствует домен 3-уровня "b.", то разрешена только определенная страница
|
|
||||||
if (window.location.host.indexOf('b.') == 0 && this.rootRoute != '/external-libs') {
|
|
||||||
this.$router.replace('/404');
|
|
||||||
//чтобы ниоткуда нельзя было изменить путь (если какие-то страницы еще грузятся)
|
|
||||||
this.$router.push = this.$router.replace = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//распознавание параметра url вида "?url=<link>" и редирект при необходимости
|
//распознавание параметра url вида "?url=<link>" и редирект при необходимости
|
||||||
if (!this.isReaderActive) {
|
if (!this.isReaderActive) {
|
||||||
const s = search.split('url=');
|
const s = search.split('url=');
|
||||||
|
|||||||
Reference in New Issue
Block a user