Skip to content

Commit 843b8d4

Browse files
committed
refactor(webui): ignore http post and reverse ws token validation
1 parent 11452a4 commit 843b8d4

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/webui/FE/components/OneBotConfigNew.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ const OneBotConfigNew: React.FC<OneBotConfigProps> = ({ config, onChange, onSave
6161
const handleSaveAdapter = () => {
6262
if (!selectedAdapter) return;
6363

64-
// 检查:如果 onlyLocalhost 为 false,token 必须设置
65-
if (!globalConfig.onlyLocalhost && !selectedAdapter.token?.trim()) {
64+
// 检查:如果 onlyLocalhost 为 false,token 必须设置(仅对 ws 和 http 类型)
65+
const needsTokenValidation = selectedAdapter.type === 'ws' || selectedAdapter.type === 'http';
66+
if (needsTokenValidation && !globalConfig.onlyLocalhost && !selectedAdapter.token?.trim()) {
6667
showToast('当"只监听本地地址"关闭时,必须设置 Token!', 'error');
6768
return;
6869
}

0 commit comments

Comments
 (0)