🐛 修复通知测试按钮&自动重连机制

This commit is contained in:
chaos-zhu 2024-12-24 22:38:59 +08:00
parent 5f0e6e9ecc
commit 84b5f1beb6
3 changed files with 4 additions and 17 deletions

View File

@ -25,7 +25,7 @@ async function updateNotifyConfig({ res, request }) {
case 'tg':
let { sendTg } = await decryptAndExecuteAsync(path.join(__dirname, '../utils/plus.js')) || {}
console.log('sendTg: ', sendTg)
if (!sendTg) return res.fail({ msg: 'Plus功能解析失败' })
if (!sendTg) return res.fail({ msg: 'Plus专属功能点请激活Plus' })
await sendTg(noticeConfig[type], 'EasyNode通知测试', '这是一条测试通知')
break
}

View File

@ -93,30 +93,19 @@
</template>
<el-form-item label="" class="form_item">
<el-button
v-if="noticeConfig.type !== 'tg'"
type="primary"
:loading="loading"
@click="handleSave"
>
测试并保存
</el-button>
<PlusSupportTip>
<el-button
type="primary"
:disabled="!isPlusActive"
:loading="loading"
@click="handleSave"
>
测试并保存
</el-button>
</PlusSupportTip>
</el-form-item>
</el-form>
</template>
<script setup>
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()

View File

@ -211,7 +211,7 @@ const connectIO = () => {
curStatus.value = CONNECT_FAIL
term.value.write('\r\n\x1b[91mError: 连接失败,请检查EasyNode服务端是否正常, 回车重新发起连接\x1b[0m \r\n')
$notification({
title: '连接失败',
title: '服务端连接失败',
message: '请检查EasyNode服务端是否正常',
type: 'error'
})
@ -222,7 +222,6 @@ const reconnectTerminal = (isCommonTips = false, tips) => {
socket.value.removeAllListeners()
socket.value.close()
socket.value = null
curStatus.value = CONNECT_FAIL
socketConnected.value = false
if (isCommonTips) {
if (isPlusActive.value && autoReconnect.value) {
@ -354,12 +353,11 @@ function extractLastCdPath(text) {
const onData = () => {
term.value.onData((key) => {
if (!socket.value || !socketConnected.value) return
if ('\r' === key && curStatus.value === CONNECT_FAIL) {
reconnectTerminal(false, '重新连接中...')
return
}
if (!socket.value || !socketConnected.value) return
if (isLongPressCtrl.value || isLongPressAlt.value) {
const keyCode = key.toUpperCase().charCodeAt(0)