diff --git a/src/mixins/socket.js b/src/mixins/socket.js index 170a07a7..affac4f8 100644 --- a/src/mixins/socket.js +++ b/src/mixins/socket.js @@ -1,5 +1,6 @@ import { io } from "socket.io-client"; import { useToast } from "vue-toastification"; +import jwt_decode from "jwt-decode"; const toast = useToast(); let socket; @@ -217,6 +218,15 @@ export default { return (this.remember) ? localStorage : sessionStorage; }, + getJWTPayload() { + const jwtToken = this.$root.storage().token; + + if (jwtToken && jwtToken !== "autoLogin") { + return jwt_decode(jwtToken); + } + return undefined; + }, + getSocket() { return socket; }, diff --git a/src/pages/Settings.vue b/src/pages/Settings.vue index 9312b0c2..9d501407 100644 --- a/src/pages/Settings.vue +++ b/src/pages/Settings.vue @@ -306,7 +306,7 @@

这是为 有第三方认证 的用户提供的功能,如 Cloudflare Access

请谨慎使用!

- +