Add token check exception for localhost servers

Updated the network form modal to allow missing tokens only for servers with host '127.0.0.1'. This enhances security by prompting a warning when a token is missing for non-localhost servers.
This commit is contained in:
手瓜一十雪
2026-01-24 12:24:57 +08:00
parent dc858807ae
commit eda1e5f2ed

View File

@@ -55,7 +55,7 @@ const NetworkFormModal = <T extends keyof OneBotConfig['network']> (
if (['httpServers', 'httpSseServers', 'websocketServers'].includes(field)) { if (['httpServers', 'httpSseServers', 'websocketServers'].includes(field)) {
const serverData = data as any; const serverData = data as any;
if (!serverData.token) { if (!serverData.token && serverData.host !== '127.0.0.1') {
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
dialog.confirm({ dialog.confirm({
title: '安全警告', title: '安全警告',