🐛 修复通知测试按钮&自动重连机制
This commit is contained in:
parent
5f0e6e9ecc
commit
84b5f1beb6
@ -25,7 +25,7 @@ async function updateNotifyConfig({ res, request }) {
|
|||||||
case 'tg':
|
case 'tg':
|
||||||
let { sendTg } = await decryptAndExecuteAsync(path.join(__dirname, '../utils/plus.js')) || {}
|
let { sendTg } = await decryptAndExecuteAsync(path.join(__dirname, '../utils/plus.js')) || {}
|
||||||
console.log('sendTg: ', sendTg)
|
console.log('sendTg: ', sendTg)
|
||||||
if (!sendTg) return res.fail({ msg: 'Plus功能解析失败' })
|
if (!sendTg) return res.fail({ msg: 'Plus专属功能点,请激活Plus' })
|
||||||
await sendTg(noticeConfig[type], 'EasyNode通知测试', '这是一条测试通知')
|
await sendTg(noticeConfig[type], 'EasyNode通知测试', '这是一条测试通知')
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -93,30 +93,19 @@
|
|||||||
</template>
|
</template>
|
||||||
<el-form-item label="" class="form_item">
|
<el-form-item label="" class="form_item">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="noticeConfig.type !== 'tg'"
|
|
||||||
type="primary"
|
type="primary"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
@click="handleSave"
|
@click="handleSave"
|
||||||
>
|
>
|
||||||
测试并保存
|
测试并保存
|
||||||
</el-button>
|
</el-button>
|
||||||
<PlusSupportTip>
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
:disabled="!isPlusActive"
|
|
||||||
:loading="loading"
|
|
||||||
@click="handleSave"
|
|
||||||
>
|
|
||||||
测试并保存
|
|
||||||
</el-button>
|
|
||||||
</PlusSupportTip>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted, getCurrentInstance, computed } from 'vue'
|
import { ref, reactive, onMounted, getCurrentInstance, computed } from 'vue'
|
||||||
import PlusSupportTip from '@/components/common/PlusSupportTip.vue'
|
// import PlusSupportTip from '@/components/common/PlusSupportTip.vue'
|
||||||
|
|
||||||
const { proxy: { $api, $notification, $store } } = getCurrentInstance()
|
const { proxy: { $api, $notification, $store } } = getCurrentInstance()
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ const connectIO = () => {
|
|||||||
curStatus.value = CONNECT_FAIL
|
curStatus.value = CONNECT_FAIL
|
||||||
term.value.write('\r\n\x1b[91mError: 连接失败,请检查EasyNode服务端是否正常, 回车重新发起连接\x1b[0m \r\n')
|
term.value.write('\r\n\x1b[91mError: 连接失败,请检查EasyNode服务端是否正常, 回车重新发起连接\x1b[0m \r\n')
|
||||||
$notification({
|
$notification({
|
||||||
title: '连接失败',
|
title: '服务端连接失败',
|
||||||
message: '请检查EasyNode服务端是否正常',
|
message: '请检查EasyNode服务端是否正常',
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
@ -222,7 +222,6 @@ const reconnectTerminal = (isCommonTips = false, tips) => {
|
|||||||
socket.value.removeAllListeners()
|
socket.value.removeAllListeners()
|
||||||
socket.value.close()
|
socket.value.close()
|
||||||
socket.value = null
|
socket.value = null
|
||||||
curStatus.value = CONNECT_FAIL
|
|
||||||
socketConnected.value = false
|
socketConnected.value = false
|
||||||
if (isCommonTips) {
|
if (isCommonTips) {
|
||||||
if (isPlusActive.value && autoReconnect.value) {
|
if (isPlusActive.value && autoReconnect.value) {
|
||||||
@ -354,12 +353,11 @@ function extractLastCdPath(text) {
|
|||||||
|
|
||||||
const onData = () => {
|
const onData = () => {
|
||||||
term.value.onData((key) => {
|
term.value.onData((key) => {
|
||||||
if (!socket.value || !socketConnected.value) return
|
|
||||||
|
|
||||||
if ('\r' === key && curStatus.value === CONNECT_FAIL) {
|
if ('\r' === key && curStatus.value === CONNECT_FAIL) {
|
||||||
reconnectTerminal(false, '重新连接中...')
|
reconnectTerminal(false, '重新连接中...')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!socket.value || !socketConnected.value) return
|
||||||
|
|
||||||
if (isLongPressCtrl.value || isLongPressAlt.value) {
|
if (isLongPressCtrl.value || isLongPressAlt.value) {
|
||||||
const keyCode = key.toUpperCase().charCodeAt(0)
|
const keyCode = key.toUpperCase().charCodeAt(0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user