Skip to content

Commit

Permalink
fix: ChatGPTNextWeb#2820 try to fix 520 error code
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa committed Sep 18, 2023
1 parent 61ca60c commit adb860b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
9 changes: 7 additions & 2 deletions app/api/cors/[...path]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@ async function handle(
duplex: "half",
};

console.log("[Any Proxy]", targetUrl);
const fetchResult = await fetch(targetUrl, fetchOptions);

const fetchResult = fetch(targetUrl, fetchOptions);
console.log("[Any Proxy]", targetUrl, {
status: fetchResult.status,
statusText: fetchResult.statusText,
});

return fetchResult;
}

export const POST = handle;
export const GET = handle;
export const OPTIONS = handle;

export const runtime = "edge";
2 changes: 1 addition & 1 deletion app/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ function CheckButton() {

return (
<IconButton
text="检查可用性"
text={Locale.Settings.Sync.Config.Modal.Check}
bordered
onClick={check}
icon={
Expand Down
1 change: 1 addition & 0 deletions app/locales/cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ const cn = {
Config: {
Modal: {
Title: "配置云同步",
Check: "检查可用性",
},
SyncType: {
Title: "同步类型",
Expand Down
1 change: 1 addition & 0 deletions app/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ const en: LocaleType = {
Config: {
Modal: {
Title: "Config Sync",
Check: "Check Connection",
},
SyncType: {
Title: "Sync Type",
Expand Down
2 changes: 1 addition & 1 deletion app/utils/cloud/webdav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function createWebDavClient(store: SyncStore) {

console.log("[WebDav] check", res.status, res.statusText);

return [201, 200, 404].includes(res.status);
return [201, 200, 404, 401].includes(res.status);
} catch (e) {
console.error("[WebDav] failed to check", e);
}
Expand Down

0 comments on commit adb860b

Please sign in to comment.