Skip to content

Commit 421374d

Browse files
authored
Merge pull request cmliu#906 from cmliu/beta2.0
fix: 优化CF_JSON配置逻辑,确保正确处理UsageAPI字段
2 parents 321af19 + 676b188 commit 421374d

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

_worker.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,11 @@ export default {
127127
if (newConfig.Email && newConfig.GlobalAPIKey) {
128128
CF_JSON.Email = newConfig.Email;
129129
CF_JSON.GlobalAPIKey = newConfig.GlobalAPIKey;
130-
CF_JSON.AccountID = null;
131-
CF_JSON.APIToken = null;
132-
CF_JSON.UsageAPI = null;
133130
} else if (newConfig.AccountID && newConfig.APIToken) {
134-
CF_JSON.Email = null;
135-
CF_JSON.GlobalAPIKey = null;
136131
CF_JSON.AccountID = newConfig.AccountID;
137132
CF_JSON.APIToken = newConfig.APIToken;
138-
CF_JSON.UsageAPI = null;
133+
} else if (newConfig.UsageAPI){
134+
CF_JSON.UsageAPI = newConfig.UsageAPI;
139135
} else {
140136
return new Response(JSON.stringify({ error: '配置不完整' }), { status: 400, headers: { 'Content-Type': 'application/json;charset=utf-8' } });
141137
}

0 commit comments

Comments
 (0)