feat: add desktop build icon embedding and release download entry#1720
feat: add desktop build icon embedding and release download entry#1720alanbulan wants to merge 5 commits intorouter-for-me:mainfrom
Conversation
Use CLIProxyAPI.png as the desktop icon source during desktop build/upgrade, publish a Windows desktop executable in release workflow, and expose desktop download links in docs and system quick links.
Summary of ChangesHello @alanbulan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the CLIProxyAPI project by introducing a fully functional desktop version for Windows. It streamlines the development and distribution process by automating builds, ensuring proper branding with embedded icons, and integrating the desktop executable into the existing release pipeline. Furthermore, it improves user experience by making the desktop application easily discoverable through updated documentation and management interfaces, providing a more accessible way to interact with the API. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Ignored Files
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
请提前发送5个同学或者是5群聊 关注公众号:高中文案会 截图,否则拒收,毕竟我一分钱也不收,最起码要一点回报。
|
There was a problem hiding this comment.
Code Review
This pull request introduces a desktop version of the application using Wails, which is a significant new feature. The changes include build scripts, the desktop application's Go source code, and an auto-update mechanism. The implementation is comprehensive, but I have identified a few areas for improvement, particularly concerning the design of the auto-updater, a hardcoded port in the frontend, and hardcoded UI strings. My review includes a critical comment on the update mechanism's design, which is not suitable for end-users.
| func (a *App) checkForUpdates() { | ||
| root := findProjectRoot() | ||
| if root == "" { | ||
| log.Debug("updater: project root not found, skip update check") | ||
| return | ||
| } |
There was a problem hiding this comment.
The current auto-update mechanism, which uses findProjectRoot to locate a .git directory and then runs git pull to rebuild the application from source, is designed for a development environment. This approach is not suitable for a distributable desktop application released to end-users, as they are not expected to have git, go, and the full toolchain installed.
A more standard and user-friendly approach for desktop application updates would be to:
- Check for a new version tag on GitHub Releases.
- If a new version is available, download the pre-compiled
.exeasset for Windows. - Replace the current executable with the new one.
This would provide a seamless update experience for all users, not just developers who have cloned the repository.
cmd/desktop/frontend/src/main.js
Outdated
| const port = 8317; | ||
| window.location.href = `http://127.0.0.1:${port}/management.html`; |
There was a problem hiding this comment.
The port 8317 is hardcoded in the frontend JavaScript. The backend allows users to configure a different port in config.yaml. If a user changes the port, the frontend will fail to redirect to the management panel because it will still be trying to connect to 127.0.0.1:8317.
The port should be dynamically provided by the Go backend to the frontend. You can achieve this by binding a Go method to the frontend.
For example:
- In
cmd/desktop/app.go, add the configured port to yourAppstruct and expose it via a new method:type App struct { // ... serverPort int } func (a *App) GetServerPort() int { return a.serverPort } func (a *App) startup(ctx context.Context) { // ... a.serverPort = cfg.Port // ... }
- In
cmd/desktop/frontend/src/main.js, call this new method to get the port:import { GetServerPort } from '../wailsjs/go/main/App'; GetServerPort().then(port => { window.location.href = `http://127.0.0.1:${port}/management.html`; });
This will make your desktop app respect the user's configuration.
| result, err := wailsRuntime.MessageDialog(a.ctx, wailsRuntime.MessageDialogOptions{ | ||
| Type: wailsRuntime.QuestionDialog, | ||
| Title: "CLIProxyAPI 更新", | ||
| Message: msg, | ||
| Buttons: []string{"立即升级", "跳过"}, | ||
| DefaultButton: "立即升级", | ||
| CancelButton: "跳过", | ||
| }) | ||
| if err != nil || (result != "Yes" && result != "立即升级") { | ||
| log.Infof("updater: user skipped update (result=%q)", result) | ||
| return | ||
| } |
There was a problem hiding this comment.
The update confirmation dialog uses hardcoded Chinese strings for the title and buttons ("CLIProxyAPI 更新", "立即升级", "跳过"). This is not ideal for non-Chinese speaking users. For better internationalization, consider using English strings as a default or implementing a localization mechanism.
| result, err := wailsRuntime.MessageDialog(a.ctx, wailsRuntime.MessageDialogOptions{ | |
| Type: wailsRuntime.QuestionDialog, | |
| Title: "CLIProxyAPI 更新", | |
| Message: msg, | |
| Buttons: []string{"立即升级", "跳过"}, | |
| DefaultButton: "立即升级", | |
| CancelButton: "跳过", | |
| }) | |
| if err != nil || (result != "Yes" && result != "立即升级") { | |
| log.Infof("updater: user skipped update (result=%q)", result) | |
| return | |
| } | |
| result, err := wailsRuntime.MessageDialog(a.ctx, wailsRuntime.MessageDialogOptions{ | |
| Type: wailsRuntime.QuestionDialog, | |
| Title: "CLIProxyAPI Update", | |
| Message: msg, | |
| Buttons: []string{"Upgrade Now", "Skip"}, | |
| DefaultButton: "Upgrade Now", | |
| CancelButton: "Skip", | |
| }) | |
| if err != nil || result != "Upgrade Now" { | |
| log.Infof("updater: user skipped update (result=%q)", result) | |
| return | |
| } |
Use neutral English update dialog strings and harden the update flow guards while keeping the current developer-oriented update path. Keep desktop launcher redirect behavior explicit and avoid introducing broken dynamic bindings in this patch.
Add toolchain presence checks before desktop source updates and make the update dialog explicit that upgrade requires git/go/wails on the local machine.
Rewrite upgrade-desktop.ps1 with UTF-8 BOM so Windows PowerShell parses Chinese strings and regex literals correctly during in-app upgrade execution.
Support quoted/unquoted proxy-url values with optional inline comments and keep localized log messages while preserving PowerShell parser compatibility.
Summary
CLIProxyAPI.pngintocmd/desktop/build/appicon.pngbeforewails build, and regeneratewindows/icon.icoto keep exe/taskbar/window icon source consistentCLIProxyAPI-desktop-windows-amd64-<tag>.exe) on tag releasescmd/desktoprequired for desktop packaging flowTest plan
npm --prefix management-center run type-checkbuild-desktop.ps1in a clean Windows environment and confirm icon consistency (desktop shortcut + app window icon)