diff --git a/.gitignore b/.gitignore index 6f8dd99..1fc791f 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,9 @@ dist/cli.js *.sw? .npmrc output +*.msi +*.deb +*.dmg package-lock.json yarn.lock diff --git a/README.md b/README.md index 65fff7e..f59886a 100644 --- a/README.md +++ b/README.md @@ -144,14 +144,9 @@ npm i // 调试 npm run dev -// 打包 Mac 应用 -npm run build +// 打包应用 +npm run build:release -// 打包 Windows 应用 -npm run build:windows - -// 打包 Linux 应用 -npm run build:linux ``` ## 打新包 diff --git a/README_EN.md b/README_EN.md index 1b845dc..69bab05 100644 --- a/README_EN.md +++ b/README_EN.md @@ -143,14 +143,8 @@ npm i // Local development npm run dev -// Pack Mac application -npm run build - -// Pack Windows application -npm run build:windows - -// Pack Linux application -npm run build:linux +// Pack application +npm run build:release ``` diff --git a/app.csv b/app.csv index 0750cb5..adcc6d9 100644 --- a/app.csv +++ b/app.csv @@ -5,5 +5,5 @@ reference,Reference,Reference,https://wangchujiang.com/reference/index.html code,Code,Code,https://riju.codes/ yuque,YuQue,语雀,https://www.yuque.com/ flomo,Flomo,浮墨,https://flomoapp.com/mine -weread,WeRead,微信阅读,https://weread.qq.com/ qwerty,Qwerty,Qwerty,https://qwerty.kaiyi.cool/ +weread,WeRead,微信阅读,https://weread.qq.com/ diff --git a/bin/builders/BuilderFactory.ts b/bin/builders/BuilderFactory.ts index 908c78b..bec51fc 100644 --- a/bin/builders/BuilderFactory.ts +++ b/bin/builders/BuilderFactory.ts @@ -1,13 +1,17 @@ -import { IS_MAC } from '@/utils/platform.js'; +import { IS_MAC, IS_WIN } from '@/utils/platform.js'; import { IBuilder } from './base.js'; import MacBuilder from './MacBuilder.js'; import WinBuilder from './WinBulider.js'; export default class BuilderFactory { static create(): IBuilder { + console.log("now platform is ", process.platform); if (IS_MAC) { return new MacBuilder(); } - throw new Error('The current system does not support'); + if (IS_WIN) { + return new WinBuilder(); + } + throw new Error('The current system does not support!!'); } } diff --git a/bin/builders/MacBuilder.ts b/bin/builders/MacBuilder.ts index 4677eeb..057761f 100644 --- a/bin/builders/MacBuilder.ts +++ b/bin/builders/MacBuilder.ts @@ -6,7 +6,8 @@ import { PakeAppOptions } from '@/types.js'; import { IBuilder } from './base.js'; import { shellExec } from '@/utils/shell.js'; // @ts-expect-error 加上resolveJsonModule rollup会打包报错 -import tauriConf from '../../src-tauri/tauri.conf.json'; +// import tauriConf from '../../src-tauri/tauri.macos.conf.json'; +import tauriConf from './tauriConf.js'; import log from 'loglevel'; import { mergeTauriConfig } from './common.js'; import { npmDirectory } from '@/utils/dir.js'; @@ -39,10 +40,11 @@ export default class MacBuilder implements IBuilder { await mergeTauriConfig(url, options, tauriConf); - const code = await shellExec(`cd ${npmDirectory} && npm run build`); - const dmgName = `${name}_${tauriConf.package.version}_universal.dmg`; + const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build:release`); + const arch = process.arch; + const dmgName = `${name}_${tauriConf.package.version}_${arch}.dmg`; const appPath = this.getBuildedAppPath(npmDirectory, dmgName); - const distPath = path.resolve(`${name}_universal.dmg`); + const distPath = path.resolve(`${name}.dmg`); await fs.copyFile(appPath, distPath); await fs.unlink(appPath); @@ -53,7 +55,7 @@ export default class MacBuilder implements IBuilder { getBuildedAppPath(npmDirectory: string, dmgName: string) { return path.join( npmDirectory, - 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', + 'src-tauri/target/release/bundle/dmg', dmgName ); } diff --git a/bin/builders/WinBulider.ts b/bin/builders/WinBulider.ts index d67ee29..a6978b2 100644 --- a/bin/builders/WinBulider.ts +++ b/bin/builders/WinBulider.ts @@ -6,7 +6,9 @@ import { PakeAppOptions } from '@/types.js'; import { IBuilder } from './base.js'; import { shellExec } from '@/utils/shell.js'; // @ts-expect-error 加上resolveJsonModule rollup会打包报错 -import tauriConf from '../../src-tauri/tauri.conf.json'; +// import tauriConf from '../../src-tauri/tauri.windows.conf.json'; +import tauriConf from './tauriConf.js'; + import { fileURLToPath } from 'url'; import logger from '@/options/logger.js'; import { mergeTauriConfig } from './common.js'; @@ -41,19 +43,26 @@ export default class WinBuilder implements IBuilder { async build(url: string, options: PakeAppOptions) { logger.debug('PakeAppOptions', options); + const { name } = options; await mergeTauriConfig(url, options, tauriConf); - const code = await shellExec(`cd ${npmDirectory} && npm run build:windows`); - // const dmgName = `${name}_${tauriConf.package.version}_universal.dmg`; - // const appPath = this.getBuildedAppPath(npmDirectory, dmgName); - // await fs.copyFile(appPath, path.resolve(`${name}_universal.dmg`)); + const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build:release`); + const language = tauriConf.tauri.bundle.windows.wix.language[0]; + const arch = process.arch; + const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`; + const appPath = this.getBuildedAppPath(npmDirectory, msiName); + const distPath = path.resolve(`${name}.msi`); + await fs.copyFile(appPath, distPath); + await fs.unlink(appPath); + logger.success('Build success!'); + logger.success('You can find the app installer in', distPath); } getBuildedAppPath(npmDirectory: string, dmgName: string) { return path.join( npmDirectory, - 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', + 'src-tauri/target/release/bundle/msi', dmgName ); } diff --git a/bin/builders/common.ts b/bin/builders/common.ts index 7fced8b..14dc8e5 100644 --- a/bin/builders/common.ts +++ b/bin/builders/common.ts @@ -43,7 +43,7 @@ export async function mergeTauriConfig( tauriConf.tauri.bundle.icon = [options.icon]; - const configJsonPath = path.join(npmDirectory, 'src-tauri/tauri.conf.json'); + const configJsonPath = path.join(npmDirectory, 'src-tauri/tauri.conf.json') await fs.writeFile( configJsonPath, Buffer.from(JSON.stringify(tauriConf), 'utf-8') diff --git a/bin/builders/tauriConf.js b/bin/builders/tauriConf.js new file mode 100644 index 0000000..59ac59b --- /dev/null +++ b/bin/builders/tauriConf.js @@ -0,0 +1,21 @@ +import CommonConf from '../../src-tauri/tauri.conf.json'; +import WinConf from '../../src-tauri/tauri.windows.conf.json'; +import MacConf from '../../src-tauri/tauri.macos.conf.json'; + +let tauriConf = { + package: CommonConf.package, + tauri: CommonConf.tauri +} + +switch (process.arch) { + case "win32": { + tauriConf.tauri.bundle = WinConf.bundle; + break; + } + case "darwin": { + tauriConf.tauri.bundle = MacConf.bundle; + } +} +export default tauriConf; + + diff --git a/bin/cli.ts b/bin/cli.ts index 3e6490a..14a6d0e 100644 --- a/bin/cli.ts +++ b/bin/cli.ts @@ -8,7 +8,7 @@ import handleInputOptions from './options/index.js'; import BuilderFactory from './builders/BuilderFactory.js'; import { checkUpdateTips } from './helpers/updater.js'; // @ts-expect-error -import packageJson from '../../package.json'; +import packageJson from '../package.json'; import logger from './options/logger.js'; program.version(packageJson.version).description('A cli application can package a web page to desktop application.'); diff --git a/package.json b/package.json index 2e1d2b0..02ebe3d 100644 --- a/package.json +++ b/package.json @@ -23,9 +23,7 @@ "start": "npm run dev", "dev": "npm run tauri dev", "dev:debug": "npm run tauri dev -- --features devtools", - "build": "npm run tauri build -- --target universal-apple-darwin", - "build:windows": "npm run tauri build -- --target x86_64-pc-windows-msvc", - "build:linux": "npm run tauri build --release", + "build:release": "npm run tauri build --release", "build:all-unix": "chmod +x ./script/build.sh && ./script/build.sh", "build:all-windows": ".\\script\\build.bat", "tauri": "tauri", @@ -68,6 +66,6 @@ "cross-env": "^7.0.3", "rollup": "^3.3.0", "tslib": "^2.4.1", - "typescript": "^4.8.4" + "typescript": "^4.9.3" } } diff --git a/script/build.bat b/script/build.bat index 1137d95..c510081 100644 --- a/script/build.bat +++ b/script/build.bat @@ -31,8 +31,14 @@ set old_title=WeRead set old_zh_name=微信阅读 set old_url=https://weread.qq.com/ +:: set init name, we will recovery code to init when build finish. +set init_name=%old_name% +set init_title=%old_title% +set init_zh_name=%old_zh_name% +set init_url=%old_url% + :: for windows, we need replace package name to title -.\script\sd.exe "\"productName\": \"weread\"" "\"productName\": \"WeRead\"" src-tauri\tauri.conf.json +:: .\script\sd.exe "\"productName\": \"weread\"" "\"productName\": \"WeRead\"" src-tauri\tauri.conf.json for /f "skip=1 tokens=1-4 delims=," %%i in (app.csv) do ( setlocal enabledelayedexpansion @@ -47,10 +53,10 @@ for /f "skip=1 tokens=1-4 delims=," %%i in (app.csv) do ( .\script\sd.exe !old_url! !url! src-tauri\tauri.conf.json ::replace pacakge name .\script\sd.exe !old_title! !title! src-tauri\tauri.conf.json - .\script\sd.exe !old_name! !name! src-tauri\tauri.conf.json + .\script\sd.exe !old_name! !name! src-tauri\tauri.windows.conf.json echo update ico with 32x32 pictue .\script\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! @@ -86,3 +92,9 @@ for /f "skip=1 tokens=1-4 delims=," %%i in (app.csv) do ( :: for windows, we need replace package name to lower again :: .\script\sd.exe "\"productName\": \"WeRead\"" "\"productName\": \"weread\"" src-tauri\tauri.conf.json echo "output dir is output\windows" + +::recovery code +.\script\sd.exe %url% %init_url% src-tauri\tauri.conf.json +.\script\sd.exe %title% %init_title% src-tauri\tauri.conf.json +.\script\sd.exe %name% %init_name% src-tauri\tauri.windows.conf.json +.\script\sd.exe %name% %init_name% src-tauri\src\main.rs diff --git a/script/build.sh b/script/build.sh index 95e5ca9..36f71ad 100755 --- a/script/build.sh +++ b/script/build.sh @@ -34,6 +34,13 @@ old_zh_name="微信阅读" old_url="https://weread.qq.com/" package_prefix="com-tw93" + +# set init name, we will recovery code to init when build finish. +export init_name=${old_name} +export init_title=${old_title} +export init_zh_name=${old_zh_name} +export init_url=${old_url} + if [[ "$OSTYPE" =~ ^linux ]]; then echo "===============" echo "Build for Linux" @@ -73,6 +80,7 @@ do # for apple, need replace title if [[ "$OSTYPE" =~ ^darwin ]]; then + $sd "${old_name}" "${package_name}" src-tauri/tauri.macos.conf.json $sd "${old_title}" "${package_title}" src-tauri/tauri.conf.json fi @@ -80,6 +88,7 @@ do # cp "src-tauri/png/${package_name}_32.ico" "src-tauri/icons/icon.ico" if [[ "$OSTYPE" =~ ^linux ]]; then + $sd "${old_name}" "${package_name}" src-tauri/tauri.linux.conf.json echo "update desktop" old_desktop="src-tauri/assets/${package_prefix}-${old_name}.desktop" new_desktop="src-tauri/assets/${package_prefix}-${package_name}.desktop" @@ -115,12 +124,20 @@ done echo "build all package success!" if [[ "$OSTYPE" =~ ^linux ]]; then -$sd "\"productName\": \"com-tw93-weread\"" "\"productName\": \"WeRead\"" src-tauri/tauri.conf.json + # recovery linux code + $sd "\"productName\": \"com-tw93-weread\"" "\"productName\": \"WeRead\"" src-tauri/tauri.conf.json + $sd "${package_name}" "${init_name}" src-tauri/tauri.linux.conf.json echo "result file in output/linux" fi if [[ "$OSTYPE" =~ ^darwin ]]; then - # replace again + # recovery macos code $sd "\"productName\": \"weread\"" "\"productName\": \"WeRead\"" src-tauri/tauri.conf.json + $sd "${package_name}" "${init_name}" src-tauri/tauri.macos.conf.json echo "result file in output/macos" fi + +# recovery code +$sd "${url}" "${init_url}" src-tauri/tauri.conf.json +$sd ${package_name}" "${init_name}" src-tauri/tauri.conf.json +$sd ${package_name}" "${init_name}" src-tauri/src/main.rs \ No newline at end of file diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 9cc86ca..2aa29d5 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -76,22 +76,6 @@ dependencies = [ "system-deps 6.0.3", ] -[[package]] -name = "attohttpc" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fcf00bc6d5abb29b5f97e3c61a90b6d3caa12f3faf897d4a3e3607c050a35a7" -dependencies = [ - "flate2", - "http", - "log", - "native-tls", - "serde", - "serde_json", - "serde_urlencoded", - "url", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -514,17 +498,6 @@ dependencies = [ "syn", ] -[[package]] -name = "dbus" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f8bcdd56d2e5c4ed26a529c5a9029f5db8290d433497506f958eae3be148eb6" -dependencies = [ - "libc", - "libdbus-sys", - "winapi", -] - [[package]] name = "derive_more" version = "0.99.17" @@ -660,7 +633,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -1382,15 +1355,6 @@ version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" -[[package]] -name = "libdbus-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c185b5b7ad900923ef3a8ff594083d4d9b5aea80bb4f32b8342363138c0d456b" -dependencies = [ - "pkg-config", -] - [[package]] name = "line-wrap" version = "0.1.1" @@ -1440,19 +1404,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" -[[package]] -name = "mac-notification-sys" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e72d50edb17756489e79d52eb146927bec8eba9dd48faadf9ef08bca3791ad5" -dependencies = [ - "cc", - "dirs-next", - "objc-foundation", - "objc_id", - "time", -] - [[package]] name = "malloc_buf" version = "0.0.6" @@ -1533,24 +1484,6 @@ dependencies = [ "getrandom 0.2.8", ] -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "ndk" version = "0.6.0" @@ -1591,17 +1524,6 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -[[package]] -name = "notify-rust" -version = "4.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368e89ea58df747ce88be669ae44e79783c1d30bfd540ad0fc520b3f41f0b3b0" -dependencies = [ - "dbus", - "mac-notification-sys", - "tauri-winrt-notification", -] - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1683,17 +1605,6 @@ dependencies = [ "objc_exception", ] -[[package]] -name = "objc-foundation" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" -dependencies = [ - "block", - "objc", - "objc_id", -] - [[package]] name = "objc_exception" version = "0.1.2" @@ -1718,82 +1629,6 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" -[[package]] -name = "open" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2078c0039e6a54a0c42c28faa984e115fb4c2d5bf2208f77d1961002df8576f8" -dependencies = [ - "pathdiff", - "windows-sys 0.42.0", -] - -[[package]] -name = "openssl" -version = "0.10.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020433887e44c27ff16365eaa2d380547a94544ad509aff6eb5b6e3e0b27b376" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07d5c8cb6e57b3a3612064d7b18b117912b4ce70955c2504d4b741c9e244b132" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "os_info" -version = "3.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4750134fb6a5d49afc80777394ad5d95b04bc12068c6abb92fae8f43817270f" -dependencies = [ - "log", - "serde", - "winapi", -] - -[[package]] -name = "os_pipe" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6a252f1f8c11e84b3ab59d7a488e48e4478a93937e027076638c49536204639" -dependencies = [ - "libc", - "windows-sys 0.42.0", -] - [[package]] name = "overload" version = "0.1.1" @@ -1845,7 +1680,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -1854,12 +1689,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" -[[package]] -name = "pathdiff" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" - [[package]] name = "percent-encoding" version = "2.2.0" @@ -2100,15 +1929,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "quick-xml" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11bafc859c6815fbaffbbbf4229ecb767ac913fecb27f9ad4343662e9ef099ea" -dependencies = [ - "memchr", -] - [[package]] name = "quote" version = "1.0.21" @@ -2286,30 +2106,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rfd" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0149778bd99b6959285b0933288206090c50e2327f47a9c463bfdbf45c8823ea" -dependencies = [ - "block", - "dispatch", - "glib-sys", - "gobject-sys", - "gtk-sys", - "js-sys", - "lazy_static", - "log", - "objc", - "objc-foundation", - "objc_id", - "raw-window-handle", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "windows 0.37.0", -] - [[package]] name = "rustc_version" version = "0.3.3" @@ -2355,16 +2151,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "schannel" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" -dependencies = [ - "lazy_static", - "windows-sys 0.36.1", -] - [[package]] name = "scoped-tls" version = "1.0.1" @@ -2383,29 +2169,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "security-framework" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "selectors" version = "0.22.0" @@ -2495,18 +2258,6 @@ dependencies = [ "syn", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa 1.0.4", - "ryu", - "serde", -] - [[package]] name = "serde_with" version = "1.14.0" @@ -2581,16 +2332,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shared_child" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "siphasher" version = "0.3.10" @@ -2696,27 +2437,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "strum" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7ac893c7d471c8a21f31cfe213ec4f6d9afeed25537c772e08ef3f005f8729e" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339f799d8b549e3744c7ac7feb216383e4005d94bdb22561b3ab8f3b808ae9fb" -dependencies = [ - "heck 0.3.3", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "syn" version = "1.0.104" @@ -2864,7 +2584,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18203448b9d4dcad55607eafeda6dc7fe135848e5f567cd8bdade6cafd8b1a85" dependencies = [ "anyhow", - "attohttpc", "cocoa", "dirs-next", "embed_plist", @@ -2877,23 +2596,16 @@ dependencies = [ "heck 0.4.0", "http", "ignore", - "notify-rust", "objc", "once_cell", - "open", - "os_info", - "os_pipe", "percent-encoding", "rand 0.8.5", "raw-window-handle", - "regex", - "rfd", "semver 1.0.14", "serde", "serde_json", "serde_repr", "serialize-to-javascript", - "shared_child", "state", "tar", "tauri-macros", @@ -2940,7 +2652,6 @@ dependencies = [ "png", "proc-macro2", "quote", - "regex", "semver 1.0.14", "serde", "serde_json", @@ -3034,17 +2745,6 @@ dependencies = [ "windows 0.39.0", ] -[[package]] -name = "tauri-winrt-notification" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58de036c4d2e20717024de2a3c4bf56c301f07b21bc8ef9b57189fce06f1f3b" -dependencies = [ - "quick-xml", - "strum", - "windows 0.39.0", -] - [[package]] name = "tempfile" version = "3.3.0" @@ -3338,12 +3038,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version-compare" version = "0.0.11" @@ -3410,18 +3104,6 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.83" @@ -3618,19 +3300,6 @@ dependencies = [ "windows_x86_64_msvc 0.32.0", ] -[[package]] -name = "windows" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647" -dependencies = [ - "windows_aarch64_msvc 0.37.0", - "windows_i686_gnu 0.37.0", - "windows_i686_msvc 0.37.0", - "windows_x86_64_gnu 0.37.0", - "windows_x86_64_msvc 0.37.0", -] - [[package]] name = "windows" version = "0.39.0" @@ -3671,19 +3340,6 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ee5e275231f07c6e240d14f34e1b635bf1faa1c76c57cfd59a5cdb9848e4278" -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - [[package]] name = "windows-sys" version = "0.42.0" @@ -3717,18 +3373,6 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a" - [[package]] name = "windows_aarch64_msvc" version = "0.39.0" @@ -3747,18 +3391,6 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_gnu" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1" - [[package]] name = "windows_i686_gnu" version = "0.39.0" @@ -3777,18 +3409,6 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_i686_msvc" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c" - [[package]] name = "windows_i686_msvc" version = "0.39.0" @@ -3807,18 +3427,6 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d" - [[package]] name = "windows_x86_64_gnu" version = "0.39.0" @@ -3843,18 +3451,6 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d" - [[package]] name = "windows_x86_64_msvc" version = "0.39.0" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index b64ef54..f9a5cb4 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -17,7 +17,7 @@ tauri-build = { version = "1.2.1", features = [] } [dependencies] serde_json = "1.0.88" serde = { version = "1.0.147", features = ["derive"] } -tauri = { version = "1.2.1", features = ["api-all"] } +tauri = { version = "1.2.1", features = [] } image = "0.24.5" tauri-utils = "1.2.1" webbrowser = "0.8.2" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 02499b7..298cff6 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -14,56 +14,6 @@ "resizable": true } ], - "allowlist": { - "all": true - }, - "bundle": { - "icon": [ - "icons/weread.icns", - "png/weread_256.ico", - "png/weread_32.ico", - "png/weread_512.png" - ], - "identifier": "com.tw93.weread", - "active": true, - "category": "DeveloperTool", - "copyright": "", - "deb": { - "depends": [ - "libwebkit2gtk-4.0-dev", - "build-essential", - "curl", - "wget", - "libssl-dev", - "libgtk-3-dev", - "libayatana-appindicator3-dev", - "librsvg2-dev" - ], - "files": { - "/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop" - } - }, - "externalBin": [], - "longDescription": "", - "macOS": { - "entitlements": null, - "exceptionDomain": "", - "frameworks": [], - "providerShortName": null, - "signingIdentity": null - }, - "resources": ["png/weread_32.ico"], - "shortDescription": "", - "targets": ["deb", "msi", "dmg"], - "windows": { - "certificateThumbprint": null, - "digestAlgorithm": "sha256", - "timestampUrl": "", - "wix": { - "language": ["en-US"] - } - } - }, "security": { "csp": null }, diff --git a/src-tauri/tauri.conf.json.bak b/src-tauri/tauri.conf.json.bak new file mode 100644 index 0000000..298cff6 --- /dev/null +++ b/src-tauri/tauri.conf.json.bak @@ -0,0 +1,30 @@ +{ + "package": { + "productName": "WeRead", + "version": "1.0.0" + }, + "tauri": { + "windows": [ + { + "url": "https://weread.qq.com/", + "transparent": true, + "fullscreen": false, + "width": 1200, + "height": 728, + "resizable": true + } + ], + "security": { + "csp": null + }, + "updater": { + "active": false + } + }, + "build": { + "devPath": "../dist", + "distDir": "../dist", + "beforeBuildCommand": "", + "beforeDevCommand": "" + } +} diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json new file mode 100644 index 0000000..3235abd --- /dev/null +++ b/src-tauri/tauri.linux.conf.json @@ -0,0 +1,34 @@ +{ + "tauri": { + "bundle": { + "icon": [ + "png/weread_256.ico", + "png/weread_512.png" + ], + "identifier": "com.tw93.weread", + "active": true, + "category": "DeveloperTool", + "copyright": "", + "deb": { + "depends": [ + "libwebkit2gtk-4.0-dev", + "build-essential", + "curl", + "wget", + "libssl-dev", + "libgtk-3-dev", + "libayatana-appindicator3-dev", + "librsvg2-dev" + ], + "files": { + "/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop" + } + }, + "externalBin": [], + "longDescription": "", + "resources": [], + "shortDescription": "", + "targets": ["deb"] + } + } +} diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.json new file mode 100644 index 0000000..5b09612 --- /dev/null +++ b/src-tauri/tauri.macos.conf.json @@ -0,0 +1,25 @@ +{ + "tauri": { + "bundle": { + "icon": [ + "icons/weread.icns" + ], + "identifier": "com.tw93.weread", + "active": true, + "category": "DeveloperTool", + "copyright": "", + "externalBin": [], + "longDescription": "", + "macOS": { + "entitlements": null, + "exceptionDomain": "", + "frameworks": [], + "providerShortName": null, + "signingIdentity": null + }, + "resources": [], + "shortDescription": "", + "targets": ["dmg"] + } + } +} diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json new file mode 100644 index 0000000..357f830 --- /dev/null +++ b/src-tauri/tauri.windows.conf.json @@ -0,0 +1,27 @@ +{ + "tauri": { + "bundle": { + "icon": [ + "png/weread_256.ico", + "png/weread_32.ico" + ], + "identifier": "com.tw93.weread", + "active": true, + "category": "DeveloperTool", + "copyright": "", + "externalBin": [], + "longDescription": "", + "resources": ["png/weread_32.ico"], + "shortDescription": "", + "targets": ["msi"], + "windows": { + "certificateThumbprint": null, + "digestAlgorithm": "sha256", + "timestampUrl": "", + "wix": { + "language": ["en-US"] + } + } + } + } +}