Browse Source

up web client v2

lejianwen 1 year ago
parent
commit
ad33afb154

+ 1 - 3
src/utils/auth.js

@@ -1,5 +1,3 @@
1
-import {setToken as setWCToken} from '@/utils/webclient'
2
-
3 1
 const TokenKey = 'access_token'
4 2
 const OidcCode = 'oidc_code'
5 3
 const OidcCodeExpiry = 'oidc_code_expiry';
@@ -9,7 +7,7 @@ export function getToken () {
9 7
 }
10 8
 
11 9
 export function setToken (token) {
12
-  setWCToken(token)
10
+  localStorage.setItem(`wc-option:local:access_token`, token)
13 11
   return localStorage.setItem(TokenKey, token)
14 12
 }
15 13
 

+ 1 - 5
src/utils/webclient.js

@@ -8,14 +8,9 @@ import { T } from '@/utils/i18n'
8 8
 
9 9
 const prefix = 'wc-'
10 10
 
11
-export function setToken (token) {
12
-  localStorage.setItem(`${prefix}option:local:access_token`, token)
13
-}
14
-
15 11
 export const toWebClientLink = (row) => {
16 12
   //v2
17 13
   window.open(`${rustdeskConfig.value.api_server}/webclient2/#/${row.id}`)
18
-  // window.open(`${rustdeskConfig.value.api_server}/webclient/#/?id=${row.id}`)
19 14
 }
20 15
 
21 16
 export const rustdeskConfig = ref({})
@@ -36,6 +31,7 @@ export async function loadRustdeskConfig () {
36 31
   }
37 32
 }
38 33
 
34
+loadRustdeskConfig()
39 35
 
40 36
 export async function getPeerSlat (id) {
41 37
   const [addr, port] = rustdeskConfig.value.id_server.split(':')

+ 1 - 2
src/views/address_book/components/shareByWebClient.vue

@@ -45,14 +45,13 @@
45 45
 <script setup>
46 46
   import { T } from '@/utils/i18n'
47 47
   import { computed, reactive, ref, watch } from 'vue'
48
-  import { loadRustdeskConfig, getV2ShareUrl } from '@/utils/webclient'
48
+  import { getV2ShareUrl } from '@/utils/webclient'
49 49
   import * as sha256 from 'fast-sha256'
50 50
   import { shareByWebClient } from '@/api/address_book'
51 51
   import { CopyDocument } from '@element-plus/icons'
52 52
   import { handleClipboard } from '@/utils/clipboard'
53 53
   import { ElMessageBox } from 'element-plus'
54 54
 
55
-  loadRustdeskConfig()
56 55
   const props = defineProps({
57 56
     id: String,
58 57
     hash: String,