feat: Upgrade Server command
This commit is contained in:
+3
-3
@@ -191,9 +191,9 @@ export const asyncRoutes = [
|
||||
component: () => import('@/views/share_record/index.vue'),
|
||||
},
|
||||
{
|
||||
path: '/rustdesk',
|
||||
name: 'RustDesk',
|
||||
meta: { title: 'RustDesk', icon: 'Setting' /*keepAlive: true*/ },
|
||||
path: '/serverCmd',
|
||||
name: 'ServerCmd',
|
||||
meta: { title: 'ServerCmd', icon: 'Tools' /*keepAlive: true*/ },
|
||||
component: () => import('@/views/rustdesk/control.vue'),
|
||||
},
|
||||
],
|
||||
|
||||
@@ -468,5 +468,41 @@
|
||||
},
|
||||
"Captcha": {
|
||||
"One": "Captcha"
|
||||
},
|
||||
"ServerCmd": {
|
||||
"One": "Server Cmd"
|
||||
},
|
||||
"Simple": {
|
||||
"One": "Simple"
|
||||
},
|
||||
"Advanced": {
|
||||
"One": "Advanced"
|
||||
},
|
||||
"Available": {
|
||||
"One": "Available"
|
||||
},
|
||||
"NotAvailable": {
|
||||
"One": "Not Available"
|
||||
},
|
||||
"ServerCmdTips": {
|
||||
"One": "This feature is experimental. Please ensure that the API and hbbs are on the same loopback address. For more information, please refer to the {wiki}"
|
||||
},
|
||||
"Refresh": {
|
||||
"One": "Refresh"
|
||||
},
|
||||
"Save": {
|
||||
"One": "Save"
|
||||
},
|
||||
"SendCustom": {
|
||||
"One": "Send Custom"
|
||||
},
|
||||
"Send": {
|
||||
"One": "Send"
|
||||
},
|
||||
"SendCmd": {
|
||||
"One": "Send Cmd"
|
||||
},
|
||||
"Result": {
|
||||
"One": "Result"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,5 +471,41 @@
|
||||
},
|
||||
"Captcha": {
|
||||
"One": "Captcha"
|
||||
},
|
||||
"ServerCmd": {
|
||||
"One": "Comando del servidor"
|
||||
},
|
||||
"Simple": {
|
||||
"One": "Simple"
|
||||
},
|
||||
"Advanced": {
|
||||
"One": "Avanzado"
|
||||
},
|
||||
"Available": {
|
||||
"One": "Disponible"
|
||||
},
|
||||
"NotAvailable": {
|
||||
"One": "No disponible"
|
||||
},
|
||||
"ServerCmdTips": {
|
||||
"One": "Esta función es experimental, asegúrese de que la API y hbbs estén en la misma dirección de bucle, para más detalles consulte el {wiki}"
|
||||
},
|
||||
"Refresh": {
|
||||
"One": "Actualizar"
|
||||
},
|
||||
"Save": {
|
||||
"One": "Guardar"
|
||||
},
|
||||
"SendCustom": {
|
||||
"One": "Enviar personalizado"
|
||||
},
|
||||
"Send": {
|
||||
"One": "Enviar"
|
||||
},
|
||||
"SendCmd": {
|
||||
"One": "Enviar comando"
|
||||
},
|
||||
"Result": {
|
||||
"One": "Resultado"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,5 +474,41 @@
|
||||
},
|
||||
"Captcha": {
|
||||
"One": "Captcha"
|
||||
},
|
||||
"ServerCmd": {
|
||||
"One": "Commande serveur"
|
||||
},
|
||||
"Simple": {
|
||||
"One": "Simple"
|
||||
},
|
||||
"Advanced": {
|
||||
"One": "Avancé"
|
||||
},
|
||||
"Available": {
|
||||
"One": "Disponible"
|
||||
},
|
||||
"NotAvailable": {
|
||||
"One": "Non disponible"
|
||||
},
|
||||
"ServerCmdTips": {
|
||||
"One": "Cette fonctionnalité est expérimentale, veuillez vous assurer que l'API et hbbs sont sur la même adresse de boucle, pour plus de détails veuillez consulter le {wiki}"
|
||||
},
|
||||
"Refresh": {
|
||||
"One": "Actualiser"
|
||||
},
|
||||
"Save": {
|
||||
"One": "Enregistrer"
|
||||
},
|
||||
"SendCustom": {
|
||||
"One": "Envoyer personnalisé"
|
||||
},
|
||||
"Send": {
|
||||
"One": "Envoyer"
|
||||
},
|
||||
"SendCmd": {
|
||||
"One": "Envoyer Cmd"
|
||||
},
|
||||
"Result": {
|
||||
"One": "Résultat"
|
||||
}
|
||||
}
|
||||
@@ -457,5 +457,41 @@
|
||||
},
|
||||
"Captcha": {
|
||||
"One": "Captcha"
|
||||
},
|
||||
"ServerCmd": {
|
||||
"One": "서버 명령"
|
||||
},
|
||||
"Simple": {
|
||||
"One": "간단"
|
||||
},
|
||||
"Advanced": {
|
||||
"One": "고급"
|
||||
},
|
||||
"Available": {
|
||||
"One": "사용 가능"
|
||||
},
|
||||
"NotAvailable": {
|
||||
"One": "사용 불가"
|
||||
},
|
||||
"ServerCmdTips": {
|
||||
"One": "이 기능은 실험적이므로, api와 hbbs가 동일한 루프백 주소에 있는지 확인하십시오. 자세한 내용은 {wiki}를 참조하십시오."
|
||||
},
|
||||
"Refresh": {
|
||||
"One": "새로 고침"
|
||||
},
|
||||
"Save": {
|
||||
"One": "저장"
|
||||
},
|
||||
"SendCustom": {
|
||||
"One": "사용자 정의 전송"
|
||||
},
|
||||
"Send": {
|
||||
"One": "보내기"
|
||||
},
|
||||
"SendCmd": {
|
||||
"One": "명령 보내기"
|
||||
},
|
||||
"Result": {
|
||||
"One": "결과"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,6 +471,42 @@
|
||||
},
|
||||
"Captcha": {
|
||||
"One": "Captcha"
|
||||
},
|
||||
"ServerCmd": {
|
||||
"One": "Команда сервера"
|
||||
},
|
||||
"Simple": {
|
||||
"One": "Простой"
|
||||
},
|
||||
"Advanced": {
|
||||
"One": "Расширенный"
|
||||
},
|
||||
"Available": {
|
||||
"One": "Доступно"
|
||||
},
|
||||
"NotAvailable": {
|
||||
"One": "Недоступно"
|
||||
},
|
||||
"ServerCmdTips": {
|
||||
"One": "Эта функция является экспериментальной, убедитесь, что api и hbbs находятся на одном и том же адресе обратной связи, для получения дополнительной информации см. {wiki}"
|
||||
},
|
||||
"Refresh": {
|
||||
"One": "Обновить"
|
||||
},
|
||||
"Save": {
|
||||
"One": "Сохранить"
|
||||
},
|
||||
"SendCustom": {
|
||||
"One": "Отправить настраиваемое"
|
||||
},
|
||||
"Send": {
|
||||
"One": "Отправить"
|
||||
},
|
||||
"SendCmd": {
|
||||
"One": "Отправить команду"
|
||||
},
|
||||
"Result": {
|
||||
"One": "Результат"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -487,5 +487,41 @@
|
||||
},
|
||||
"Captcha": {
|
||||
"One": "验证码"
|
||||
},
|
||||
"ServerCmd": {
|
||||
"One": "服务端命令"
|
||||
},
|
||||
"Simple": {
|
||||
"One": "简单"
|
||||
},
|
||||
"Advanced": {
|
||||
"One": "高级"
|
||||
},
|
||||
"Available": {
|
||||
"One": "可用"
|
||||
},
|
||||
"NotAvailable": {
|
||||
"One": "不可用"
|
||||
},
|
||||
"ServerCmdTips": {
|
||||
"One": "此处功能为实验性质,请确保api和hbbs处于同一回环地址下,更多说明请参考 {wiki}"
|
||||
},
|
||||
"Refresh": {
|
||||
"One": "刷新"
|
||||
},
|
||||
"Save": {
|
||||
"One": "保存"
|
||||
},
|
||||
"SendCustom": {
|
||||
"One": "发送自定义"
|
||||
},
|
||||
"Send": {
|
||||
"One": "发送"
|
||||
},
|
||||
"SendCmd": {
|
||||
"One": "发送命令"
|
||||
},
|
||||
"Result": {
|
||||
"One": "结果"
|
||||
}
|
||||
}
|
||||
|
||||
+133
-12
@@ -1,11 +1,61 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2>此处功能为实验性质,更多说明请参考 <a target="_blank" href="https://github.com/lejianwen/rustdesk-api/wiki/Rustdesk-Command">WIKI</a></h2>
|
||||
<h4 v-html="T('ServerCmdTips', {wiki: '<a target=\'_blank\' href=\'https://github.com/lejianwen/rustdesk-api/wiki/Rustdesk-Command\'>WIKI</a>'})"></h4>
|
||||
<h5>
|
||||
<span>{{ T('Status') }}: </span>
|
||||
<el-tag v-if="canSendCmd" type="success">{{ T('Available') }}</el-tag>
|
||||
<el-tag v-else type="danger">{{ T('NotAvailable') }}</el-tag>
|
||||
<el-button size="small" type="text" @click="refreshCanSendCmd">{{ T('Refresh') }}</el-button>
|
||||
</h5>
|
||||
<el-tabs
|
||||
v-model="activeName"
|
||||
type="card"
|
||||
>
|
||||
<el-tab-pane :label="T('Simple')" name="Simple">
|
||||
<el-space>
|
||||
<el-card shadow="hover" style="width: 300px" v-loading="rsForm.loading">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>RELAY_SERVERS</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :disabled="!canSendCmd">
|
||||
<el-form-item>
|
||||
<el-input v-model="rsForm.option"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getRS">{{ T('Refresh') }}</el-button>
|
||||
<el-button @click="saveRS" type="primary">{{ T('Save') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card shadow="hover" style="width: 300px">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>ALWAYS_USE_RELAY</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :disabled="!canSendCmd">
|
||||
<el-form-item>
|
||||
<el-switch v-model="aurForm.option" active-value="Y" inactive-value="N"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getAUR">{{ T('Refresh') }}</el-button>
|
||||
<el-button @click="saveAUR" type="primary">{{ T('Save') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-space>
|
||||
|
||||
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="T('Advanced')" name="Advanced">
|
||||
<el-card class="list-query" shadow="hover">
|
||||
<el-form inline label-width="80px">
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handlerQuery">{{ T('Filter') }}</el-button>
|
||||
<el-button type="danger" @click="toAdd">{{ T('Add') }}</el-button>
|
||||
<el-button type="success" :disabled="!canSendCmd" @click="showCmd({cmd:'',option:''})">{{ T('Send') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
@@ -18,9 +68,9 @@
|
||||
<el-table-column prop="explain" label="explain" align="center"></el-table-column>
|
||||
<el-table-column label="actions" align="center">
|
||||
<template #default="{row}">
|
||||
<el-button type="success" @click="showCmd(row)">执行</el-button>
|
||||
<el-button v-if="row.id" type="primary" @click="toUpdate(row)">编辑</el-button>
|
||||
<el-button v-if="row.id" type="danger" @click="del(row)">删除</el-button>
|
||||
<el-button type="success" :disabled="!canSendCmd" @click="showCmd(row)">{{ T('SendCustom') }}</el-button>
|
||||
<el-button v-if="row.id" type="primary" @click="toUpdate(row)">{{ T('Edit') }}</el-button>
|
||||
<el-button v-if="row.id" type="danger" @click="del(row)">{{ T('Delete') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -40,29 +90,35 @@
|
||||
<el-input v-model="formData.explain"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submit">提交</el-button>
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
<el-button type="primary" @click="submit">{{ T('Submit') }}</el-button>
|
||||
<el-button @click="cancel">{{ T('Cancel') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="发送指令" v-model="showCmdForm">
|
||||
<el-form label-width="300">
|
||||
<el-dialog :title="T('SendCmd')" v-model="showCmdForm">
|
||||
<el-form label-width="150" :disabled="!canSendCmd">
|
||||
<el-form-item label="cmd">
|
||||
<el-input v-model="customCmd.cmd"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="option">
|
||||
<el-input type="textarea" v-model="customCmd.option"></el-input>
|
||||
<el-input v-model="customCmd.option"></el-input>
|
||||
<el-text v-if="customCmd.example.trim()" style="margin-top: 5px">Example:
|
||||
<el-text type="primary">{{ customCmd.example }}</el-text>
|
||||
</el-text>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitCmd">发送</el-button>
|
||||
<el-button type="primary" @click="submitCmd">{{ T('Send') }}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="执行结果">
|
||||
<el-input type="textarea" readonly disabled v-model="customCmd.res" rows="20"></el-input>
|
||||
<el-form-item :label="T('Result')">
|
||||
<el-input type="textarea" readonly disabled v-model="customCmd.res" rows="15"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</el-card>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -73,6 +129,69 @@
|
||||
import { T } from '@/utils/i18n'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
|
||||
const activeName = ref('Simple')
|
||||
|
||||
const canSendCmd = ref(false)
|
||||
const checkCanSendCmd = async () => {
|
||||
const res = await sendCmd({ cmd: 'h' }).catch(_ => false)
|
||||
canSendCmd.value = !!res.data
|
||||
}
|
||||
const refreshCanSendCmd = () => {
|
||||
checkCanSendCmd().then(_ => {
|
||||
if (canSendCmd.value) {
|
||||
getAUR()
|
||||
getRS()
|
||||
}
|
||||
})
|
||||
}
|
||||
onMounted(refreshCanSendCmd)
|
||||
|
||||
const rsForm = reactive({
|
||||
cmd: 'rs',
|
||||
option: '',
|
||||
loading: false,
|
||||
})
|
||||
const getRS = async () => {
|
||||
rsForm.loading = true
|
||||
const res = await sendCmd({ cmd: 'rs' }).catch(_ => false)
|
||||
rsForm.loading = false
|
||||
if (res) {
|
||||
const data = res.data.split('\n').filter(i => i)
|
||||
rsForm.option = data.join(',')
|
||||
}
|
||||
}
|
||||
const saveRS = async () => {
|
||||
const res = await sendCmd(rsForm).catch(_ => false)
|
||||
if (res) {
|
||||
ElMessage.success(T('OperationSuccess'))
|
||||
}
|
||||
}
|
||||
|
||||
const aurForm = reactive({
|
||||
cmd: 'aur',
|
||||
option: '',
|
||||
value: 0,
|
||||
loading: false,
|
||||
})
|
||||
const getAUR = async () => {
|
||||
aurForm.loading = true
|
||||
const res = await sendCmd({ cmd: 'aur' }).catch(_ => false)
|
||||
aurForm.loading = false
|
||||
if (res) {
|
||||
if (res.data === 'ALWAYS_USE_RELAY: true' || res.data === 'ALWAYS_USE_RELAY: true\n') {
|
||||
aurForm.option = 'Y'
|
||||
} else {
|
||||
aurForm.option = 'N'
|
||||
}
|
||||
}
|
||||
}
|
||||
const saveAUR = async () => {
|
||||
const res = await sendCmd(aurForm).catch(_ => false)
|
||||
if (res) {
|
||||
ElMessage.success(T('OperationSuccess'))
|
||||
}
|
||||
}
|
||||
|
||||
const listRes = reactive({
|
||||
list: [], total: 0, loading: false,
|
||||
})
|
||||
@@ -157,12 +276,14 @@
|
||||
cmd: '',
|
||||
option: '',
|
||||
res: '',
|
||||
example: '',
|
||||
})
|
||||
const showCmd = (row) => {
|
||||
showCmdForm.value = true
|
||||
customCmd.cmd = row.cmd
|
||||
customCmd.option = ''
|
||||
customCmd.res = ''
|
||||
customCmd.example = `${row.cmd} ${row.option}`
|
||||
}
|
||||
const submitCmd = async () => {
|
||||
sendCmd(customCmd).then(res => {
|
||||
|
||||
Reference in New Issue
Block a user