diff --git a/eslint.config.mjs b/eslint.config.mjs
index 72775324..a196af52 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -53,6 +53,6 @@ export default defineConfig([
}
],
{
- ignores: ['node_modules/**', 'dist/**', 'out/**', '.gitignore', 'scripts/cloudflare-worker.js']
+ ignores: ['node_modules/**', 'dist/**', 'out/**', 'local/**', '.gitignore', 'scripts/cloudflare-worker.js']
}
])
diff --git a/package.json b/package.json
index 1716cc92..6dcc69a3 100644
--- a/package.json
+++ b/package.json
@@ -85,6 +85,7 @@
"npx-scope-finder": "^1.2.0",
"officeparser": "^4.1.1",
"p-queue": "^8.1.0",
+ "socks-proxy-agent": "^8.0.3",
"tar": "^7.4.3",
"tokenx": "^0.4.1",
"undici": "^7.4.0",
diff --git a/resources/scripts/download.js b/resources/scripts/download.js
index cc97f1df..270f8cbe 100644
--- a/resources/scripts/download.js
+++ b/resources/scripts/download.js
@@ -16,21 +16,23 @@ async function downloadWithRedirects(url, destinationPath) {
const proxyAgent = new SocksProxyAgent(proxyUrl)
return new Promise((resolve, reject) => {
const request = (url) => {
- https.get(url, { agent: proxyAgent }, (response) => {
- if (response.statusCode == 301 || response.statusCode == 302) {
- request(response.headers.location)
- return
- }
- if (response.statusCode !== 200) {
- reject(new Error(`Download failed: ${response.statusCode} ${response.statusMessage}`))
- return
- }
- const file = fs.createWriteStream(destinationPath)
- response.pipe(file)
- file.on('finish', () => resolve())
- }).on('error', (err) => {
- reject(err)
- })
+ https
+ .get(url, { agent: proxyAgent }, (response) => {
+ if (response.statusCode == 301 || response.statusCode == 302) {
+ request(response.headers.location)
+ return
+ }
+ if (response.statusCode !== 200) {
+ reject(new Error(`Download failed: ${response.statusCode} ${response.statusMessage}`))
+ return
+ }
+ const file = fs.createWriteStream(destinationPath)
+ response.pipe(file)
+ file.on('finish', () => resolve())
+ })
+ .on('error', (err) => {
+ reject(err)
+ })
}
request(url)
})
diff --git a/src/main/index.ts b/src/main/index.ts
index e4a1e18b..907ef2b6 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -1,6 +1,6 @@
import { electronApp, optimizer } from '@electron-toolkit/utils'
-import { app, ipcMain } from 'electron'
import { replaceDevtoolsFont } from '@main/utils/windowUtil'
+import { app, ipcMain } from 'electron'
import installExtension, { REDUX_DEVTOOLS } from 'electron-devtools-installer'
import { registerIpc } from './ipc'
diff --git a/src/renderer/src/pages/settings/DataSettings/WebDavSettings.tsx b/src/renderer/src/pages/settings/DataSettings/WebDavSettings.tsx
index e0e7487b..08fe07ea 100644
--- a/src/renderer/src/pages/settings/DataSettings/WebDavSettings.tsx
+++ b/src/renderer/src/pages/settings/DataSettings/WebDavSettings.tsx
@@ -262,46 +262,46 @@ const WebDavSettings: FC = () => {
>
)}
- <>
-
- setCustomFileName(e.target.value)}
- placeholder={t('settings.data.webdav.backup.modal.filename.placeholder')}
- />
-
-
- setIsRestoreModalVisible(false)}
- okButtonProps={{ loading: restoring }}
- width={600}>
-
-
- >
+
+
+ setIsRestoreModalVisible(false)}
+ okButtonProps={{ loading: restoring }}
+ width={600}>
+
+
+
+ >
)
}
diff --git a/src/renderer/src/store/messages.ts b/src/renderer/src/store/messages.ts
index a83be564..5ee2173d 100644
--- a/src/renderer/src/store/messages.ts
+++ b/src/renderer/src/store/messages.ts
@@ -28,31 +28,6 @@ const initialState: MessagesState = {
error: null
}
-// const MAX_RECENT_TOPICS = 10
-
-// // 只初始化最近的会话消息
-// export const initializeMessagesState = createAsyncThunk('messages/initialize', async () => {
-// try {
-// // 获取所有会话的基本信息
-// const recentTopics = await TopicManager.getTopicLimit(MAX_RECENT_TOPICS)
-// console.log('recentTopics', recentTopics)
-// const messagesByTopic: Record = {}
-
-// // 只加载最近会话的消息
-// for (const topic of recentTopics) {
-// if (topic.messages && topic.messages.length > 0) {
-// const messages = topic.messages.map((msg) => ({ ...msg }))
-// messagesByTopic[topic.id] = messages
-// }
-// }
-
-// return messagesByTopic
-// } catch (error) {
-// console.error('Failed to initialize recent messages:', error)
-// return {}
-// }
-// })
-
// 新增准备会话消息的函数,实现懒加载机制
export const prepareTopicMessages = createAsyncThunk(
'messages/prepareTopic',
@@ -144,7 +119,7 @@ const messagesSlice = createSlice({
if (message) {
Object.assign(message, updates)
db.topics.update(topicId, {
- messages: topicMessages.map((m) => (m.id === message.id ? cloneDeep(message) : m))
+ messages: topicMessages.map((m) => (m.id === message.id ? cloneDeep(message) : cloneDeep(m)))
})
}
}
@@ -210,19 +185,6 @@ const messagesSlice = createSlice({
}
}
}
- // extraReducers: (builder) => {
- // builder
- // .addCase(initializeMessagesState.pending, (state) => {
- // state.error = null
- // })
- // .addCase(initializeMessagesState.fulfilled, (state, action) => {
- // console.log('initializeMessagesState.fulfilled', action.payload)
- // state.messagesByTopic = action.payload
- // })
- // .addCase(initializeMessagesState.rejected, (state, action) => {
- // state.error = action.error.message || 'Failed to load messages'
- // })
- // }
})
const handleResponseMessageUpdate = (
diff --git a/yarn.lock b/yarn.lock
index bf29e7a6..ac75263e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3411,6 +3411,7 @@ __metadata:
rollup-plugin-visualizer: "npm:^5.12.0"
sass: "npm:^1.77.2"
shiki: "npm:^1.22.2"
+ socks-proxy-agent: "npm:^8.0.3"
string-width: "npm:^7.2.0"
styled-components: "npm:^6.1.11"
tar: "npm:^7.4.3"