diff --git a/.gitignore b/.gitignore
index 8f1b494..ad995bc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,4 +14,5 @@ venv/**
log/**
release/*
src/db/wgdashboard.db
-.jshintrc
\ No newline at end of file
+.jshintrc
+node_modules/**
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..248b025
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,248 @@
+{
+ "name": "Wireguard-Dashboard",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "dependencies": {
+ "vue": "^3.3.9",
+ "vue-router": "^4.2.5"
+ }
+ },
+ "node_modules/@babel/parser": {
+ "version": "7.23.5",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.5.tgz",
+ "integrity": "sha512-hOOqoiNXrmGdFbhgCzu6GiURxUgM27Xwd/aPuu8RfHEZPBzL1Z54okAHAQjXfcQNwvrlkAmAp4SlRTZ45vlthQ==",
+ "bin": {
+ "parser": "bin/babel-parser.js"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.4.15",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
+ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg=="
+ },
+ "node_modules/@vue/compiler-core": {
+ "version": "3.3.9",
+ "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.3.9.tgz",
+ "integrity": "sha512-+/Lf68Vr/nFBA6ol4xOtJrW+BQWv3QWKfRwGSm70jtXwfhZNF4R/eRgyVJYoxFRhdCTk/F6g99BP0ffPgZihfQ==",
+ "dependencies": {
+ "@babel/parser": "^7.23.3",
+ "@vue/shared": "3.3.9",
+ "estree-walker": "^2.0.2",
+ "source-map-js": "^1.0.2"
+ }
+ },
+ "node_modules/@vue/compiler-dom": {
+ "version": "3.3.9",
+ "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.3.9.tgz",
+ "integrity": "sha512-nfWubTtLXuT4iBeDSZ5J3m218MjOy42Vp2pmKVuBKo2/BLcrFUX8nCSr/bKRFiJ32R8qbdnnnBgRn9AdU5v0Sg==",
+ "dependencies": {
+ "@vue/compiler-core": "3.3.9",
+ "@vue/shared": "3.3.9"
+ }
+ },
+ "node_modules/@vue/compiler-sfc": {
+ "version": "3.3.9",
+ "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.3.9.tgz",
+ "integrity": "sha512-wy0CNc8z4ihoDzjASCOCsQuzW0A/HP27+0MDSSICMjVIFzk/rFViezkR3dzH+miS2NDEz8ywMdbjO5ylhOLI2A==",
+ "dependencies": {
+ "@babel/parser": "^7.23.3",
+ "@vue/compiler-core": "3.3.9",
+ "@vue/compiler-dom": "3.3.9",
+ "@vue/compiler-ssr": "3.3.9",
+ "@vue/reactivity-transform": "3.3.9",
+ "@vue/shared": "3.3.9",
+ "estree-walker": "^2.0.2",
+ "magic-string": "^0.30.5",
+ "postcss": "^8.4.31",
+ "source-map-js": "^1.0.2"
+ }
+ },
+ "node_modules/@vue/compiler-ssr": {
+ "version": "3.3.9",
+ "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.3.9.tgz",
+ "integrity": "sha512-NO5oobAw78R0G4SODY5A502MGnDNiDjf6qvhn7zD7TJGc8XDeIEw4fg6JU705jZ/YhuokBKz0A5a/FL/XZU73g==",
+ "dependencies": {
+ "@vue/compiler-dom": "3.3.9",
+ "@vue/shared": "3.3.9"
+ }
+ },
+ "node_modules/@vue/devtools-api": {
+ "version": "6.5.1",
+ "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.1.tgz",
+ "integrity": "sha512-+KpckaAQyfbvshdDW5xQylLni1asvNSGme1JFs8I1+/H5pHEhqUKMEQD/qn3Nx5+/nycBq11qAEi8lk+LXI2dA=="
+ },
+ "node_modules/@vue/reactivity": {
+ "version": "3.3.9",
+ "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.3.9.tgz",
+ "integrity": "sha512-VmpIqlNp+aYDg2X0xQhJqHx9YguOmz2UxuUJDckBdQCNkipJvfk9yA75woLWElCa0Jtyec3lAAt49GO0izsphw==",
+ "dependencies": {
+ "@vue/shared": "3.3.9"
+ }
+ },
+ "node_modules/@vue/reactivity-transform": {
+ "version": "3.3.9",
+ "resolved": "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.3.9.tgz",
+ "integrity": "sha512-HnUFm7Ry6dFa4Lp63DAxTixUp8opMtQr6RxQCpDI1vlh12rkGIeYqMvJtK+IKyEfEOa2I9oCkD1mmsPdaGpdVg==",
+ "dependencies": {
+ "@babel/parser": "^7.23.3",
+ "@vue/compiler-core": "3.3.9",
+ "@vue/shared": "3.3.9",
+ "estree-walker": "^2.0.2",
+ "magic-string": "^0.30.5"
+ }
+ },
+ "node_modules/@vue/runtime-core": {
+ "version": "3.3.9",
+ "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.3.9.tgz",
+ "integrity": "sha512-xxaG9KvPm3GTRuM4ZyU8Tc+pMVzcu6eeoSRQJ9IE7NmCcClW6z4B3Ij6L4EDl80sxe/arTtQ6YmgiO4UZqRc+w==",
+ "dependencies": {
+ "@vue/reactivity": "3.3.9",
+ "@vue/shared": "3.3.9"
+ }
+ },
+ "node_modules/@vue/runtime-dom": {
+ "version": "3.3.9",
+ "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.3.9.tgz",
+ "integrity": "sha512-e7LIfcxYSWbV6BK1wQv9qJyxprC75EvSqF/kQKe6bdZEDNValzeRXEVgiX7AHI6hZ59HA4h7WT5CGvm69vzJTQ==",
+ "dependencies": {
+ "@vue/runtime-core": "3.3.9",
+ "@vue/shared": "3.3.9",
+ "csstype": "^3.1.2"
+ }
+ },
+ "node_modules/@vue/server-renderer": {
+ "version": "3.3.9",
+ "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.3.9.tgz",
+ "integrity": "sha512-w0zT/s5l3Oa3ZjtLW88eO4uV6AQFqU8X5GOgzq7SkQQu6vVr+8tfm+OI2kDBplS/W/XgCBuFXiPw6T5EdwXP0A==",
+ "dependencies": {
+ "@vue/compiler-ssr": "3.3.9",
+ "@vue/shared": "3.3.9"
+ },
+ "peerDependencies": {
+ "vue": "3.3.9"
+ }
+ },
+ "node_modules/@vue/shared": {
+ "version": "3.3.9",
+ "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.3.9.tgz",
+ "integrity": "sha512-ZE0VTIR0LmYgeyhurPTpy4KzKsuDyQbMSdM49eKkMnT5X4VfFBLysMzjIZhLEFQYjjOVVfbvUDHckwjDFiO2eA=="
+ },
+ "node_modules/csstype": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz",
+ "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ=="
+ },
+ "node_modules/estree-walker": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
+ "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="
+ },
+ "node_modules/magic-string": {
+ "version": "0.30.5",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.5.tgz",
+ "integrity": "sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.4.15"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/nanoid": {
+ "version": "3.3.7",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
+ "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/picocolors": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
+ "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ=="
+ },
+ "node_modules/postcss": {
+ "version": "8.4.31",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
+ "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "dependencies": {
+ "nanoid": "^3.3.6",
+ "picocolors": "^1.0.0",
+ "source-map-js": "^1.0.2"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
+ },
+ "node_modules/source-map-js": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
+ "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/vue": {
+ "version": "3.3.9",
+ "resolved": "https://registry.npmjs.org/vue/-/vue-3.3.9.tgz",
+ "integrity": "sha512-sy5sLCTR8m6tvUk1/ijri3Yqzgpdsmxgj6n6yl7GXXCXqVbmW2RCXe9atE4cEI6Iv7L89v5f35fZRRr5dChP9w==",
+ "dependencies": {
+ "@vue/compiler-dom": "3.3.9",
+ "@vue/compiler-sfc": "3.3.9",
+ "@vue/runtime-dom": "3.3.9",
+ "@vue/server-renderer": "3.3.9",
+ "@vue/shared": "3.3.9"
+ },
+ "peerDependencies": {
+ "typescript": "*"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/vue-router": {
+ "version": "4.2.5",
+ "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.2.5.tgz",
+ "integrity": "sha512-DIUpKcyg4+PTQKfFPX88UWhlagBEBEfJ5A8XDXRJLUnZOvcpMF8o/dnL90vpVkGaPbjvXazV/rC1qBKrZlFugw==",
+ "dependencies": {
+ "@vue/devtools-api": "^6.5.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/posva"
+ },
+ "peerDependencies": {
+ "vue": "^3.2.0"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..cd954bb
--- /dev/null
+++ b/package.json
@@ -0,0 +1,6 @@
+{
+ "dependencies": {
+ "vue": "^3.3.9",
+ "vue-router": "^4.2.5"
+ }
+}
diff --git a/src/dashboard.py b/src/dashboard.py
index e5aeaea..931780e 100644
--- a/src/dashboard.py
+++ b/src/dashboard.py
@@ -689,6 +689,9 @@ def auth_req():
Action before every request
@return: Redirect
"""
+ return None
+
+
if getattr(g, 'db', None) is None:
g.db = connect_db()
g.cur = g.db.cursor()
@@ -767,9 +770,13 @@ def auth():
if password.hexdigest() == config["Account"]["password"] \
and data['username'] == config["Account"]["username"]:
session['username'] = data['username']
+ resp = Flask.make_response(jsonify({"status": True, "msg": ""}))
+
+
+ resp.set_cookie("auth", hashlib.sha256(f"{data['username']}{datetime.now()}".encode()).hexdigest())
session.permanent = True
- config.clear()
- return jsonify({"status": True, "msg": ""})
+ config.clear(resp)
+ return
config.clear()
return jsonify({"status": False, "msg": "Username or Password is incorrect."})
@@ -789,8 +796,8 @@ def index():
if "switch_msg" in session:
msg = session["switch_msg"]
session.pop("switch_msg")
-
- return render_template('index.html', conf=get_conf_list(), msg=msg)
+ return render_template('index_new.html')
+ # return render_template('index.html', conf=get_conf_list(), msg=msg)
# Setting Page
diff --git a/src/static/app/app.js b/src/static/app/app.js
new file mode 100644
index 0000000..75eda86
--- /dev/null
+++ b/src/static/app/app.js
@@ -0,0 +1,51 @@
+const { createApp, ref } = Vue;
+import Index from './index.js'
+import Signin from './signin/signin.js'
+const {createPinia} = Pinia
+import {cookie} from "./cookie.js";
+
+const app = createApp({
+ template: `
+
+