Поправки редиректа при заданном url

This commit is contained in:
Book Pauk
2023-01-08 15:06:01 +07:00
parent 4d3d66fbe2
commit ddde7d038b
2 changed files with 8 additions and 19 deletions

View File

@@ -207,26 +207,15 @@ class App {
return this.$store.state.config.mode; return this.$store.state.config.mode;
} }
get isReaderActive() {
return (this.rootRoute == '/reader' || this.rootRoute == '/external-libs');
}
redirectIfNeeded() { redirectIfNeeded() {
if ((this.mode == 'reader' || this.mode == 'omnireader' || this.mode == 'liberama')) { const search = window.location.search.substr(1);
const search = window.location.search.substr(1);
//распознавание параметра url вида "?url=<link>" и редирект при необходимости //распознавание параметра url вида "?url=<link>" и редирект при необходимости
if (!this.isReaderActive) { const s = search.split('url=');
const s = search.split('url='); const url = s[1] || '';
const url = s[1] || ''; if (url) {
const q = utils.parseQuery(s[0] || ''); window.history.replaceState({}, '', '/');
if (url) { this.$router.replace({ path: '/reader', query: {url} });
q.url = url;
}
window.history.replaceState({}, '', '/');
this.$router.replace({ path: '/reader', query: q });
}
} }
} }
} }

View File

@@ -59,7 +59,7 @@ class CommonHelpPage {
} }
get bookmarkText() { get bookmarkText() {
return `javascript:location.href='https://${window.location.host}/?url='+location.href;` return `javascript:location.href='${window.location.protocol}//${window.location.host}/#/reader?url='+location.href;`
} }
async copyText(text, mes) { async copyText(text, mes) {