Compare commits
3 Commits
dev-hex
...
asynchroni
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89d099fecf | ||
|
|
8ce9342b8e | ||
|
|
11987b0a77 |
20618
package-lock.json
generated
Normal file
20618
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -11,10 +11,12 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.27.2",
|
||||
"bluebird": "^3.7.2",
|
||||
"clipboard": "^2.0.11",
|
||||
"crypto-js": "^4.1.1",
|
||||
"escape-html": "^1.0.3",
|
||||
"file-saver": "^2.0.5",
|
||||
"localforage": "^1.10.0",
|
||||
"pako": "^2.1.0",
|
||||
"qrcodejs2": "^0.0.2",
|
||||
"view-design": "^4.7.0",
|
||||
|
||||
@@ -24,29 +24,29 @@
|
||||
background-color: #dddddd
|
||||
}
|
||||
</style>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.min.js" rel="stylesheet"
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.min.js"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue-router@3.6.5/dist/vue-router.min.js" rel="stylesheet"
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue-router@3.6.5/dist/vue-router.min.js"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/axios@0.27.2/dist/axios.min.js" rel="stylesheet"
|
||||
<script src="https://cdn.jsdelivr.net/npm/axios@0.27.2/dist/axios.min.js"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/view-design@4.7.0/dist/iview.min.js" rel="stylesheet"
|
||||
<script src="https://cdn.jsdelivr.net/npm/view-design@4.7.0/dist/iview.min.js"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/pako@2.1.0/dist/pako.min.js" rel="stylesheet"
|
||||
<script src="https://cdn.jsdelivr.net/npm/pako@2.1.0/dist/pako.min.js"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/crypto-js@4.1.1/crypto-js.min.js" rel="stylesheet"
|
||||
<script src="https://cdn.jsdelivr.net/npm/crypto-js@4.1.1/crypto-js.min.js"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue-i18n@8.21.1/dist/vue-i18n.min.js" rel="stylesheet"
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue-i18n@8.21.1/dist/vue-i18n.min.js"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.5/dist/FileSaver.min.js" rel="stylesheet"
|
||||
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.5/dist/FileSaver.min.js"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/qrcodejs2@0.0.2/qrcode.min.js" rel="stylesheet"
|
||||
<script src="https://cdn.jsdelivr.net/npm/qrcodejs2@0.0.2/qrcode.min.js"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js" rel="stylesheet"
|
||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/wasm-flate@1.0.2-browser/wasm_flate.js" rel="stylesheet"
|
||||
<script src="https://cdn.jsdelivr.net/npm/wasm-flate@1.0.2-browser/wasm_flate.js"
|
||||
type="text/javascript"></script>
|
||||
<script>
|
||||
<script type="text/javascript">
|
||||
window.wasm_flate_bg_path = "https://cdn.jsdelivr.net/npm/wasm-flate@1.0.2-browser/wasm_flate_bg.wasm"
|
||||
</script>
|
||||
|
||||
|
||||
73
public/redirect.html
Normal file
73
public/redirect.html
Normal file
@@ -0,0 +1,73 @@
|
||||
<!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", JSON.stringify(keyMeta));
|
||||
location.href = "/" + keyMeta.key;
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body><noscript><strong>Please enable JavaScript to continue.</strong></noscript>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,7 +1,7 @@
|
||||
import axios from "axios";
|
||||
import { getStoreKey } from "@/api/lock";
|
||||
import storage from "@/libs/storage";
|
||||
import { md5, wrap} from "@/libs/secret";
|
||||
import { md5, wrap } from "@/libs/secret";
|
||||
import NoteConstant from "@/libs/constants";
|
||||
|
||||
axios.interceptors.response.use(undefined, (err) => {
|
||||
@@ -17,10 +17,10 @@ axios.interceptors.response.use(undefined, (err) => {
|
||||
}
|
||||
});
|
||||
|
||||
export function saveNote(noteForm, secret) {
|
||||
export async function saveNote(noteForm, secret) {
|
||||
let storeKey = secret.storeKey;
|
||||
|
||||
let storeInfo = storage.local.getText(storeKey);
|
||||
const storeInfo = await storage.local.getText(storeKey);
|
||||
let starray = storeInfo.split("|");
|
||||
|
||||
if (starray[2] == "1") {
|
||||
@@ -71,14 +71,13 @@ export function saveNote(noteForm, secret) {
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteNote(key) {
|
||||
export async function deleteNote(key) {
|
||||
let storeKey = getStoreKey(key);
|
||||
let storeInfo = storage.local.getText(storeKey);
|
||||
const storeInfo = await storage.local.getText(storeKey);
|
||||
let note = {
|
||||
cipher: storeInfo.substring(2, 34),
|
||||
key: key,
|
||||
};
|
||||
|
||||
return axios({
|
||||
url: NoteConstant.servicePath + "/note/" + key + "/delete",
|
||||
method: "post",
|
||||
@@ -97,6 +96,28 @@ export function getNoteBlob(key) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getNoteMetaNew(key) {
|
||||
let url = NoteConstant.servicePath + "/note/" + key + "/noteMeta";
|
||||
return axios({
|
||||
url: url,
|
||||
method: "get",
|
||||
ignoreError: 1,
|
||||
original: true,
|
||||
source: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function getKeyMetaNew() {
|
||||
let url = NoteConstant.servicePath + "/note/keyMeta";
|
||||
return axios({
|
||||
url: url,
|
||||
method: "get",
|
||||
ignoreError: 1,
|
||||
original: true,
|
||||
source: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function getNoteMeta(key) {
|
||||
let url = NoteConstant.servicePath + "/note/" + key + "/noteMeta";
|
||||
let noteMeta = null;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { getKeyMeta } from "@/api/note";
|
||||
import { getStoreKey } from "@/api/lock";
|
||||
import { wrap } from "@/libs/secret";
|
||||
import storage from "@/libs/storage";
|
||||
@@ -12,7 +11,7 @@ export function setStoreText(noteForm, state, secret) {
|
||||
storeText = wrap(text, secret.secretKey);
|
||||
}
|
||||
|
||||
storage.local.setText(
|
||||
return storage.local.setText(
|
||||
secret.storeKey,
|
||||
state.lock +
|
||||
"|" +
|
||||
@@ -26,8 +25,7 @@ export function setStoreText(noteForm, state, secret) {
|
||||
);
|
||||
}
|
||||
|
||||
export function setNewStoreText(noteForm) {
|
||||
let keyMeta =getKeyMeta();
|
||||
export function setNewStoreText(noteForm,keyMeta) {
|
||||
let storeKey = getStoreKey(keyMeta.key);
|
||||
|
||||
let text = noteForm.text;
|
||||
@@ -38,7 +36,7 @@ export function setNewStoreText(noteForm) {
|
||||
storeText = wrap(text, keyMeta.secretKey);
|
||||
}
|
||||
|
||||
storage.local.setText(
|
||||
return storage.local.setText(
|
||||
storeKey,
|
||||
"0|" +
|
||||
keyMeta.cipher +
|
||||
@@ -47,8 +45,6 @@ export function setNewStoreText(noteForm) {
|
||||
"|" +
|
||||
storeText
|
||||
);
|
||||
|
||||
return keyMeta.key;
|
||||
}
|
||||
|
||||
export function clearStoreText(key) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import localforage from "localforage";
|
||||
|
||||
class Storage {
|
||||
constructor() {
|
||||
this.session = new Session();
|
||||
@@ -29,23 +31,23 @@ class Session {
|
||||
|
||||
class Local {
|
||||
setObject(key, value) {
|
||||
localStorage.setItem(key, JSON.stringify(value));
|
||||
return localforage.setItem(key, JSON.stringify(value));
|
||||
}
|
||||
|
||||
getObject(key) {
|
||||
return JSON.parse(localStorage.getItem(key));
|
||||
return JSON.parse(localforage.getItem(key));
|
||||
}
|
||||
|
||||
delete(key) {
|
||||
localStorage.removeItem(key);
|
||||
return localforage.removeItem(key);
|
||||
}
|
||||
|
||||
setText(key, value) {
|
||||
localStorage.setItem(key, value);
|
||||
return localforage.setItem(key, value);
|
||||
}
|
||||
|
||||
getText(key) {
|
||||
return localStorage.getItem(key);
|
||||
return localforage.getItem(key);
|
||||
}
|
||||
|
||||
getUseSize() {
|
||||
|
||||
11
src/main.js
11
src/main.js
@@ -1,12 +1,15 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import getRouter from './router/'
|
||||
import axios from 'axios'
|
||||
import VueAxios from 'vue-axios'
|
||||
import './plugins/iview.js'
|
||||
import {Promise} from "bluebird";
|
||||
import i18n from './i18n/'
|
||||
|
||||
import NoteConstant from "@/libs/constants";
|
||||
|
||||
|
||||
axios.defaults.baseURL = NoteConstant.servicePath;
|
||||
|
||||
Vue.use(VueAxios, axios)
|
||||
@@ -16,10 +19,12 @@ Vue.config.debug = debugFlag;
|
||||
Vue.config.devtools = debugFlag;
|
||||
Vue.config.productionTip = debugFlag;
|
||||
|
||||
new Vue({
|
||||
Promise.try(getRouter).then((router)=>{
|
||||
new Vue({
|
||||
i18n,
|
||||
router,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
||||
}).$mount('#app')
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -1,73 +1,60 @@
|
||||
import Vue from "vue";
|
||||
import { getNoteMetaNew } from "@/api/note";
|
||||
import VueRouter from "vue-router";
|
||||
import EditNote from "@/views/EditNote.vue";
|
||||
import ViewNote from "@/views/ViewNote.vue";
|
||||
import ErrorRoute from "@/views/ErrorRoute.vue";
|
||||
import ErrorNote from "@/views/ErrorNote.vue";
|
||||
import { getKeyMeta, getNoteMeta } from "@/api/note";
|
||||
import { getStoreKey } from "@/api/lock";
|
||||
import storage from "@/libs/storage";
|
||||
import { getStoreKey } from "@/api/lock";
|
||||
|
||||
Vue.use(VueRouter);
|
||||
|
||||
var keyMeta = null;
|
||||
var noteMeta = null;
|
||||
var errorMeta = null;
|
||||
|
||||
function getKeyMetaParam() {
|
||||
return keyMeta;
|
||||
}
|
||||
|
||||
function getNoteMetaParam() {
|
||||
return noteMeta;
|
||||
}
|
||||
|
||||
function getErrorMetaParam() {
|
||||
return errorMeta;
|
||||
}
|
||||
|
||||
function getNoteView() {
|
||||
if (errorMeta) {
|
||||
return;
|
||||
}
|
||||
|
||||
export default async function getRouter() {
|
||||
let path = location.pathname;
|
||||
|
||||
let key = path.substring(1, path.length);
|
||||
//let errorMeta = null;
|
||||
|
||||
if (keyMeta && keyMeta.key) {
|
||||
key = keyMeta.key;
|
||||
if (path == "/") {
|
||||
//errorMeta = 100002;
|
||||
return errorRouter(100002);
|
||||
}
|
||||
|
||||
let keyMeta = storage.session.getObject("keyMeta");
|
||||
storage.session.delete("keyMeta");
|
||||
|
||||
let regKey = /^[abcdefhikmnopqstuvwxyz23456789]{16}$/;
|
||||
|
||||
if (!regKey.test(key)) {
|
||||
errorMeta = 100002;
|
||||
return ErrorNote;
|
||||
return errorRouter(100002);
|
||||
}
|
||||
|
||||
if (keyMeta && keyMeta.key) {
|
||||
//firstEdit
|
||||
return EditNote;
|
||||
// if(document.referrer=="/"){
|
||||
// }
|
||||
return noteRouter(EditNote, keyMeta, null);
|
||||
}
|
||||
|
||||
//set noteMeta
|
||||
noteMeta = getNoteMeta(key);
|
||||
let resp = await getNoteMetaNew(key);
|
||||
|
||||
//server error
|
||||
if (!noteMeta) {
|
||||
errorMeta = 100006;
|
||||
return ErrorNote;
|
||||
|
||||
if (null == resp || null == resp.data) {
|
||||
return errorRouter(100006);
|
||||
}
|
||||
|
||||
//invalidated key
|
||||
if (!noteMeta.key) {
|
||||
errorMeta = 100002;
|
||||
return ErrorNote;
|
||||
let result = resp.data;
|
||||
if (result.code != '000000') {
|
||||
return errorRouter(parseInt(result.code));
|
||||
}
|
||||
|
||||
//validated state
|
||||
let noteMeta = result.data;
|
||||
if (null == noteMeta) {
|
||||
return errorRouter(100001);
|
||||
}
|
||||
if (null == noteMeta.key) {
|
||||
return errorRouter(100002);
|
||||
}
|
||||
|
||||
//view
|
||||
if (1 == noteMeta.state) {
|
||||
return ViewNote;
|
||||
return noteRouter(ViewNote, keyMeta, noteMeta);
|
||||
}
|
||||
|
||||
//deleted
|
||||
@@ -76,74 +63,69 @@ function getNoteView() {
|
||||
storage.local.delete(storeKey);
|
||||
// user deleted
|
||||
if (noteMeta.ttl > 0) {
|
||||
errorMeta = 100003;
|
||||
return ErrorNote;
|
||||
// errorMeta = 100003;
|
||||
return errorRouter(100003);
|
||||
} else {// timeout
|
||||
errorMeta = 100004;
|
||||
return ErrorNote;
|
||||
// errorMeta = 100004;
|
||||
return errorRouter(100004);
|
||||
}
|
||||
}
|
||||
|
||||
//edit or unsubmitted
|
||||
if (null == noteMeta.state) {
|
||||
let storeKey = getStoreKey(key);
|
||||
const storeInfo = await storage.local.getText(storeKey);
|
||||
|
||||
//if has storage , then edit
|
||||
if (storage.local.getText(storeKey)) {
|
||||
return EditNote;
|
||||
} else {
|
||||
if (null != storeInfo) {
|
||||
return noteRouter(EditNote, keyMeta, noteMeta);
|
||||
}
|
||||
|
||||
//storage is empty
|
||||
let df = storage.session.getText(storeKey + "_delete")
|
||||
if (df) {//unsubmitted,user deleted.
|
||||
errorMeta = 100003;
|
||||
return ErrorNote;
|
||||
// errorMeta = 100003;
|
||||
return errorRouter(100003);
|
||||
} else {//unsubmitted
|
||||
errorMeta = 100005;
|
||||
return ErrorNote;
|
||||
// errorMeta = 100005;
|
||||
return errorRouter(100005);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// other exception
|
||||
errorMeta = 100001;
|
||||
return ErrorNote;
|
||||
return errorRouter(100001);
|
||||
}
|
||||
|
||||
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 = [
|
||||
{
|
||||
path: "/",
|
||||
name: "home",
|
||||
redirect: getHomeRedirect(),
|
||||
},
|
||||
{ path: "/error_:code([0-9]{6})", component: ErrorNote },
|
||||
function noteRouter(noteView, keyMeta, noteMeta) {
|
||||
const routes = [
|
||||
{
|
||||
path: "/:name([a-z0-9]{10,20})",
|
||||
name: "note",
|
||||
component: getNoteView(),
|
||||
meta: { keyMeta: getKeyMetaParam(), noteMeta: getNoteMetaParam(), errorMeta: getErrorMetaParam() },
|
||||
},
|
||||
{ path: "/:path(.*)", component: ErrorRoute }
|
||||
];
|
||||
component: noteView,
|
||||
meta: { keyMeta: keyMeta, noteMeta: noteMeta },
|
||||
}
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
const router = new VueRouter({
|
||||
routes,
|
||||
mode: "history",
|
||||
});
|
||||
});
|
||||
return router;
|
||||
}
|
||||
|
||||
|
||||
function errorRouter(errorCode) {
|
||||
const routes = [
|
||||
{
|
||||
path: "/:name([a-z0-9]{10,20})",
|
||||
name: "error",
|
||||
component: ErrorNote,
|
||||
errorMeta: errorCode
|
||||
}
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
routes,
|
||||
mode: "history",
|
||||
});
|
||||
return router;
|
||||
}
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -201,6 +201,7 @@ import { setStoreText,setNewStoreText } from "@/libs/noteStorage";
|
||||
import { saveAs } from 'file-saver';
|
||||
import { isWeixin } from "@/libs/utils";
|
||||
import NoteConstant from "@/libs/constants";
|
||||
import { getKeyMeta } from "@/api/note";
|
||||
|
||||
export default {
|
||||
name: 'EditNote',
|
||||
@@ -247,10 +248,10 @@ export default {
|
||||
let keyMeta = this.$route.meta.keyMeta;
|
||||
|
||||
//ipad chrome url not redirect
|
||||
let path = location.pathname;
|
||||
if ("/" == path) {
|
||||
history.pushState('', '', '/' + this.noteForm.key);
|
||||
}
|
||||
// let path = location.pathname;
|
||||
// if ("/" == path) {
|
||||
// history.pushState('', '', '/' + this.noteForm.key);
|
||||
// }
|
||||
|
||||
//wx does not show downloadText
|
||||
this.model.showDownloadText = !isWeixin();
|
||||
@@ -281,16 +282,20 @@ export default {
|
||||
let noteMeta = this.$route.meta.noteMeta;
|
||||
this.secret.secretKey = noteMeta.secretKey;
|
||||
|
||||
let storeInfo = storage.local.getText(storeKey);
|
||||
let that = this;
|
||||
|
||||
storage.local.getText(storeKey).then(function(storeInfo){
|
||||
let starray = storeInfo.split('|');
|
||||
this.state.lock = parseInt(starray[0]);
|
||||
this.secret.cipher = starray[1];
|
||||
this.state.initTime = parseInt(starray[3]);
|
||||
that.state.lock = parseInt(starray[0]);
|
||||
that.secret.cipher = starray[1];
|
||||
that.state.initTime = parseInt(starray[3]);
|
||||
|
||||
//draw text;
|
||||
if (starray[4]) {
|
||||
this.noteForm.text = unwrap(starray[4], this.secret.secretKey);
|
||||
that.noteForm.text = unwrap(starray[4], that.secret.secretKey);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
this.bindCtrlAllEvent();
|
||||
@@ -398,13 +403,10 @@ export default {
|
||||
setStoreText(this.noteForm, this.state, this.secret);
|
||||
|
||||
} else if (event.ctrlKey && (event.which == 13)) {
|
||||
//save
|
||||
|
||||
this.submitNote();
|
||||
}
|
||||
},
|
||||
save() {
|
||||
return saveNote(this.noteForm, this.secret);
|
||||
},
|
||||
validateForm() {
|
||||
let text = this.noteForm.text;
|
||||
if (text.length > NoteConstant.noteMaxCount) {
|
||||
@@ -433,25 +435,28 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
setStoreText(this.noteForm, this.state, this.secret);
|
||||
|
||||
this.model.submitting = true;
|
||||
|
||||
let that = this;
|
||||
this.save().then(res => {
|
||||
saveNote(this.noteForm, this.secret).then(res => {
|
||||
if (res.data && res.data.code == "000000") {
|
||||
storage.session.setText(that.secret.storeKey + "_share", '1');
|
||||
|
||||
that.state.commited = 1;
|
||||
setStoreText(this.noteForm, this.state, this.secret);
|
||||
|
||||
setStoreText(this.noteForm, this.state, this.secret).then(function(){
|
||||
location.reload();
|
||||
this.state.locking = 0;
|
||||
});
|
||||
} else {
|
||||
alert(res.data.code);
|
||||
this.model.submitting = false;
|
||||
this.state.locking = 0;
|
||||
if(res.data.code=="100013"||res.data.code=="800001"){
|
||||
let key = setNewStoreText(this.noteForm);
|
||||
location.href="/"+key;
|
||||
let keyMeta = getKeyMeta();
|
||||
setNewStoreText(this.noteForm,keyMeta).then(function () {
|
||||
location.href="/"+keyMeta.key;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -420,9 +420,13 @@ export default {
|
||||
|
||||
this.startClock();
|
||||
|
||||
storage.local.dynamicClear();
|
||||
|
||||
this.loadText();
|
||||
let that = this;
|
||||
storage.local.getText(this.secret.storeKey).then(function(storeInfo){
|
||||
that.loadText(storeInfo);
|
||||
});
|
||||
|
||||
storage.local.dynamicClear();
|
||||
|
||||
this.bindCtrlAllEvent();
|
||||
this.bindCopyUrlEvent();
|
||||
@@ -517,8 +521,9 @@ export default {
|
||||
that.state.ttl = that.state.initTtl - (new Date().getTime() - that.state.initTime);
|
||||
|
||||
if (that.state.ttl <= 0) {
|
||||
storage.local.delete(that.secret.storeKey);
|
||||
storage.local.delete(that.secret.storeKey).then(function(){
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
}, 1000)
|
||||
},
|
||||
@@ -554,8 +559,9 @@ export default {
|
||||
let that = this;
|
||||
deleteNote(this.noteForm.key).then(res => {
|
||||
if (res.data&&res.data.code=="000000") {
|
||||
storage.local.delete(that.secret.storeKey);
|
||||
storage.local.delete(that.secret.storeKey).then(function(){
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
that.model.deleting = false;
|
||||
}
|
||||
@@ -563,11 +569,9 @@ export default {
|
||||
alert(error);
|
||||
});
|
||||
},
|
||||
loadText() {
|
||||
loadText(storeInfo) {
|
||||
let that = this;
|
||||
|
||||
let storeInfo = storage.local.getText(this.secret.storeKey);
|
||||
|
||||
let starray = [];
|
||||
if (storeInfo) {
|
||||
starray = storeInfo.split('|');
|
||||
|
||||
@@ -65,8 +65,8 @@ module.exports = defineConfig({
|
||||
devServer: {
|
||||
proxy: {
|
||||
"/note": {
|
||||
// target: "https://flagnote.com/", // 后台接口域名
|
||||
target: "http://localhost:10000/", // 后台接口域名
|
||||
target: "https://flagnote.com/", // 后台接口域名
|
||||
// target: "http://localhost:10000/", // 后台接口域名
|
||||
secure: false, // 如果是https接口,需要配置这个参数
|
||||
changeOrigin: true, //是否跨域
|
||||
pathRewrite: {
|
||||
|
||||
Reference in New Issue
Block a user