redirect done
This commit is contained in:
72
public/redirect.html
Normal file
72
public/redirect.html
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="renderer" content="webkit" />
|
||||||
|
<meta name="force-rendering" content="webkit" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||||
|
<meta name="viewport"
|
||||||
|
content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=yes" />
|
||||||
|
<meta name="keywords" content="flagnote" />
|
||||||
|
<meta name="description" content="flag note" />
|
||||||
|
<meta name="theme-color" content="#ed4014" />
|
||||||
|
<meta name="format-detection" content="telephone=no,email=no,adress=no" />
|
||||||
|
<meta name="google" content="notranslate">
|
||||||
|
<meta http-equiv="Expires" content="0" />
|
||||||
|
<meta http-equiv="Pragma" content="no-cache" />
|
||||||
|
<meta http-equiv="Cache-control" content="no-cache" />
|
||||||
|
<meta http-equiv="Cache" content="no-cache" />
|
||||||
|
<link rel="icon" href="/static/favicon.png" />
|
||||||
|
<title>flagnote.com</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #dddddd
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
const servicePath = "";
|
||||||
|
//const servicePath="https://flagnote.com";
|
||||||
|
|
||||||
|
function ajaxGet(url) {
|
||||||
|
let data = null;
|
||||||
|
let xmlhttp = new XMLHttpRequest();
|
||||||
|
xmlhttp.open("GET", url, false);
|
||||||
|
xmlhttp.onreadystatechange = () => {
|
||||||
|
if (xmlhttp.readyState == 4) {
|
||||||
|
if (xmlhttp.status == 200 || xmlhttp.status == 304) {
|
||||||
|
if (xmlhttp.responseText) {
|
||||||
|
let rs = JSON.parse(xmlhttp.responseText);
|
||||||
|
if (rs && rs.code == "000000") {
|
||||||
|
data = rs.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xmlhttp.send();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getKeyMeta() {
|
||||||
|
let url = servicePath + "/note/keyMeta";
|
||||||
|
let keyMeta = null;
|
||||||
|
try {
|
||||||
|
keyMeta = ajaxGet(url);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
return keyMeta;
|
||||||
|
}
|
||||||
|
|
||||||
|
let keyMeta = getKeyMeta();
|
||||||
|
sessionStorage.setItem(keyMeta.key+".keyMeta", JSON.stringify(keyMeta));
|
||||||
|
location.href = "/" + keyMeta.key;
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body><noscript><strong>Please enable JavaScript to continue.</strong></noscript>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -4,7 +4,7 @@ import EditNote from "@/views/EditNote.vue";
|
|||||||
import ViewNote from "@/views/ViewNote.vue";
|
import ViewNote from "@/views/ViewNote.vue";
|
||||||
import ErrorRoute from "@/views/ErrorRoute.vue";
|
import ErrorRoute from "@/views/ErrorRoute.vue";
|
||||||
import ErrorNote from "@/views/ErrorNote.vue";
|
import ErrorNote from "@/views/ErrorNote.vue";
|
||||||
import { getKeyMeta, getNoteMeta } from "@/api/note";
|
import { getNoteMeta } from "@/api/note";
|
||||||
import { getStoreKey } from "@/api/lock";
|
import { getStoreKey } from "@/api/lock";
|
||||||
import storage from "@/libs/storage";
|
import storage from "@/libs/storage";
|
||||||
|
|
||||||
@@ -35,6 +35,7 @@ function getNoteView() {
|
|||||||
|
|
||||||
let key = path.substring(1, path.length);
|
let key = path.substring(1, path.length);
|
||||||
|
|
||||||
|
keyMeta = storage.session.getObject(key+".keyMeta");
|
||||||
if (keyMeta && keyMeta.key) {
|
if (keyMeta && keyMeta.key) {
|
||||||
key = keyMeta.key;
|
key = keyMeta.key;
|
||||||
}
|
}
|
||||||
@@ -107,30 +108,7 @@ function getNoteView() {
|
|||||||
return ErrorNote;
|
return ErrorNote;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHomeRedirect() {
|
|
||||||
let path = location.pathname;
|
|
||||||
if (path != "/") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//setKeyMeta
|
|
||||||
keyMeta = getKeyMeta();
|
|
||||||
|
|
||||||
// server error
|
|
||||||
if (!keyMeta) {
|
|
||||||
errorMeta = 100006;
|
|
||||||
return "/error_"+errorMeta;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "/" + keyMeta.key;
|
|
||||||
}
|
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
|
||||||
path: "/",
|
|
||||||
name: "home",
|
|
||||||
redirect: getHomeRedirect(),
|
|
||||||
},
|
|
||||||
{ path: "/error_:code([0-9]{6})", component: ErrorNote },
|
{ path: "/error_:code([0-9]{6})", component: ErrorNote },
|
||||||
{
|
{
|
||||||
path: "/:name([a-z0-9]{10,20})",
|
path: "/:name([a-z0-9]{10,20})",
|
||||||
|
|||||||
@@ -100,7 +100,7 @@
|
|||||||
<Button-group size="large">
|
<Button-group size="large">
|
||||||
<Button aria-label="publish" type="error" :loading="model.submitting"
|
<Button aria-label="publish" type="error" :loading="model.submitting"
|
||||||
style="margin-left:5px; border-radius: 0px;font-size: 21px;" @click="submitNote()"
|
style="margin-left:5px; border-radius: 0px;font-size: 21px;" @click="submitNote()"
|
||||||
icon="md-share"></Button>
|
icon="md-cloud-upload"></Button>
|
||||||
<Button aria-label="menu" type="error" style="margin-left:3px; border-radius: 0px;font-size: 24px;"
|
<Button aria-label="menu" type="error" style="margin-left:3px; border-radius: 0px;font-size: 24px;"
|
||||||
@click="switchMenu()" @blur.native="hideMenu()" icon="md-menu"></Button>
|
@click="switchMenu()" @blur.native="hideMenu()" icon="md-menu"></Button>
|
||||||
|
|
||||||
@@ -247,10 +247,10 @@ export default {
|
|||||||
let keyMeta = this.$route.meta.keyMeta;
|
let keyMeta = this.$route.meta.keyMeta;
|
||||||
|
|
||||||
//ipad chrome url not redirect
|
//ipad chrome url not redirect
|
||||||
let path = location.pathname;
|
// let path = location.pathname;
|
||||||
if ("/" == path) {
|
// if ("/" == path) {
|
||||||
history.pushState('', '', '/' + this.noteForm.key);
|
// history.pushState('', '', '/' + this.noteForm.key);
|
||||||
}
|
// }
|
||||||
|
|
||||||
//wx does not show downloadText
|
//wx does not show downloadText
|
||||||
this.model.showDownloadText = !isWeixin();
|
this.model.showDownloadText = !isWeixin();
|
||||||
@@ -276,6 +276,7 @@ export default {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
storage.local.setText(storeKey, "0|" + this.secret.cipher + "|0|" + this.state.initTime + "|");
|
storage.local.setText(storeKey, "0|" + this.secret.cipher + "|0|" + this.state.initTime + "|");
|
||||||
|
storage.session.delete(keyMeta.key+".keyMeta");
|
||||||
} else {
|
} else {
|
||||||
// second edit
|
// second edit
|
||||||
let noteMeta = this.$route.meta.noteMeta;
|
let noteMeta = this.$route.meta.noteMeta;
|
||||||
|
|||||||
Reference in New Issue
Block a user