mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-17 01:14:50 +08:00
diy支持任意仓库地址,修复添加ck报错,移除monk仓库内置
This commit is contained in:
+27
-19
@@ -220,14 +220,19 @@ const Config = () => {
|
||||
.get(`${config.apiPrefix}cookies`)
|
||||
.then((data: any) => {
|
||||
setValue(data.data);
|
||||
asyncUpdateStatus(data.data);
|
||||
})
|
||||
.finally(() => setLoading(false));
|
||||
};
|
||||
|
||||
const asyncUpdateStatus = async (data: any[]) => {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const cookie = data[i];
|
||||
useEffect(() => {
|
||||
if (value && loading) {
|
||||
asyncUpdateStatus();
|
||||
}
|
||||
}, [value]);
|
||||
|
||||
const asyncUpdateStatus = async () => {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const cookie = value[i];
|
||||
await sleep(1000);
|
||||
refreshStatus(cookie, i);
|
||||
}
|
||||
@@ -347,25 +352,28 @@ const Config = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const handleCancel = (cookie: any) => {
|
||||
const handleCancel = (cookies: any[]) => {
|
||||
setIsModalVisible(false);
|
||||
if (cookie) {
|
||||
handleCookies(cookie);
|
||||
if (cookies && cookies.length > 0) {
|
||||
handleCookies(cookies);
|
||||
}
|
||||
};
|
||||
|
||||
const handleCookies = (cookie: any) => {
|
||||
const index = value.findIndex((x) => x._id === cookie._id);
|
||||
const result = [...value];
|
||||
if (index === -1) {
|
||||
result.push(...cookie);
|
||||
} else {
|
||||
result.splice(index, 1, {
|
||||
...cookie,
|
||||
});
|
||||
const handleCookies = (cookies: any[]) => {
|
||||
for (let i = 0; i < cookies.length; i++) {
|
||||
const cookie = cookies[i];
|
||||
const index = value.findIndex((x) => x._id === cookie._id);
|
||||
const result = [...value];
|
||||
if (index === -1) {
|
||||
result.push(cookie);
|
||||
} else {
|
||||
result.splice(index, 1, {
|
||||
...cookie,
|
||||
});
|
||||
}
|
||||
setValue(result);
|
||||
refreshStatus(cookie, index);
|
||||
}
|
||||
refreshStatus(cookie, index);
|
||||
setValue(result);
|
||||
};
|
||||
|
||||
const components = {
|
||||
@@ -414,7 +422,7 @@ const Config = () => {
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
className="code-mirror-wrapper"
|
||||
className="cookie-wrapper"
|
||||
title="Cookie管理"
|
||||
loading={loading}
|
||||
extra={[
|
||||
|
||||
Reference in New Issue
Block a user