Skip to content

Commit 161e773

Browse files
committed
Revert "✨ 网盘解除绑定 (#1151)"
This reverts commit 7ad9aac.
1 parent 7ad9aac commit 161e773

10 files changed

Lines changed: 11 additions & 89 deletions

File tree

packages/filesystem/auth.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { ExtServer, ExtServerApi } from "@App/app/const";
22
import { WarpTokenError } from "./error";
33
import { LocalStorageDAO } from "@App/app/repo/localStorage";
44
import { sleep } from "@App/pkg/utils/utils";
5-
import type { FileSystemType } from "./factory";
65

7-
export type NetDiskType = "baidu" | "onedrive" | "googledrive" | "dropbox";
6+
type NetDiskType = "baidu" | "onedrive" | "googledrive" | "dropbox";
87

98
export function GetNetDiskToken(netDiskType: NetDiskType): Promise<{
109
code: number;
@@ -128,21 +127,3 @@ export async function AuthVerify(netDiskType: NetDiskType, invalid?: boolean) {
128127
}
129128
return token.accessToken;
130129
}
131-
132-
export const netDiskTypeMap: Partial<Record<FileSystemType, NetDiskType>> = {
133-
"baidu-netdsik": "baidu",
134-
onedrive: "onedrive",
135-
googledrive: "googledrive",
136-
dropbox: "dropbox",
137-
};
138-
139-
export async function ClearNetDiskToken(netDiskType: NetDiskType) {
140-
const localStorageDAO = new LocalStorageDAO();
141-
const key = `netdisk:token:${netDiskType}`;
142-
try {
143-
await localStorageDAO.delete(key);
144-
} catch (error) {
145-
// ignore
146-
console.error("ClearNetDiskToken error:", error);
147-
}
148-
}

src/locales/ach-UG/translation.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,10 +418,6 @@
418418
"confirm_leave_page": "crwdns8634:0crwdne8634:0",
419419
"page_in_blacklist": "crwdns8636:0crwdne8636:0",
420420
"baidu_netdisk": "crwdns8638:0crwdne8638:0",
421-
"netdisk_unbind": "Unbind {{provider}}",
422-
"netdisk_unbind_confirm": "Unbind the {{provider}} account?",
423-
"netdisk_unbind_success": "{{provider}} account unbound",
424-
"netdisk_unbind_error": "Failed to unbind {{provider}} account",
425421
"save_only_current_group": "crwdns8640:0crwdne8640:0",
426422
"script_import_result": "crwdns8642:0crwdne8642:0",
427423
"failure_info": "crwdns8644:0crwdne8644:0",
@@ -541,4 +537,4 @@
541537
"subscribe_update_desc": "crwdns12856:0{{newScripts}}crwdnd12856:0{{deletedScripts}}crwdne12856:0"
542538
},
543539
"loading": "crwdns12870:0crwdne12870:0"
544-
}
540+
}

src/locales/de-DE/translation.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,6 @@
420420
"confirm_leave_page": "Derzeit im Bearbeitungsstatus. Das Navigieren zu anderen Seiten führt zum Verlust des aktuellen Inhalts. Navigieren?",
421421
"page_in_blacklist": "Die aktuelle Seite ist auf der Blacklist und kann keine Skripte verwenden",
422422
"baidu_netdisk": "Baidu Netdisk",
423-
"netdisk_unbind": "{{provider}} trennen",
424-
"netdisk_unbind_confirm": "Das {{provider}}-Konto trennen?",
425-
"netdisk_unbind_success": "{{provider}}-Konto getrennt",
426-
"netdisk_unbind_error": "{{provider}}-Konto konnte nicht getrennt werden",
427423
"save_only_current_group": "Speichern ist nur für die aktuelle Gruppe wirksam",
428424
"script_import_result": "Skript-Import-Ergebnis",
429425
"failure_info": "Fehlerinformationen",
@@ -555,4 +551,4 @@
555551
"maybe_later": "Vielleicht später",
556552
"settings_hint": "Sie können diese Option jederzeit in den Einstellungen ändern."
557553
}
558-
}
554+
}

src/locales/en-US/translation.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,6 @@
420420
"confirm_leave_page": "Currently editing status. Leaving this page will lose the current content. Do you want to leave?",
421421
"page_in_blacklist": "The current page is blacklisted, cannot use script",
422422
"baidu_netdisk": "BaiduNetdisk",
423-
"netdisk_unbind": "Unbind {{provider}}",
424-
"netdisk_unbind_confirm": "Unbind the {{provider}} account?",
425-
"netdisk_unbind_success": "{{provider}} account unbound",
426-
"netdisk_unbind_error": "Failed to unbind {{provider}} account",
427423
"save_only_current_group": "Save only for current group",
428424
"script_import_result": "Script Import Results",
429425
"failure_info": "Failure Information",
@@ -555,4 +551,4 @@
555551
"maybe_later": "Maybe Later",
556552
"settings_hint": "You can change this option in settings at any time."
557553
}
558-
}
554+
}

src/locales/ja-JP/translation.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,6 @@
420420
"confirm_leave_page": "現在編集中です。他のページに移動すると現在の内容が失われます。移動しますか?",
421421
"page_in_blacklist": "現在のページはブラックリストにあり、スクリプトを使用できません",
422422
"baidu_netdisk": "百度ネットディスク",
423-
"netdisk_unbind": "{{provider}} の連携を解除",
424-
"netdisk_unbind_confirm": "{{provider}} のアカウント連携を解除しますか?",
425-
"netdisk_unbind_success": "{{provider}} のアカウント連携を解除しました",
426-
"netdisk_unbind_error": "{{provider}} のアカウント解除に失敗しました",
427423
"save_only_current_group": "保存は現在のグループにのみ有効です",
428424
"script_import_result": "スクリプトインポート結果",
429425
"failure_info": "失敗情報",
@@ -555,4 +551,4 @@
555551
"maybe_later": "後で",
556552
"settings_hint": "設定ページでいつでも変更できます。"
557553
}
558-
}
554+
}

src/locales/ru-RU/translation.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,6 @@
420420
"confirm_leave_page": "В настоящее время идет редактирование. Переход на другую страницу приведет к потере текущего содержимого. Продолжить переход?",
421421
"page_in_blacklist": "Текущая страница находится в черном списке, невозможно использовать скрипты",
422422
"baidu_netdisk": "Baidu Netdisk",
423-
"netdisk_unbind": "Отвязать {{provider}}",
424-
"netdisk_unbind_confirm": "Отвязать аккаунт {{provider}}?",
425-
"netdisk_unbind_success": "Аккаунт {{provider}} отвязан",
426-
"netdisk_unbind_error": "Не удалось отвязать аккаунт {{provider}}",
427423
"save_only_current_group": "Сохранение действует только для текущей группы",
428424
"script_import_result": "Результат импорта скрипта",
429425
"failure_info": "Информация об ошибке",
@@ -555,4 +551,4 @@
555551
"maybe_later": "Может быть позже",
556552
"settings_hint": "Вы можете изменить эту опцию в настройках в любое время."
557553
}
558-
}
554+
}

src/locales/vi-VN/translation.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,6 @@
420420
"confirm_leave_page": "Hiện đang ở trạng thái chỉnh sửa. Rời khỏi trang này sẽ làm mất nội dung hiện tại. Bạn có muốn rời đi không?",
421421
"page_in_blacklist": "Trang hiện tại nằm trong danh sách đen, không thể sử dụng script",
422422
"baidu_netdisk": "Baidunetdisk",
423-
"netdisk_unbind": "Hủy liên kết {{provider}}",
424-
"netdisk_unbind_confirm": "Hủy liên kết tài khoản {{provider}}?",
425-
"netdisk_unbind_success": "Đã hủy liên kết tài khoản {{provider}}",
426-
"netdisk_unbind_error": "Không thể hủy liên kết tài khoản {{provider}}",
427423
"save_only_current_group": "Chỉ lưu cho nhóm hiện tại",
428424
"script_import_result": "Kết quả nhập script",
429425
"failure_info": "Thông tin thất bại",
@@ -555,4 +551,4 @@
555551
"maybe_later": "Để sau",
556552
"settings_hint": "Bạn có thể thay đổi tùy chọn này trong cài đặt bất kỳ lúc nào."
557553
}
558-
}
554+
}

src/locales/zh-CN/translation.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,6 @@
420420
"confirm_leave_page": "当前正在编辑状态,跳转其它页面将会丢失当前内容,是否跳转?",
421421
"page_in_blacklist": "当前页面在黑名单中,无法使用脚本",
422422
"baidu_netdisk": "百度网盘",
423-
"netdisk_unbind": "解除绑定 {{provider}}",
424-
"netdisk_unbind_confirm": "确定解除 {{provider}} 账号绑定吗?",
425-
"netdisk_unbind_success": "已解除 {{provider}} 账号绑定",
426-
"netdisk_unbind_error": "解除 {{provider}} 账号失败",
427423
"save_only_current_group": "保存只对当前组有效",
428424
"script_import_result": "脚本导入结果",
429425
"failure_info": "失败信息",
@@ -555,4 +551,4 @@
555551
"maybe_later": "暂不启用",
556552
"settings_hint": "你可以随时在设置中修改此选项。"
557553
}
558-
}
554+
}

src/locales/zh-TW/translation.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,6 @@
420420
"confirm_leave_page": "目前正在編輯狀態,跳轉其他頁面將會遺失目前內容,是否跳轉?",
421421
"page_in_blacklist": "目前頁面在黑名單中,無法使用腳本",
422422
"baidu_netdisk": "百度網盤",
423-
"netdisk_unbind": "解除綁定 {{provider}}",
424-
"netdisk_unbind_confirm": "確定解除 {{provider}} 帳號綁定嗎?",
425-
"netdisk_unbind_success": "已解除 {{provider}} 帳號綁定",
426-
"netdisk_unbind_error": "解除 {{provider}} 帳號失敗",
427423
"save_only_current_group": "儲存僅對目前群組有效",
428424
"script_import_result": "腳本匯入結果",
429425
"failure_info": "失敗資訊",
@@ -555,4 +551,4 @@
555551
"maybe_later": "暫不啟用",
556552
"settings_hint": "你可以隨時在設定中修改此選項。"
557553
}
558-
}
554+
}

src/pages/components/FileSystemParams/index.tsx

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React from "react";
2-
import { Button, Input, Message, Popconfirm, Select, Space } from "@arco-design/web-react";
2+
import { Input, Select, Space } from "@arco-design/web-react";
33
import type { FileSystemType } from "@Packages/filesystem/factory";
44
import FileSystemFactory from "@Packages/filesystem/factory";
55
import { useTranslation } from "react-i18next";
6-
import { ClearNetDiskToken, netDiskTypeMap } from "@Packages/filesystem/auth";
76

87
const FileSystemParams: React.FC<{
98
preNode: React.ReactNode | string;
@@ -22,7 +21,6 @@ const FileSystemParams: React.FC<{
2221
}) => {
2322
const fsParams = FileSystemFactory.params();
2423
const { t } = useTranslation();
25-
const actionButtons = [...actionButton];
2624

2725
const fileSystemList: {
2826
key: FileSystemType;
@@ -50,31 +48,6 @@ const FileSystemParams: React.FC<{
5048
},
5149
];
5250

53-
const netDiskType = netDiskTypeMap[fileSystemType];
54-
55-
if (netDiskType) {
56-
const netDiskName = fileSystemList.find((item) => item.key === fileSystemType)?.name;
57-
58-
actionButtons.push(
59-
<Popconfirm
60-
key="netdisk-unbind"
61-
title={t("netdisk_unbind_confirm", { provider: netDiskName })}
62-
onOk={async () => {
63-
try {
64-
await ClearNetDiskToken(netDiskType);
65-
Message.success(t("netdisk_unbind_success", { provider: netDiskName })!);
66-
} catch (error) {
67-
Message.error(`${t("netdisk_unbind_error", { provider: netDiskName })}: ${String(error)}`);
68-
}
69-
}}
70-
>
71-
<Button type="primary" status="danger">
72-
{t("netdisk_unbind", { provider: netDiskName })}
73-
</Button>
74-
</Popconfirm>
75-
);
76-
}
77-
7851
return (
7952
<>
8053
<Space>
@@ -92,7 +65,7 @@ const FileSystemParams: React.FC<{
9265
</Select.Option>
9366
))}
9467
</Select>
95-
{actionButtons.map((item) => item)}
68+
{actionButton.map((item) => item)}
9669
</Space>
9770
<Space
9871
style={{

0 commit comments

Comments
 (0)