Electron 桌面客户端,聚合多个开放获取文献源的搜索、详情与下载。 新增数据源: - Z-Library:邮箱登录(凭据本地存储),会话失效自动重登 - LibGen:适配新版 libgen.ac 前端(旧版 search.php 镜像已全部下线) - Memory of the World、Sci-Hub、Anna's Archive 基础设施: - mirror.js:镜像故障转移,支持串行优先与并发竞速两种策略, 失效镜像 5 分钟冷却后自动重试,避免站点恢复后被永久跳过 - http.js:统一 15 秒请求超时,防止单个卡死镜像拖垮整次搜索 - settings.js:全局代理配置持久化,经 Electron net.fetch 生效于所有请求 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
40 lines
2.0 KiB
JavaScript
40 lines
2.0 KiB
JavaScript
const { contextBridge, ipcRenderer } = require('electron');
|
|
|
|
contextBridge.exposeInMainWorld('api', {
|
|
sources: {
|
|
list: () => ipcRenderer.invoke('sources:list'),
|
|
browse: (sourceId, page) => ipcRenderer.invoke('source:list', sourceId, page),
|
|
search: (sourceId, keyword, page) => ipcRenderer.invoke('source:search', sourceId, keyword, page),
|
|
detail: (sourceId, postId) => ipcRenderer.invoke('source:detail', sourceId, postId),
|
|
download: (sourceId, postId) => ipcRenderer.invoke('source:download', sourceId, postId)
|
|
},
|
|
library: {
|
|
list: () => ipcRenderer.invoke('library:list'),
|
|
get: (id) => ipcRenderer.invoke('library:get', id),
|
|
findBySource: (sourceId, postId) => ipcRenderer.invoke('library:findBySource', sourceId, postId),
|
|
add: (item) => ipcRenderer.invoke('library:add', item),
|
|
update: (id, patch) => ipcRenderer.invoke('library:update', id, patch),
|
|
remove: (id, deleteFiles) => ipcRenderer.invoke('library:remove', id, deleteFiles),
|
|
onChanged: (cb) => ipcRenderer.on('library:changed', () => cb())
|
|
},
|
|
downloadFile: (url, suggestName, entryId, extraHeaders) => ipcRenderer.invoke('download:file', url, suggestName, entryId, extraHeaders),
|
|
zlib: {
|
|
hasCreds: () => ipcRenderer.invoke('zlib:hasCreds'),
|
|
login: (email, password) => ipcRenderer.invoke('zlib:login', email, password),
|
|
logout: () => ipcRenderer.invoke('zlib:logout')
|
|
},
|
|
proxy: {
|
|
get: () => ipcRenderer.invoke('proxy:get'),
|
|
set: (url) => ipcRenderer.invoke('proxy:set', url)
|
|
},
|
|
pickFile: () => ipcRenderer.invoke('dialog:pickFile'),
|
|
openPath: (p) => ipcRenderer.invoke('shell:openPath', p),
|
|
showItem: (p) => ipcRenderer.invoke('shell:showItem', p),
|
|
openExternal: (url) => ipcRenderer.invoke('shell:openExternal', url),
|
|
copy: (text) => ipcRenderer.invoke('copy', text),
|
|
getVersion: () => ipcRenderer.invoke('app:version'),
|
|
minimize: () => ipcRenderer.send('win:minimize'),
|
|
maximize: () => ipcRenderer.send('win:maximize'),
|
|
close: () => ipcRenderer.send('win:close')
|
|
});
|