重构多节点

This commit is contained in:
snltty
2025-12-08 17:23:42 +08:00
parent ae65906da1
commit ad016bb689
11 changed files with 62 additions and 44 deletions

View File

@@ -1,5 +1,5 @@
v1.9.6
2025-12-08 16:53:14
2025-12-08 17:23:42
1. 一些累计更新一些BUG修复
2. 优化客户端数据同步,减少服务器流量
3. 去除cdkey改为发电解锁中继速度

View File

@@ -244,7 +244,8 @@ span.split-pad10 {
}
}
/* .device-remark{position: absolute;left:0;top:0;right:0;bottom:0; backdrop-filter: blur(2px);
-webkit-backdrop-filter: blur(2px);z-index: 99;} */
.scrollbar,

View File

@@ -7,31 +7,34 @@
</div>
</template>
<template #default="scope">
<p>
<DeviceName :config="true" :item="scope.row"></DeviceName>
</p>
<p class="flex">
<template v-if="scope.row.Connected">
<SystemInfo :item="scope.row"></SystemInfo>
<WlistShow type="Relay" :item="scope.row"></WlistShow>
<UpdaterBtn :config="true" :item="scope.row"></UpdaterBtn>
</template>
<template v-else-if="scope.row.LastSignIn">
<span>{{ scope.row.LastSignIn }} - {{ scope.row.Version }}</span>
</template>
<template v-else>
<el-skeleton animated >
<template #template>
<div class="flex">
<el-skeleton-item variant="text" class="el-skeleton-item" />
<el-skeleton-item variant="text" class="el-skeleton-item" />
<span class="flex-1"></span>
<el-skeleton-item variant="text" class="el-skeleton-item" />
</div>
</template>
</el-skeleton>
</template>
</p>
<template v-if="scope.row">
<p>
<DeviceName :config="true" :item="scope.row"></DeviceName>
</p>
<p class="flex">
<template v-if="scope.row.Connected">
<SystemInfo :item="scope.row"></SystemInfo>
<WlistShow type="Relay" :item="scope.row"></WlistShow>
<UpdaterBtn :config="true" :item="scope.row"></UpdaterBtn>
</template>
<template v-else-if="scope.row.LastSignIn">
<span>{{ scope.row.LastSignIn }} - {{ scope.row.Version }}</span>
</template>
<template v-else>
<el-skeleton animated >
<template #template>
<div class="flex">
<el-skeleton-item variant="text" class="el-skeleton-item" />
<el-skeleton-item variant="text" class="el-skeleton-item" />
<span class="flex-1"></span>
<el-skeleton-item variant="text" class="el-skeleton-item" />
</div>
</template>
</el-skeleton>
</template>
</p>
</template>
<div class="device-remark"></div>
</template>
</el-table-column>
</template>

View File

@@ -43,7 +43,7 @@ export const provideDevices = () => {
const dataFn = (hook)=>{
return new Promise((resolve, reject) => {
hook.dataFn(devices.page.List).then(changed=>{
hook.dataFn(devices.page.List.filter(c=>c)).then(changed=>{
hook.changed = hook.changed ||changed;
resolve();
});
@@ -58,16 +58,19 @@ export const provideDevices = () => {
hook.refreshFn(devices.page.List);
});
const chaneds = Object.values(hooks).filter(c=>c.changed);
chaneds.forEach(hook=>{ hook.changed=false });
if(chaneds.length > 0){
const changeds = Object.values(hooks).filter(c=>c.changed);
changeds.forEach(hook=>{ hook.changed=false });
if(changeds.length > 0){
for (let i = 0; i< devices.page.List.length; i++) {
const json = {_index:i};
for(let j = 0; j < chaneds.length; j++) {
const hook = chaneds[j];
hook.processFn(devices.page.List[i],json);
const device = devices.page.List[i];
if(device){
const json = {_index:i};
for(let j = 0; j < changeds.length; j++) {
const hook = changeds[j];
hook.processFn(devices.page.List[i],json);
}
Object.assign(devices.page.List[i], json);
}
Object.assign(devices.page.List[i], json);
}
}
await Promise.all(Object.values(hooks).map(hook=>dataFn(hook)));
@@ -89,6 +92,10 @@ export const provideDevices = () => {
devices.page.Request = res.Request;
devices.page.Count = res.Count;
for (let j in res.List) {
// if(machineId.value != res.List[j].MachineId){
// res.List[j] = null;
// continue;
// }
Object.assign(res.List[j], {
showDel: machineId.value != res.List[j].MachineId && res.List[j].Connected == false,
showAccess: machineId.value != res.List[j].MachineId && res.List[j].Connected,

View File

@@ -1,7 +1,7 @@
<template>
<el-table-column prop="forward" :label="$t('home.forward')" width="80">
<template #default="scope">
<template v-if="scope.row.hook_counter">
<template v-if="scope.row &&scope.row.hook_counter">
<AccessBoolean value="ForwardOther,ForwardSelf">
<template #default="{values}">
<div class="skeleton-animation" :style="`animation-delay:${scope.row.animationDelay}ms`" v-if="values.ForwardOther || (values.ForwardSelf && scope.row.isSelf)">
@@ -20,7 +20,7 @@
</template>
</AccessBoolean>
</template>
<template v-else-if="!scope.row.hook_counter_load">
<template v-else-if="scope.row &&!scope.row.hook_counter_load">
<div class="skeleton-animation">
<el-skeleton animated >
<template #template>
@@ -30,6 +30,7 @@
</el-skeleton>
</div>
</template>
<div class="device-remark"></div>
</template>
</el-table-column>
</template>

View File

@@ -3,7 +3,7 @@
<template #default="{values}">
<el-table-column :label="$t('home.oper')" fixed="right" min-width="110">
<template #default="scope">
<div>
<div v-if="scope.row">
<div class="numbers">
<el-row>
<template v-if="scope.row.Connected">
@@ -45,6 +45,7 @@
</el-row>
</div>
</div>
<div class="device-remark"></div>
</template>
</el-table-column>
</template>

View File

@@ -1,12 +1,12 @@
<template>
<el-table-column prop="socks5" :label="$t('home.proxy')" width="160">
<template #default="scope">
<template v-if="scope.row.hook_socks5">
<template v-if="scope.row &&scope.row.hook_socks5">
<div class="skeleton-animation" :style="`animation-delay:${scope.row.animationDelay}ms`">
<Socks5Show :config="true" :item="scope.row"></Socks5Show>
</div>
</template>
<template v-else-if="!scope.row.hook_socks5_load">
<template v-else-if="scope.row &&!scope.row.hook_socks5_load">
<div class="skeleton-animation">
<el-skeleton animated >
<template #template>
@@ -16,6 +16,7 @@
</el-skeleton>
</div>
</template>
<div class="device-remark"></div>
</template>
</el-table-column>
</template>

View File

@@ -47,6 +47,7 @@ export default {
div.connect-point{
margin: -.2rem .3rem 0 -1.4rem;
position:absolute;
z-index 9
}
span.connect-point {
width: .9rem;

View File

@@ -3,7 +3,7 @@
<template #default="{values}">
<el-table-column prop="tunnel" :label="$t('home.tunnel')" width="86">
<template #default="scope">
<template v-if="scope.row.hook_tunnel">
<template v-if="scope.row && scope.row.hook_tunnel">
<div class="skeleton-animation" :style="`animation-delay:${scope.row.animationDelay}ms`">
<div>
<template v-if="scope.row.hook_tunnel.Net.CountryCode">
@@ -40,7 +40,7 @@
</div>
</div>
</template>
<template v-else-if="!scope.row.hook_tunnel_load">
<template v-else-if="scope.row &&!scope.row.hook_tunnel_load">
<div class="skeleton-animation">
<el-skeleton animated >
<template #template>
@@ -52,6 +52,7 @@
</el-skeleton>
</div>
</template>
<div class="device-remark"></div>
</template>
</el-table-column>

View File

@@ -4,7 +4,7 @@
<a href="javascript:;" class="a-line" @click="handleShowLease">{{$t('home.tuntap')}}</a>
</template>
<template #default="scope">
<div>
<div v-if="scope.row ">
<template v-if="scope.row.hook_tuntap">
<div class="skeleton-animation" :style="`animation-delay:${scope.row.animationDelay}ms`">
<TuntapShow :config="true" :item="scope.row"></TuntapShow>
@@ -22,6 +22,7 @@
</div>
</template>
</div>
<div class="device-remark"></div>
</template>
</el-table-column>
</template>

View File

@@ -2,6 +2,7 @@
<div class="home-list-wrap absolute" >
<Sort @sort="handleSortChange"></Sort>
<el-table :data="devices.page.List" stripe border style="width: 100%" :height="`${state.height}px`" size="small">
<!-- <AccessBoolean value=""></AccessBoolean> -->
<Device @refresh="handlePageRefresh"></Device>
<Tunnel @refresh="deviceRefreshHook('tunnel')"></Tunnel>
<Tuntap></Tuntap>