增加windows下批量打包功能,修复批量打包后左上角icon均为微信读书的logo的bug

This commit is contained in:
Tlntin
2022-11-19 15:06:34 +08:00
parent c116082fa6
commit ef196d4659
8 changed files with 83 additions and 2 deletions

1
.gitignore vendored
View File

@@ -22,6 +22,7 @@ dist-ssr
*.sln
*.sw?
.npmrc
output
package-lock.json
yarn.lock

View File

@@ -88,6 +88,10 @@
此外还支持双击头部进行全屏切换,拖拽头部进行移动窗口,还有其他需求,欢迎提过来。
## 已知Bug
- Windows下不能安装到C:\Program File会直接闪退。建议安装到其他目录比如D:\Program Files。
- Linux下暂时不能存cookie即应用关闭后数据清空账号自动推出。
## 开发
开始前参考 [Tauri](https://tauri.app/v1/guides/getting-started/prerequisites#setting-up-macos) 快速配置好环境,如果你想打包 Windows、Linux 系统的包,可以参考 [Building](https://tauri.app/v1/guides/building/) 文档

View File

@@ -90,6 +90,10 @@ More common apps can be downloaded from [Releases](https://github.com/tw93/Pake/
In addition, it supports double clicking the head to switch to full screen, and dragging the head to move the window
## Bugs
- It cannot be installed to C:\Program File under Windows, and it will crash directly. It is recommended to install to another directory, such as D:\Program Files.
- Under Linux, cookies cannot be stored temporarily, that is, the data will be cleared after the application is closed, and the account will be automatically released.
## Development
Refer to the [Tauri documentation](https://tauri.app/v1/guides/getting-started/prerequisites#setting-up-macos) to quickly configure your environment before you start, if you want to package Windows or Linux systems, you can refer to [Building](https://tauri.app/v1/guides/building/) Documentation.

4
app.csv Normal file
View File

@@ -0,0 +1,4 @@
weread,微信阅读,weread.qq.com
aliyuque,语雀,www.yuque.com
flomo,浮墨,flomoapp.com
weread,微信阅读,weread.qq.com
1 weread 微信阅读 weread.qq.com
2 aliyuque 语雀 www.yuque.com
3 flomo 浮墨 flomoapp.com
4 weread 微信阅读 weread.qq.com

68
build.bat Normal file
View File

@@ -0,0 +1,68 @@
@echo off
chcp 65001
if not exist node_modules (
call npm i
)
if not exist output (
mkdir output
)
if not exist output\windows (
mkdir output\windows
)
echo.
echo =======================
echo "build for windows"
echo =======================
echo.
:: total package number
set /A index=1
set /A total=4
set old_name=weread
set old_zh_name=微信阅读
set old_url=weread.qq.com
for /f "tokens=1-3 delims=," %%i in (app.csv) do (
setlocal enabledelayedexpansion
set name=%%i
set name_zh=%%j
set url=%%k
@echo on
::echo name is !name! !name_zh! !url!
:: replace url
.\sd.exe !old_url! !url! src-tauri\tauri.conf.json
::replace pacakge name
.\sd.exe !old_name! !name! src-tauri\tauri.conf.json
echo update ico with 32x32 pictue
echo .\sd.exe !old_name! !name! src-tauri\src\main.rs
.\sd.exe !old_name! !name! src-tauri\src\main.rs
::copy src-tauri\png\!name!_32.ico src-tauri\icons\icon.ico
echo.
::update package info
set old_zh_name=!name_zh!
set old_name=!name!
set old_url=!url!
::build package
echo building package !index!/!total!
echo package name is !name! !name_zh!
echo npm run build:windows
@echo off
call npm run tauri build -- --target x86_64-pc-windows-msvc
move src-tauri\target\x86_64-pc-windows-msvc\release\bundle\msi\*.msi output\windows
@echo on
echo package build success!
echo.
echo.
set /A index=index+1
@echo off
)

BIN
sd.exe Normal file

Binary file not shown.

View File

@@ -122,7 +122,7 @@ fn main() -> wry::Result<()> {
})
.with_inner_size(wry::application::dpi::LogicalSize::new(width, height));
#[cfg(target_os = "windows")]
let icon_path = concat!(env!("CARGO_MANIFEST_DIR"), "/icons/icon.ico");
let icon_path = concat!(env!("CARGO_MANIFEST_DIR"), "/png/weread_32.ico");
#[cfg(target_os = "windows")]
let icon = load_icon(std::path::Path::new(icon_path));

View File

@@ -20,7 +20,7 @@
"bundle": {
"icon": [
"icons/weread.icns",
"icons/icon.ico",
"png/weread_32.ico",
"png/weread_512.png"
],
"identifier": "com.tw93.weread",