Skip to content

Commit

Permalink
update: new node list format
Browse files Browse the repository at this point in the history
  • Loading branch information
LxHTT committed Oct 19, 2024
1 parent 54d2f7f commit f0c445e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
8 changes: 7 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ interface Statistics {
"port": number,
"ssl_cert_path": string,
"ssl_key_path": string,
"node_list": []
"node_list": nodeList[],
}
}

interface nodeList {
"endpoint": string,
"name": string,
"type": string,
}

const app = createApp(App);
app.use(router);
app.mount('#app');
Expand Down
15 changes: 15 additions & 0 deletions src/utils/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,19 @@ export function getCoreType(name: string) {
default:
return '未知';
}
}

export function formatNodeClientType(type: string) {
switch (type) {
case 'nodeside':
case 'Nodeside':
case 'nodeclient':
case 'Nodeclient':
return 'NodeClient';
case 'alist':
case 'Alist':
return 'AList';
default:
return '未知';
}
}
16 changes: 11 additions & 5 deletions src/views/NodeList.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<script setup lang="ts">
import Back from "../components/Back.vue";
import {statistics} from "../main.ts";
import { formatNodeClientType } from "../utils/util.ts";
import { statistics } from "../main.ts";
</script>

<template>
<Back/>
<Back />
<div class="node-container">
<div class="nodes">
<div class="node" v-for="node in statistics.config.node_list">
<p>{{ node }}</p>
<div class="node" v-for="node in statistics.config.node_list" :key="node.name">
<p><strong style="font-size: 1.1rem;">{{ node.name }}</strong></p>
<p>地址:{{ node.endpoint }}</p>
<p>类型:{{ formatNodeClientType(node.type) }}</p>
</div>
</div>
</div>
Expand All @@ -20,13 +23,16 @@ import {statistics} from "../main.ts";
height: calc(100% - 5rem);
padding: 1rem;
overflow: auto;
display: flex;
flex-wrap: wrap;
}
.node {
margin: 0.5rem auto;
display: flex;
flex-direction: column;
justify-content: start;
align-items: center;
align-items: start;
border-radius: 1rem;
background: #ffffffdd;
backdrop-filter: blur(5px);
Expand Down

0 comments on commit f0c445e

Please sign in to comment.