mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
feat: hide for guest
This commit is contained in:
parent
50a141583e
commit
73bb7b97f1
@ -17,6 +17,7 @@ export interface NezhaAPI {
|
||||
ipv6: string;
|
||||
valid_ip: string;
|
||||
display_index: number;
|
||||
hide_for_guest: boolean;
|
||||
host: NezhaAPIHost;
|
||||
status: NezhaAPIStatus;
|
||||
}
|
||||
|
@ -39,8 +39,14 @@ export async function GetNezhaData() {
|
||||
total_bandwidth: 0,
|
||||
result: [],
|
||||
};
|
||||
|
||||
// remove hidden servers
|
||||
const nezhaDataFiltered = nezhaData.filter(
|
||||
(element) => !element.hide_for_guest,
|
||||
);
|
||||
|
||||
const timestamp = Date.now() / 1000;
|
||||
data.result = nezhaData.map(
|
||||
data.result = nezhaDataFiltered.map(
|
||||
(element: MakeOptional<NezhaAPI, "ipv4" | "ipv6" | "valid_ip">) => {
|
||||
if (timestamp - element.last_active > 300) {
|
||||
data.offline_servers += 1;
|
||||
|
Loading…
Reference in New Issue
Block a user