|
|
@@ -2,10 +2,16 @@
|
|
2
|
2
|
<div>
|
|
3
|
3
|
<h4 v-html="T('ServerCmdTips', {wiki: '<a target=\'_blank\' href=\'https://github.com/lejianwen/rustdesk-api/wiki/Rustdesk-Command\'>WIKI</a>'})"></h4>
|
|
4
|
4
|
<h5>
|
|
5
|
|
- <span>{{ T('Status') }}: </span>
|
|
6
|
|
- <el-tag v-if="canSendCmd" type="success">{{ T('Available') }}</el-tag>
|
|
|
5
|
+ <span>ID {{ T('Status') }}: </span>
|
|
|
6
|
+ <el-tag v-if="canSendIdServerCmd" type="success">{{ T('Available') }}</el-tag>
|
|
7
|
7
|
<el-tag v-else type="danger">{{ T('NotAvailable') }}</el-tag>
|
|
8
|
|
- <el-button size="small" type="text" @click="refreshCanSendCmd">{{ T('Refresh') }}</el-button>
|
|
|
8
|
+ <el-button size="small" type="text" @click="refreshCanSendIdServerCmd">{{ T('Refresh') }}</el-button>
|
|
|
9
|
+ </h5>
|
|
|
10
|
+ <h5>
|
|
|
11
|
+ <span>RELAY {{ T('Status') }}: </span>
|
|
|
12
|
+ <el-tag v-if="canSendRelayServerCmd" type="success">{{ T('Available') }}</el-tag>
|
|
|
13
|
+ <el-tag v-else type="danger">{{ T('NotAvailable') }}</el-tag>
|
|
|
14
|
+ <el-button size="small" type="text" @click="refreshCanSendRelayServerCmd">{{ T('Refresh') }}</el-button>
|
|
9
|
15
|
</h5>
|
|
10
|
16
|
<el-tabs
|
|
11
|
17
|
v-model="activeName"
|
|
|
@@ -13,13 +19,13 @@
|
|
13
|
19
|
>
|
|
14
|
20
|
<el-tab-pane :label="T('Simple')" name="Simple">
|
|
15
|
21
|
<el-space>
|
|
16
|
|
- <el-card shadow="hover" style="width: 300px" v-loading="rsForm.loading">
|
|
|
22
|
+ <el-card class="simple-card" shadow="hover" v-loading="rsForm.loading">
|
|
17
|
23
|
<template #header>
|
|
18
|
24
|
<div class="card-header">
|
|
19
|
25
|
<span>RELAY_SERVERS</span>
|
|
20
|
26
|
</div>
|
|
21
|
27
|
</template>
|
|
22
|
|
- <el-form :disabled="!canSendCmd">
|
|
|
28
|
+ <el-form :disabled="!canSendCmd(rsForm.target)">
|
|
23
|
29
|
<el-form-item>
|
|
24
|
30
|
<el-input v-model="rsForm.option"></el-input>
|
|
25
|
31
|
</el-form-item>
|
|
|
@@ -29,13 +35,13 @@
|
|
29
|
35
|
</el-form-item>
|
|
30
|
36
|
</el-form>
|
|
31
|
37
|
</el-card>
|
|
32
|
|
- <el-card shadow="hover" style="width: 300px">
|
|
|
38
|
+ <el-card class="simple-card" shadow="hover" v-loading="aurForm.loading">
|
|
33
|
39
|
<template #header>
|
|
34
|
40
|
<div class="card-header">
|
|
35
|
41
|
<span>ALWAYS_USE_RELAY</span>
|
|
36
|
42
|
</div>
|
|
37
|
43
|
</template>
|
|
38
|
|
- <el-form :disabled="!canSendCmd">
|
|
|
44
|
+ <el-form :disabled="!canSendCmd(aurForm.target)">
|
|
39
|
45
|
<el-form-item>
|
|
40
|
46
|
<el-switch v-model="aurForm.option" active-value="Y" inactive-value="N"></el-switch>
|
|
41
|
47
|
</el-form-item>
|
|
|
@@ -45,6 +51,8 @@
|
|
45
|
51
|
</el-form-item>
|
|
46
|
52
|
</el-form>
|
|
47
|
53
|
</el-card>
|
|
|
54
|
+ <blocklist :can-send="canSendCmd(RELAY_TARGET)"></blocklist>
|
|
|
55
|
+ <blacklist :can-send="canSendCmd(RELAY_TARGET)"></blacklist>
|
|
48
|
56
|
</el-space>
|
|
49
|
57
|
|
|
50
|
58
|
|
|
|
@@ -55,7 +63,7 @@
|
|
55
|
63
|
<el-form-item>
|
|
56
|
64
|
<el-button type="primary" @click="handlerQuery">{{ T('Filter') }}</el-button>
|
|
57
|
65
|
<el-button type="danger" @click="toAdd">{{ T('Add') }}</el-button>
|
|
58
|
|
- <el-button type="success" :disabled="!canSendCmd" @click="showCmd({cmd:'',option:''})">{{ T('Send') }}</el-button>
|
|
|
66
|
+ <el-button type="success" :disabled="!canSendIdServerCmd" @click="showCmd({cmd:'',option:''})">{{ T('Send') }}</el-button>
|
|
59
|
67
|
</el-form-item>
|
|
60
|
68
|
</el-form>
|
|
61
|
69
|
</el-card>
|
|
|
@@ -68,7 +76,7 @@
|
|
68
|
76
|
<el-table-column prop="explain" label="explain" align="center"></el-table-column>
|
|
69
|
77
|
<el-table-column label="actions" align="center">
|
|
70
|
78
|
<template #default="{row}">
|
|
71
|
|
- <el-button type="success" :disabled="!canSendCmd" @click="showCmd(row)">{{ T('SendCustom') }}</el-button>
|
|
|
79
|
+ <el-button type="success" :disabled="!canSendCmd(row.target)" @click="showCmd(row)">{{ T('Send') }}</el-button>
|
|
72
|
80
|
<el-button v-if="row.id" type="primary" @click="toUpdate(row)">{{ T('Edit') }}</el-button>
|
|
73
|
81
|
<el-button v-if="row.id" type="danger" @click="del(row)">{{ T('Delete') }}</el-button>
|
|
74
|
82
|
</template>
|
|
|
@@ -86,6 +94,12 @@
|
|
86
|
94
|
<el-form-item label="option">
|
|
87
|
95
|
<el-input v-model="formData.option"></el-input>
|
|
88
|
96
|
</el-form-item>
|
|
|
97
|
+ <el-form-item label="target">
|
|
|
98
|
+ <el-radio-group v-model="formData.target">
|
|
|
99
|
+ <el-radio label="id_server" value="21115"></el-radio>
|
|
|
100
|
+ <el-radio label="relay_server" value="21117"></el-radio>
|
|
|
101
|
+ </el-radio-group>
|
|
|
102
|
+ </el-form-item>
|
|
89
|
103
|
<el-form-item label="explain">
|
|
90
|
104
|
<el-input v-model="formData.explain"></el-input>
|
|
91
|
105
|
</el-form-item>
|
|
|
@@ -97,7 +111,7 @@
|
|
97
|
111
|
</el-dialog>
|
|
98
|
112
|
|
|
99
|
113
|
<el-dialog :title="T('SendCmd')" v-model="showCmdForm">
|
|
100
|
|
- <el-form label-width="150" :disabled="!canSendCmd">
|
|
|
114
|
+ <el-form label-width="150" :disabled="!canSendCmd(customCmd.target)">
|
|
101
|
115
|
<el-form-item label="cmd">
|
|
102
|
116
|
<el-input v-model="customCmd.cmd"></el-input>
|
|
103
|
117
|
</el-form-item>
|
|
|
@@ -107,6 +121,12 @@
|
|
107
|
121
|
<el-text type="primary">{{ customCmd.example }}</el-text>
|
|
108
|
122
|
</el-text>
|
|
109
|
123
|
</el-form-item>
|
|
|
124
|
+ <!-- <el-form-item label="target">
|
|
|
125
|
+ <el-radio-group v-model="customCmd.target">
|
|
|
126
|
+ <el-radio label="id_server" value="21115"></el-radio>
|
|
|
127
|
+ <el-radio label="relay_server" value="21117"></el-radio>
|
|
|
128
|
+ </el-radio-group>
|
|
|
129
|
+ </el-form-item>-->
|
|
110
|
130
|
<el-form-item>
|
|
111
|
131
|
<el-button type="primary" @click="submitCmd">{{ T('Send') }}</el-button>
|
|
112
|
132
|
</el-form-item>
|
|
|
@@ -128,32 +148,60 @@
|
|
128
|
148
|
import { onMounted, reactive, ref } from 'vue'
|
|
129
|
149
|
import { T } from '@/utils/i18n'
|
|
130
|
150
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
151
|
+ import blocklist from '@/views/rustdesk/blocklist.vue'
|
|
|
152
|
+ import blacklist from '@/views/rustdesk/blacklist.vue'
|
|
131
|
153
|
|
|
|
154
|
+ const ID_TARGET = '21115'
|
|
|
155
|
+ const RELAY_TARGET = '21117'
|
|
132
|
156
|
const activeName = ref('Simple')
|
|
133
|
157
|
|
|
134
|
|
- const canSendCmd = ref(false)
|
|
135
|
|
- const checkCanSendCmd = async () => {
|
|
136
|
|
- const res = await sendCmd({ cmd: 'h' }).catch(_ => false)
|
|
137
|
|
- canSendCmd.value = !!res.data
|
|
|
158
|
+ const canSendIdServerCmd = ref(false)
|
|
|
159
|
+ const checkCanSendIdServerCmd = async () => {
|
|
|
160
|
+ const res = await sendCmd({ cmd: 'h', target: ID_TARGET }).catch(_ => false)
|
|
|
161
|
+ canSendIdServerCmd.value = !!res.data
|
|
138
|
162
|
}
|
|
139
|
|
- const refreshCanSendCmd = () => {
|
|
140
|
|
- checkCanSendCmd().then(_ => {
|
|
141
|
|
- if (canSendCmd.value) {
|
|
|
163
|
+ const refreshCanSendIdServerCmd = () => {
|
|
|
164
|
+ checkCanSendIdServerCmd().then(_ => {
|
|
|
165
|
+ if (canSendIdServerCmd.value) {
|
|
142
|
166
|
getAUR()
|
|
143
|
167
|
getRS()
|
|
144
|
168
|
}
|
|
145
|
169
|
})
|
|
146
|
170
|
}
|
|
147
|
|
- onMounted(refreshCanSendCmd)
|
|
|
171
|
+ onMounted(refreshCanSendIdServerCmd)
|
|
|
172
|
+
|
|
|
173
|
+ const canSendRelayServerCmd = ref(false)
|
|
|
174
|
+ const checkCanSendRelayServerCmd = async () => {
|
|
|
175
|
+ const res = await sendCmd({ cmd: 'h', target: RELAY_TARGET }).catch(_ => false)
|
|
|
176
|
+ canSendRelayServerCmd.value = !!res.data
|
|
|
177
|
+ }
|
|
|
178
|
+ const refreshCanSendRelayServerCmd = () => {
|
|
|
179
|
+ checkCanSendRelayServerCmd().then(_ => {
|
|
|
180
|
+ if (canSendRelayServerCmd.value) {
|
|
|
181
|
+ }
|
|
|
182
|
+ })
|
|
|
183
|
+ }
|
|
|
184
|
+ onMounted(refreshCanSendRelayServerCmd)
|
|
|
185
|
+
|
|
|
186
|
+ const canSendCmd = (target) => {
|
|
|
187
|
+ if (target === ID_TARGET) {
|
|
|
188
|
+ return canSendIdServerCmd.value
|
|
|
189
|
+ }
|
|
|
190
|
+ if (target === RELAY_TARGET) {
|
|
|
191
|
+ return canSendRelayServerCmd.value
|
|
|
192
|
+ }
|
|
|
193
|
+ return false
|
|
|
194
|
+ }
|
|
148
|
195
|
|
|
149
|
196
|
const rsForm = reactive({
|
|
150
|
197
|
cmd: 'rs',
|
|
151
|
198
|
option: '',
|
|
|
199
|
+ target: ID_TARGET,
|
|
152
|
200
|
loading: false,
|
|
153
|
201
|
})
|
|
154
|
202
|
const getRS = async () => {
|
|
155
|
203
|
rsForm.loading = true
|
|
156
|
|
- const res = await sendCmd({ cmd: 'rs' }).catch(_ => false)
|
|
|
204
|
+ const res = await sendCmd({ cmd: 'rs', target: ID_TARGET }).catch(_ => false)
|
|
157
|
205
|
rsForm.loading = false
|
|
158
|
206
|
if (res) {
|
|
159
|
207
|
const data = res.data.split('\n').filter(i => i)
|
|
|
@@ -170,12 +218,13 @@
|
|
170
|
218
|
const aurForm = reactive({
|
|
171
|
219
|
cmd: 'aur',
|
|
172
|
220
|
option: '',
|
|
|
221
|
+ target: ID_TARGET,
|
|
173
|
222
|
value: 0,
|
|
174
|
223
|
loading: false,
|
|
175
|
224
|
})
|
|
176
|
225
|
const getAUR = async () => {
|
|
177
|
226
|
aurForm.loading = true
|
|
178
|
|
- const res = await sendCmd({ cmd: 'aur' }).catch(_ => false)
|
|
|
227
|
+ const res = await sendCmd({ cmd: 'aur', target: ID_TARGET }).catch(_ => false)
|
|
179
|
228
|
aurForm.loading = false
|
|
180
|
229
|
if (res) {
|
|
181
|
230
|
if (res.data === 'ALWAYS_USE_RELAY: true' || res.data === 'ALWAYS_USE_RELAY: true\n') {
|
|
|
@@ -236,6 +285,7 @@
|
|
236
|
285
|
cmd: '',
|
|
237
|
286
|
alias: '',
|
|
238
|
287
|
option: '',
|
|
|
288
|
+ target: '',
|
|
239
|
289
|
explain: '',
|
|
240
|
290
|
})
|
|
241
|
291
|
const formVisible = ref(false)
|
|
|
@@ -252,6 +302,7 @@
|
|
252
|
302
|
formData.cmd = row.cmd
|
|
253
|
303
|
formData.alias = row.alias
|
|
254
|
304
|
formData.option = row.option
|
|
|
305
|
+ formData.target = row.target
|
|
255
|
306
|
formData.explain = row.explain
|
|
256
|
307
|
}
|
|
257
|
308
|
const submit = async () => {
|
|
|
@@ -275,6 +326,7 @@
|
|
275
|
326
|
const customCmd = reactive({
|
|
276
|
327
|
cmd: '',
|
|
277
|
328
|
option: '',
|
|
|
329
|
+ target: '',
|
|
278
|
330
|
res: '',
|
|
279
|
331
|
example: '',
|
|
280
|
332
|
})
|
|
|
@@ -283,17 +335,23 @@
|
|
283
|
335
|
customCmd.cmd = row.cmd
|
|
284
|
336
|
customCmd.option = ''
|
|
285
|
337
|
customCmd.res = ''
|
|
|
338
|
+ customCmd.target = row.target
|
|
286
|
339
|
customCmd.example = `${row.cmd} ${row.option}`
|
|
287
|
340
|
}
|
|
288
|
341
|
const submitCmd = async () => {
|
|
289
|
342
|
sendCmd(customCmd).then(res => {
|
|
290
|
343
|
console.log(res)
|
|
291
|
344
|
customCmd.res = res.data
|
|
|
345
|
+ ElMessage.success(T('OperationSuccess'))
|
|
292
|
346
|
})
|
|
293
|
347
|
}
|
|
294
|
348
|
|
|
295
|
349
|
</script>
|
|
296
|
350
|
|
|
297
|
351
|
<style scoped lang="scss">
|
|
298
|
|
-
|
|
|
352
|
+.simple-card {
|
|
|
353
|
+ width: 300px;
|
|
|
354
|
+ margin: 10px;
|
|
|
355
|
+ min-height: 300px;
|
|
|
356
|
+}
|
|
299
|
357
|
</style>
|