|
|
@@ -19,38 +19,9 @@
|
|
19
|
19
|
>
|
|
20
|
20
|
<el-tab-pane :label="T('Simple')" name="Simple">
|
|
21
|
21
|
<el-space>
|
|
22
|
|
- <el-card class="simple-card" shadow="hover" v-loading="rsForm.loading">
|
|
23
|
|
- <template #header>
|
|
24
|
|
- <div class="card-header">
|
|
25
|
|
- <span>RELAY_SERVERS</span>
|
|
26
|
|
- </div>
|
|
27
|
|
- </template>
|
|
28
|
|
- <el-form :disabled="!canSendCmd(rsForm.target)">
|
|
29
|
|
- <el-form-item>
|
|
30
|
|
- <el-input v-model="rsForm.option"></el-input>
|
|
31
|
|
- </el-form-item>
|
|
32
|
|
- <el-form-item>
|
|
33
|
|
- <el-button @click="getRS">{{ T('Refresh') }}</el-button>
|
|
34
|
|
- <el-button @click="saveRS" type="primary">{{ T('Save') }}</el-button>
|
|
35
|
|
- </el-form-item>
|
|
36
|
|
- </el-form>
|
|
37
|
|
- </el-card>
|
|
38
|
|
- <el-card class="simple-card" shadow="hover" v-loading="aurForm.loading">
|
|
39
|
|
- <template #header>
|
|
40
|
|
- <div class="card-header">
|
|
41
|
|
- <span>ALWAYS_USE_RELAY</span>
|
|
42
|
|
- </div>
|
|
43
|
|
- </template>
|
|
44
|
|
- <el-form :disabled="!canSendCmd(aurForm.target)">
|
|
45
|
|
- <el-form-item>
|
|
46
|
|
- <el-switch v-model="aurForm.option" active-value="Y" inactive-value="N"></el-switch>
|
|
47
|
|
- </el-form-item>
|
|
48
|
|
- <el-form-item>
|
|
49
|
|
- <el-button @click="getAUR">{{ T('Refresh') }}</el-button>
|
|
50
|
|
- <el-button @click="saveAUR" type="primary">{{ T('Save') }}</el-button>
|
|
51
|
|
- </el-form-item>
|
|
52
|
|
- </el-form>
|
|
53
|
|
- </el-card>
|
|
|
22
|
+ <RelayServers ref="rs" :can-send="canSendCmd(ID_TARGET)"></RelayServers>
|
|
|
23
|
+ <alwaysUseRelay :can-send="canSendCmd(ID_TARGET)" @success="handleAlwaysUseRelaySuccess"></alwaysUseRelay>
|
|
|
24
|
+ <mustLogin :can-send="canSendCmd(ID_TARGET)"></mustLogin>
|
|
54
|
25
|
<blocklist :can-send="canSendCmd(RELAY_TARGET)"></blocklist>
|
|
55
|
26
|
<blacklist :can-send="canSendCmd(RELAY_TARGET)"></blacklist>
|
|
56
|
27
|
</el-space>
|
|
|
@@ -63,12 +34,12 @@
|
|
63
|
34
|
<el-form-item>
|
|
64
|
35
|
<el-button type="primary" @click="handlerQuery">{{ T('Filter') }}</el-button>
|
|
65
|
36
|
<el-button type="danger" @click="toAdd">{{ T('Add') }}</el-button>
|
|
66
|
|
- <el-button type="success" :disabled="!canSendIdServerCmd" @click="showCmd({cmd:'',option:''})">{{ T('Send') }}</el-button>
|
|
|
37
|
+ <el-button type="success" :disabled="!canSendIdServerCmd" @click="showCmd({cmd:'',option:'',target:ID_TARGET})">{{ T('Send') }} To Id</el-button>
|
|
|
38
|
+ <el-button type="success" :disabled="!canSendRelayServerCmd" @click="showCmd({cmd:'',option:'',target:RELAY_TARGET})">{{ T('Send') }} To Relay</el-button>
|
|
67
|
39
|
</el-form-item>
|
|
68
|
40
|
</el-form>
|
|
69
|
41
|
</el-card>
|
|
70
|
42
|
<el-card class="list-body" shadow="hover">
|
|
71
|
|
-
|
|
72
|
43
|
<el-table :data="listRes.list" v-loading="listRes.loading" border>
|
|
73
|
44
|
<el-table-column prop="cmd" label="cmd" align="center"></el-table-column>
|
|
74
|
45
|
<el-table-column prop="alias" label="alias" align="center"></el-table-column>
|
|
|
@@ -144,17 +115,20 @@
|
|
144
|
115
|
|
|
145
|
116
|
|
|
146
|
117
|
<script setup>
|
|
147
|
|
- import { list, sendCmd, remove, create, update } from '@/api/rustdesk'
|
|
|
118
|
+ import { create, list, remove, sendCmd, update } from '@/api/rustdesk'
|
|
148
|
119
|
import { onMounted, reactive, ref } from 'vue'
|
|
149
|
120
|
import { T } from '@/utils/i18n'
|
|
150
|
121
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
151
|
122
|
import blocklist from '@/views/rustdesk/blocklist.vue'
|
|
152
|
123
|
import blacklist from '@/views/rustdesk/blacklist.vue'
|
|
|
124
|
+ import alwaysUseRelay from '@/views/rustdesk/always_use_relay.vue'
|
|
|
125
|
+ import RelayServers from '@/views/rustdesk/relay_servers.vue'
|
|
|
126
|
+ import mustLogin from '@/views/rustdesk/must_login.vue'
|
|
|
127
|
+ import { ID_TARGET, RELAY_TARGET } from '@/views/rustdesk/options'
|
|
153
|
128
|
|
|
154
|
|
- const ID_TARGET = '21115'
|
|
155
|
|
- const RELAY_TARGET = '21117'
|
|
156
|
129
|
const activeName = ref('Simple')
|
|
157
|
130
|
|
|
|
131
|
+
|
|
158
|
132
|
const canSendIdServerCmd = ref(false)
|
|
159
|
133
|
const checkCanSendIdServerCmd = async () => {
|
|
160
|
134
|
const res = await sendCmd({ cmd: 'h', target: ID_TARGET }).catch(_ => false)
|
|
|
@@ -163,17 +137,20 @@
|
|
163
|
137
|
const refreshCanSendIdServerCmd = () => {
|
|
164
|
138
|
checkCanSendIdServerCmd().then(_ => {
|
|
165
|
139
|
if (canSendIdServerCmd.value) {
|
|
166
|
|
- getAUR()
|
|
167
|
|
- getRS()
|
|
168
|
140
|
}
|
|
169
|
141
|
})
|
|
170
|
142
|
}
|
|
171
|
143
|
onMounted(refreshCanSendIdServerCmd)
|
|
172
|
144
|
|
|
173
|
145
|
const canSendRelayServerCmd = ref(false)
|
|
|
146
|
+ const canControlMustLogin = ref(false)
|
|
174
|
147
|
const checkCanSendRelayServerCmd = async () => {
|
|
175
|
148
|
const res = await sendCmd({ cmd: 'h', target: RELAY_TARGET }).catch(_ => false)
|
|
176
|
149
|
canSendRelayServerCmd.value = !!res.data
|
|
|
150
|
+ if (canSendRelayServerCmd.value) {
|
|
|
151
|
+ const commands = res.data.split('\n').filter(i => i)
|
|
|
152
|
+ canControlMustLogin.value = commands.some(i => i.includes('must-login'))
|
|
|
153
|
+ }
|
|
177
|
154
|
}
|
|
178
|
155
|
const refreshCanSendRelayServerCmd = () => {
|
|
179
|
156
|
checkCanSendRelayServerCmd().then(_ => {
|
|
|
@@ -183,6 +160,12 @@
|
|
183
|
160
|
}
|
|
184
|
161
|
onMounted(refreshCanSendRelayServerCmd)
|
|
185
|
162
|
|
|
|
163
|
+ const rs = ref(null)
|
|
|
164
|
+ console.log(rs)
|
|
|
165
|
+ const handleAlwaysUseRelaySuccess = () => {
|
|
|
166
|
+ rs.value.save()
|
|
|
167
|
+ }
|
|
|
168
|
+
|
|
186
|
169
|
const canSendCmd = (target) => {
|
|
187
|
170
|
if (target === ID_TARGET) {
|
|
188
|
171
|
return canSendIdServerCmd.value
|
|
|
@@ -193,54 +176,6 @@
|
|
193
|
176
|
return false
|
|
194
|
177
|
}
|
|
195
|
178
|
|
|
196
|
|
- const rsForm = reactive({
|
|
197
|
|
- cmd: 'rs',
|
|
198
|
|
- option: '',
|
|
199
|
|
- target: ID_TARGET,
|
|
200
|
|
- loading: false,
|
|
201
|
|
- })
|
|
202
|
|
- const getRS = async () => {
|
|
203
|
|
- rsForm.loading = true
|
|
204
|
|
- const res = await sendCmd({ cmd: 'rs', target: ID_TARGET }).catch(_ => false)
|
|
205
|
|
- rsForm.loading = false
|
|
206
|
|
- if (res) {
|
|
207
|
|
- const data = res.data.split('\n').filter(i => i)
|
|
208
|
|
- rsForm.option = data.join(',')
|
|
209
|
|
- }
|
|
210
|
|
- }
|
|
211
|
|
- const saveRS = async () => {
|
|
212
|
|
- const res = await sendCmd(rsForm).catch(_ => false)
|
|
213
|
|
- if (res) {
|
|
214
|
|
- ElMessage.success(T('OperationSuccess'))
|
|
215
|
|
- }
|
|
216
|
|
- }
|
|
217
|
|
-
|
|
218
|
|
- const aurForm = reactive({
|
|
219
|
|
- cmd: 'aur',
|
|
220
|
|
- option: '',
|
|
221
|
|
- target: ID_TARGET,
|
|
222
|
|
- value: 0,
|
|
223
|
|
- loading: false,
|
|
224
|
|
- })
|
|
225
|
|
- const getAUR = async () => {
|
|
226
|
|
- aurForm.loading = true
|
|
227
|
|
- const res = await sendCmd({ cmd: 'aur', target: ID_TARGET }).catch(_ => false)
|
|
228
|
|
- aurForm.loading = false
|
|
229
|
|
- if (res) {
|
|
230
|
|
- if (res.data === 'ALWAYS_USE_RELAY: true' || res.data === 'ALWAYS_USE_RELAY: true\n') {
|
|
231
|
|
- aurForm.option = 'Y'
|
|
232
|
|
- } else {
|
|
233
|
|
- aurForm.option = 'N'
|
|
234
|
|
- }
|
|
235
|
|
- }
|
|
236
|
|
- }
|
|
237
|
|
- const saveAUR = async () => {
|
|
238
|
|
- const res = await sendCmd(aurForm).catch(_ => false)
|
|
239
|
|
- if (res) {
|
|
240
|
|
- ElMessage.success(T('OperationSuccess'))
|
|
241
|
|
- }
|
|
242
|
|
- }
|
|
243
|
|
-
|
|
244
|
179
|
const listRes = reactive({
|
|
245
|
180
|
list: [], total: 0, loading: false,
|
|
246
|
181
|
})
|