From 26b721e05fbc246317fcc9a5e9df6e27bb001e9b Mon Sep 17 00:00:00 2001 From: Zephyruso <176294927+Zephyruso@users.noreply.github.com> Date: Wed, 11 Dec 2024 19:25:11 +0800 Subject: [PATCH] feat: ip label in logs --- src/store/logs.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/store/logs.ts b/src/store/logs.ts index ba01d69d..7418e502 100644 --- a/src/store/logs.ts +++ b/src/store/logs.ts @@ -3,6 +3,7 @@ import { LOG_LEVEL } from '@/config' import type { Log, LogWithSeq } from '@/types' import { useStorage } from '@vueuse/core' import { ref, watch } from 'vue' +import { sourceIPLabelMap } from './settings' export const logs = ref([]) export const logFilter = ref('') @@ -27,6 +28,13 @@ export const initLogs = () => { return } + for (const ip in sourceIPLabelMap.value) { + if (data.payload.includes(ip)) { + data.payload = data.payload.replace(ip, `${ip}(${sourceIPLabelMap.value[ip]})`) + break + } + } + logs.value.unshift({ ...data, time: new Date().valueOf(),