Codex/fix stock cache and packaging - #137
Open
jadonding wants to merge 41 commits into
Open
Conversation
…ing data structure and search functionality
- 添加 .nvmrc 文件,指定 Node.js版本为 12.16.3 - 改进股票代码输入提示和匹配逻辑,支持模糊搜索 - 优化股票代码列表的添加和更新逻辑,避免重复添加 - 新增 TO-DO LIST.md 文件,列出待实现功能
feature(config): # 添加配置导入导出功能 新增配置导入导出功能,便于用户管理和迁移应用配置。优化股票监控模块,确保状态更新逻辑更可靠,同时增强对配置文件读取和保存的容错性。修复了部分不必要的日志输出以改善调试体验。
将设置窗口的高度从630调整为680,并允许用户调整窗口大小以改善用户体验,同时保留窗口的最大化和最小化限制。
新增 `.vscode/tasks.json` 文件,添加构建和开发任务配置,支持通过 npm 快速构建和运行 Thief 项目。 同时: - 更新股票数据获取逻辑,新增迈瑞 API 支持,优化数据处理与错误修复。 - 增加基础股票数据作为备用,提升数据可靠性。 - 改进股票搜索功能,支持多匹配模式与更高效的缓存初始化。 - 新增测试脚本 `test-mairui-api.js` 用于验证迈瑞 API 的响应和数据处理。 这些改动优化了开发流程、构建效率和股票数据处理能力。
扩展股票代码交易所前缀逻辑,新增对北京交易所(新三板精选层)的支持,完善深圳交易所创业板的处理,提升代码适配性和可读性。
优化主进程与渲染进程之间颜色配置的同步逻辑,确保传递完整的颜色配置数据。 完善日志记录,便于调试和追踪颜色配置的更新过程。 为前端组件添加响应式更新与计算属性,提升样式更新的可靠性。
升级 pdfjs-dist 至 2.11.338 版本,并切换为 legacy 构建以兼容较旧的 Electron/Chromium 版本,避免使用 ES2021 语法。 同时通过 require 设置 worker 脚本路径以支持旧版打包器配置,在设置失败时提供无 worker 模式的降级处理,确保功能可用,但可能影响渲染性能。
first-buyer
- 新增 entitlements 配置文件以支持 hardened runtime - 新增 build:mac:universal 脚本支持通用二进制构建 - 新增 build:mac:local 脚本跳过签名/公证用于本地测试 - 更新 .npmrc 使用 npmmirror 镜像源 Co-Authored-By: Claude <noreply@anthropic.com>
feature(渲染器): 优化渲染器URL解析逻辑并增加股票搜索功能
fix: restore settings page and configure buy1 amount display
There was a problem hiding this comment.
Pull request overview
This PR modernizes the Electron/Vue app’s packaging/tooling while expanding stock features (stock cache refresh/search, profit display formatting, and limit-up monitoring), and adds a small node-based test suite to validate key utilities and build config assumptions.
Changes:
- Reworked stock utilities: caching/normalization, profit formatting, stock search, and added a new limit-up monitoring service with DingTalk notifications.
- Refactored configuration storage (migrating large stock cache to an external JSON file) and added config import/export.
- Updated build/packaging setup (Electron/dep upgrades, webpack adjustments, mac entitlements/notarization changes) and introduced node test scripts.
Reviewed changes
Copilot reviewed 35 out of 39 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| TO-DO LIST.md | Adds a small checklist for stock-related UI/formatting items. |
| test/stock-monitor.test.js | Tests stock monitor option wiring and parsing. |
| test/stock-format.test.js | Tests stock quote/profit formatting behavior. |
| test/stock-cache-fetch.test.js | Tests paged Eastmoney fetch and cache normalization/counting. |
| test/renderer-webpack-config.test.js | Ensures axios is bundled in renderer (not externalized). |
| test/display-text.test.js | Tests HTML stripping and tray-title ANSI formatting. |
| test/db-storage.test.js | Tests db migration of stock_code_mapping to external storage file. |
| test-mairui-api.js | Adds a manual script to test Mairui API responses. |
| src/renderer/utils/key.js | Removes unused electron.remote import. |
| src/renderer/utils/dialog.js | Switches renderer dialog helper to @electron/remote. |
| src/renderer/store/index.js | Removes persisted-state plugin; keeps shared mutations. |
| src/renderer/components/setting.vue | Major settings UI refactor: stock list editing/search, profit toggles, monitor toggles, import/export, layout changes. |
| src/renderer/components/pdf.vue | Switches to pdfjs legacy build and sets workerSrc defensively for older Chromium compatibility. |
| src/renderer/components/desktop.vue | Changes rendering to v-html and refactors color config updates received via IPC. |
| src/main/utils/test-limit-up-alert.js | Adds documentation-like test script for the limit-up alert feature. |
| src/main/utils/stockMonitor.js | Introduces a stock monitoring loop and analysis/alert logic. |
| src/main/utils/stock.js | Large rewrite: switches HTTP client, adds cache fetch/refresh/search, profit formatting, and more options. |
| src/main/utils/displayText.js | Adds HTML stripping + ANSI formatting for tray title rendering. |
| src/main/utils/dingtalk.js | Adds DingTalk webhook client + alert message formatter. |
| src/main/utils/db.js | Replaces lowdb with JSON-file storage + external storage for stock cache, plus import/export and reload. |
| src/main/utils/book.js | Makes book paging/reading async and adds file caching to avoid rereads. |
| src/main/utils/ad.js | Switches ad fetch from request-promise to axios. |
| src/main/index.js | Major main-process updates: remote main init, robust URL/static resolution, tray/icon handling, IPC for stock cache/search/config IO, and monitoring integration. |
| README.md | Documents a Node version (currently conflicting with .nvmrc). |
| package.json | Updates dependencies/build config, adds test scripts, and adjusts signing/notarization/build targets. |
| config/mac/entitlements.mac.plist | Adds macOS hardened runtime entitlements. |
| config/mac/entitlements.mac.inherit.plist | Adds inherited entitlements for child processes. |
| .vscode/tasks.json | Adds VS Code tasks for build/dev. |
| .nvmrc | Pins Node version. |
| .npmrc | Sets electron-builder binaries mirror. |
| .gitignore | Expands ignore patterns (node_modules, build artifacts, IDE files). |
| .electron-vue/webpack.web.config.js | Replaces Babili with Terser and modernizes loader options/devtool. |
| .electron-vue/webpack.renderer.config.js | Adjusts whitelist/externals behavior and loader option syntax; tweaks dev/prod plugins. |
| .electron-vue/webpack.main.config.js | Removes Babili and simplifies plugins. |
| .electron-vue/dev-runner.js | Updates dev-server/hot reload behavior. |
| .babelrc | Switches to Babel 7 preset-env config targeting Electron. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+44
to
+46
| limit_up_alert_enabled: true, | ||
| dingtalk_webhook: 'https://oapi.dingtalk.com/robot/send?access_token=075525de2be812c31c727e4ac783ed2969cf9c8e05974aa2db0d630ac88e95e2', | ||
| at_phone_numbers: ['17195252748'], |
Comment on lines
+218
to
+223
| try { | ||
| const response = await request | ||
| .get('https://api.mairuiapi.com/hslt/list/LICENCE-66D8-9F96-0C7F0FBCD073') | ||
| .timeout(30000) | ||
| .buffer(true) | ||
| .parse(request.parse.text); // 禁用自动JSON解析,作为文本处理 |
Comment on lines
+6
to
+11
| try { | ||
| const response = await request | ||
| .get('https://api.mairuiapi.com/hslt/list/LICENCE-66D8-9F96-0C7F0FBCD073') | ||
| .timeout(30000) | ||
| .buffer(true) | ||
| .parse(request.parse.text); // 禁用自动JSON解析 |
Comment on lines
1
to
5
| <template> | ||
| <el-container class="container" :style="color"> | ||
| <div class="text boss" v-if="is_boss"> | ||
| <span>{{text}}</span> | ||
| <span v-html="text"></span> | ||
| </div> |
Comment on lines
+396
to
+399
| } catch (error) { | ||
| console.log('eastmoney paged fetch failed:', error.message); | ||
| return 0; | ||
| } |
Comment on lines
+432
to
+435
| } catch (error) { | ||
| console.log('东方财富API失败:', error.message); | ||
| } | ||
| }, |
Comment on lines
+869
to
+873
| const options = profitOptions ? this.normalizeProfitOptions(profitOptions) : { stockColorMode: "none" }; | ||
| var text = stockName + ' ' + currPrice + "/" + percentage + "%"; | ||
| if (showBuy1Amount !== false) { | ||
| text = text + ' ' + buy1AmountText; | ||
| } |
| return; | ||
| } | ||
|
|
||
| console.log('检查股票:', stockCodes.map(s => s.code).join(',')); |
Comment on lines
+5
to
+9
| { | ||
| "targets": { | ||
| "electron": "33.2.1" | ||
| } | ||
| } |
Comment on lines
+47
to
+48
| - node版本: | ||
| - **`v12.16.3`** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.