diff --git a/.github/workflows/pake-cli.yaml b/.github/workflows/pake-cli.yaml index 64b7674..2ee06e3 100644 --- a/.github/workflows/pake-cli.yaml +++ b/.github/workflows/pake-cli.yaml @@ -83,7 +83,7 @@ jobs: profile: minimal override: true target: x86_64-unknown-linux-musl - + - name: Install Rust for windows-latest if: inputs.platform == 'windows-latest' uses: actions-rs/toolchain@v1 @@ -92,7 +92,7 @@ jobs: profile: minimal override: true target: x86_64-pc-windows-msvc - + - name: Install Rust for macos-latest if: inputs.platform == 'macos-latest' uses: actions-rs/toolchain@v1 @@ -101,20 +101,20 @@ jobs: profile: minimal override: true target: x86_64-apple-darwin - + - name: install dependencies (ubuntu only) if: inputs.platform == 'ubuntu-20.04' uses: awalsh128/cache-apt-pkgs-action@latest with: packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra version: 1.1 - + - name: install pake-cli local shell: bash - run: | + run: | echo "install pake on local" npm install pake-cli - + - name: rust cache restore uses: actions/cache/restore@v3 with: @@ -128,7 +128,7 @@ jobs: - name: build with pake-cli shell: pwsh - run: | + run: | pwsh ./script/build_with_pake_cli.ps1 env: URL: ${{ inputs.url }} @@ -148,7 +148,7 @@ jobs: name: output-${{ inputs.platform }}.zip path: node_modules/pake-cli/output/* retention-days: 3 - + - name: rust cache store uses: actions/cache/save@v3 with: diff --git a/.gitignore b/.gitignore index a44b4ff..5a40405 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,9 @@ output package-lock.json yarn.lock pnpm-lock.yaml -dist/ +dist +!dist/about_pake.html !dist/cli.js !dist/.gitkeep -.next/ +src-tauri/.cargo/config +.next diff --git a/bin/README.md b/bin/README.md index 8db03ec..23809be 100644 --- a/bin/README.md +++ b/bin/README.md @@ -48,7 +48,7 @@ pake url [options] ### url -url 为你需要打包的网页链接 🔗,必须提供。 +url 为你需要打包的网页链接 🔗 或者本地 html 文件,必须提供。 ### [options] @@ -100,32 +100,66 @@ url 为你需要打包的网页链接 🔗,必须提供。 #### [transparent] -是否开启沉浸式头部,默认为 `false` 不开启。使用下面的命令来开启该功能。 +是否开启沉浸式头部,默认为 `false` 不开启,输入下面的命令则开启沉浸式,推荐 MacOS 用户开启。 ```shell --transparent -# 或者 --t -``` - -#### [fullscreen] - -打开应用后是否开启全屏,默认为 `false`,使用下面的命令开启该功能。 - -```shell ---fullscreen -# 或者 --f ``` #### [resize] -是否可以拖动大小,默认为 `true` 可拖动。使用下面的命令来关闭该功能。 +是否可以拖动大小,默认为 `true` 可拖动,输入下面的命令则不能对窗口大小进行拉伸。 ```shell --no-resizable -# 或者 --r +``` + +#### [fullscreen] + +打开应用后是否开启全屏,默认为 `false`,输入下面的命令则会自动全屏。 + +```shell +--fullscreen +``` + +#### [user-agent] + +自定义浏览器请求头, 默认为空。 + +```shell +--user-agent +``` + +#### [show-menu] + +显示菜单栏, 默认不显示,输入下面的命令则会显示,推荐 MacOS 用户开启。 + +```shell +--show-menu +``` + +#### [show-system-tray] + +显示通知栏托盘, 默认不显示,输入下面的命令则会显示。 + +```shell +--show-system-tray +``` + +#### [system-tray-icon] + +通知栏托盘图标,仅当显示通知栏托盘时有效, 图标必须为.ico 或者.png 格式的,512\*512 像素的图片。 + +```shell +--system-tray-icon +``` + +#### [copy-iter-file] + +递归拷贝,当 url 为本地文件路径时候,若开启该选项,则将 url 路径文件所在文件夹以及所有子文件都拷贝到 pake 静态文件夹,默认不开启 + +```shell +--copy-iter-file ``` #### [multi-arch] @@ -157,7 +191,7 @@ rustup target add x86_64-apple-darwin #### [targets] -选择输出的包格式,支持deb/appimage/all,如果选择all,则同时打包deb和appimage,该选项仅支持Linux,默认为`all`。 +选择输出的包格式,支持 deb/appimage/all,如果选择 all,则同时打包 deb 和 appimage,该选项仅支持 Linux,默认为`all`。 ```shell --targets xxx diff --git a/bin/README_EN.md b/bin/README_EN.md index b0e4859..5c1bda1 100644 --- a/bin/README_EN.md +++ b/bin/README_EN.md @@ -130,6 +130,46 @@ Use the command below to disable this feature. -r ``` +#### [user-agent] + +Custom browser user agent, default is empty. + +```shell +--user-agent +``` + +#### [show-menu] + +Display the menu bar, not display it by default, enter the following command and it will be displayed. MacOS users are recommended to enable. + +```shell +--show-menu +``` + +#### [show-system-tray] + +Display the notification tray, not display it by default, entering the following command will display. + +```shell +--show-system-tray +``` + +#### [system-tray-icon] + +The notification tray icon is only valid when the notification tray is displayed. The icon must be a 512\*512 pixel image in .ico or .png format. + +```shell +--system-tray-icon +``` + +#### [copy-iter-file] + +Recursive copy, when the url is a local file path, if this option is enabled, the folder where the url path file is located and all sub-files are copied to the pake static folder, which is not enabled by default + +```shell +--copy-iter-file +``` + #### [multi-arch] Package results support both Intel and m1 chips, only for MacOS. The default is `false`. diff --git a/bin/builders/LinuxBuilder.ts b/bin/builders/LinuxBuilder.ts index 178a091..ef2557d 100644 --- a/bin/builders/LinuxBuilder.ts +++ b/bin/builders/LinuxBuilder.ts @@ -5,6 +5,7 @@ import { checkRustInstalled, installRust } from '@/helpers/rust.js'; import { PakeAppOptions } from '@/types.js'; import { IBuilder } from './base.js'; import { shellExec } from '@/utils/shell.js'; +import {isChinaDomain} from '@/utils/ip_addr.js'; // @ts-expect-error 加上resolveJsonModule rollup会打包报错 // import tauriConf from '../../src-tauri/tauri.windows.conf.json'; import tauriConf from './tauriConf.js'; @@ -44,10 +45,22 @@ export default class LinuxBuilder implements IBuilder { async build(url: string, options: PakeAppOptions) { logger.debug('PakeAppOptions', options); const { name } = options; - await mergeTauriConfig(url, options, tauriConf); - await shellExec(`cd "${npmDirectory}" && npm install --verbose && npm run build`); + const isChina = isChinaDomain("www.npmjs.com") + if (isChina) { + // crates.io也顺便换源 + const rust_project_dir = path.join(npmDirectory, 'src-tauri', ".cargo"); + const project_cn_conf = path.join(rust_project_dir, "cn_config.bak"); + const project_conf = path.join(rust_project_dir, "config"); + fs.copyFile(project_cn_conf, project_conf); + + const _ = await shellExec( + `cd ${npmDirectory} && npm install --registry=https://registry.npmmirror.com && npm run build` + ); + } else { + const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`); + } let arch: string; if (process.arch === "x64") { arch = "amd64"; diff --git a/bin/builders/MacBuilder.ts b/bin/builders/MacBuilder.ts index 6de28eb..5a0fca7 100644 --- a/bin/builders/MacBuilder.ts +++ b/bin/builders/MacBuilder.ts @@ -11,6 +11,7 @@ import tauriConf from './tauriConf.js'; import log from 'loglevel'; import { mergeTauriConfig } from './common.js'; import { npmDirectory } from '@/utils/dir.js'; +import {isChinaDomain} from '@/utils/ip_addr.js'; import logger from '@/options/logger.js'; export default class MacBuilder implements IBuilder { @@ -41,10 +42,30 @@ export default class MacBuilder implements IBuilder { await mergeTauriConfig(url, options, tauriConf); let dmgName: string; if (options.multiArch) { - await shellExec(`cd "${npmDirectory}" && npm install --verbose && npm run build:mac`); + const isChina = isChinaDomain("www.npmjs.com") + if (isChina) { + // crates.io也顺便换源 + const rust_project_dir = path.join(npmDirectory, 'src-tauri', ".cargo"); + const project_cn_conf = path.join(rust_project_dir, "cn_config.bak"); + const project_conf = path.join(rust_project_dir, "config"); + fs.copyFile(project_cn_conf, project_conf); + + const _ = await shellExec( + `cd ${npmDirectory} && npm install --registry=https://registry.npmmirror.com && npm run build:mac` + ); + } else { + const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build:mac`); + } dmgName = `${name}_${tauriConf.package.version}_universal.dmg`; } else { - await shellExec(`cd "${npmDirectory}" && npm install --verbose && npm run build`); + const isChina = isChinaDomain("www.npmjs.com") + if (isChina) { + const _ = await shellExec( + `cd ${npmDirectory} && npm install --registry=https://registry.npmmirror.com && npm run build` + ); + } else { + const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`); + } let arch = "x64"; if (process.arch === "arm64") { arch = "aarch64"; diff --git a/bin/builders/WinBulider.ts b/bin/builders/WinBulider.ts index ede652c..b5b5eff 100644 --- a/bin/builders/WinBulider.ts +++ b/bin/builders/WinBulider.ts @@ -11,6 +11,7 @@ import tauriConf from './tauriConf.js'; import logger from '@/options/logger.js'; import { mergeTauriConfig } from './common.js'; import { npmDirectory } from '@/utils/dir.js'; +import {isChinaDomain} from '@/utils/ip_addr.js'; export default class WinBuilder implements IBuilder { async prepare() { @@ -45,7 +46,20 @@ export default class WinBuilder implements IBuilder { await mergeTauriConfig(url, options, tauriConf); - await shellExec(`cd "${npmDirectory}" && npm install --verbose && npm run build`); + const isChina = isChinaDomain("www.npmjs.com") + if (isChina) { + // crates.io也顺便换源 + const rust_project_dir = path.join(npmDirectory, 'src-tauri', ".cargo"); + const project_cn_conf = path.join(rust_project_dir, "cn_config.bak"); + const project_conf = path.join(rust_project_dir, "config"); + fs.copyFile(project_cn_conf, project_conf); + + const _ = await shellExec( + `cd ${npmDirectory} && npm install --registry=https://registry.npmmirror.com && npm run build` + ); + } else { + const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`); + } const language = tauriConf.tauri.bundle.windows.wix.language[0]; const arch = process.arch; const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`; diff --git a/bin/builders/common.ts b/bin/builders/common.ts index 870a53c..c4b4144 100644 --- a/bin/builders/common.ts +++ b/bin/builders/common.ts @@ -1,10 +1,12 @@ import { PakeAppOptions } from '@/types.js'; -import prompts from 'prompts'; +import prompts, { override } from 'prompts'; import path from 'path'; import fs from 'fs/promises'; +import fs2 from 'fs-extra'; import { npmDirectory } from '@/utils/dir.js'; import logger from '@/options/logger.js'; + export async function promptText(message: string, initial?: string) { const response = await prompts({ type: 'text', @@ -15,6 +17,7 @@ export async function promptText(message: string, initial?: string) { return response.content; } + export async function mergeTauriConfig( url: string, options: PakeAppOptions, @@ -26,6 +29,11 @@ export async function mergeTauriConfig( fullscreen, transparent, resizable, + userAgent, + showMenu, + showSystemTray, + systemTrayIcon, + iterCopyFile, identifier, name, } = options; @@ -56,10 +64,132 @@ export async function mergeTauriConfig( } } + // logger.warn(JSON.stringify(tauriConf.pake.windows, null, 4)); + Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions }); + // 判断一下url类型,是文件还是网站 + // 如果是文件,并且开启了递归拷贝功能,则需要将该文件以及所在文件夹下的所有文件拷贝到src目录下,否则只拷贝单个文件。 + + const url_exists = await fs.stat(url) + .then(() => true) + .catch(() => false); + if (url_exists) { + logger.warn("you input may a local file"); + tauriConf.pake.windows[0].url_type = "local"; + const file_name = path.basename(url); + const dir_name = path.dirname(url); + if (!iterCopyFile) { + const url_path = path.join(npmDirectory,"dist/", file_name); + await fs.copyFile(url, url_path); + } else { + const old_dir = path.join(npmDirectory,"dist/"); + const new_dir = path.join(npmDirectory,"dist_bak/"); + fs2.moveSync(old_dir, new_dir, {"overwrite": true}); + fs2.copySync(dir_name, old_dir, {"overwrite": true}); + // logger.warn("dir name", dir_name); + // 将dist_bak里面的cli.js和about_pake.html拷贝回去 + const cli_path = path.join(new_dir, "cli.js") + const cli_path_target = path.join(old_dir, "cli.js") + const about_pake_path = path.join(new_dir, "about_pake.html"); + const about_patk_path_target = path.join(old_dir, "about_pake.html") + fs.copyFile(cli_path, cli_path_target); + fs.copyFile(about_pake_path, about_patk_path_target); + } + tauriConf.pake.windows[0].url = file_name; + tauriConf.pake.windows[0].url_type = "local"; + } else { + tauriConf.pake.windows[0].url_type = "web"; + } + + // 处理user-agent + logger.warn(userAgent); + if (userAgent.length > 0) { + if (process.platform === "win32") { + tauriConf.pake.user_agent.windows = userAgent; + } + + if (process.platform === "linux") { + tauriConf.pake.user_agent.linux = userAgent; + } + + if (process.platform === "darwin") { + tauriConf.pake.user_agent.macos = userAgent; + } + } + + // 处理菜单栏 + if (showMenu) { + if (process.platform === "win32") { + tauriConf.pake.menu.windows = true; + } + + if (process.platform === "linux") { + tauriConf.pake.menu.linux = true; + } + + if (process.platform === "darwin") { + tauriConf.pake.user_agent.macos = true; + } + } else { + if (process.platform === "win32") { + tauriConf.pake.menu.windows = false; + } + + if (process.platform === "linux") { + tauriConf.pake.menu.linux = false; + } + + if (process.platform === "darwin") { + tauriConf.pake.user_agent.macos = false; + } + } + + // 处理托盘 + if (showSystemTray) { + if (process.platform === "win32") { + tauriConf.pake.system_tray.windows = true; + } + + if (process.platform === "linux") { + tauriConf.pake.system_tray.linux = true; + } + + if (process.platform === "darwin") { + tauriConf.pake.system_tray.macos = true; + } + } else { + if (process.platform === "win32") { + tauriConf.pake.system_tray.windows = false; + } + + if (process.platform === "linux") { + tauriConf.pake.system_tray.linux = false; + } + + if (process.platform === "darwin") { + tauriConf.pake.system_tray.macos = false; + } + } + + // 处理targets 暂时只对linux开放 + if (process.platform === "linux") { + if (options.targets.length > 0) { + if (options.targets === "deb" || options.targets === "appimage" || options.targets === "all") { + tauriConf.tauri.bundle.targets = [options.targets]; + } + } + } else { + tauriConf.tauri.bundle.targets = ["deb"]; + } - Object.assign(tauriConf.tauri.windows[0], { url, ...tauriConfWindowOptions }); tauriConf.package.productName = name; tauriConf.tauri.bundle.identifier = identifier; + + // 删除映射关系 + if (process.platform === "linux") { + delete tauriConf.tauri.bundle.deb.files; + } + + // 处理应用图标 const exists = await fs.stat(options.icon) .then(() => true) .catch(() => false); @@ -83,18 +213,21 @@ export async function mergeTauriConfig( } else { updateIconPath = false; logger.warn(`icon file in Windows must be 256 * 256 pix with .ico type, but you give ${customIconExt}`); + tauriConf.tauri.bundle.icon = ["png/icon_256.ico"]; } } if (process.platform === "linux") { if (customIconExt != ".png") { updateIconPath = false; logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`); + tauriConf.tauri.bundle.icon = ["png/icon_512.png"]; } } if (process.platform === "darwin" && customIconExt !== ".icns") { updateIconPath = false; logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`); + tauriConf.tauri.bundle.icon = ["icons/icon.icns"]; } if (updateIconPath) { tauriConf.tauri.bundle.icon = [options.icon]; @@ -120,7 +253,40 @@ export async function mergeTauriConfig( } } + // 处理托盘自定义图标 + let useDefaultIcon = true; // 是否使用默认托盘图标 + if (systemTrayIcon.length > 0) { + const icon_exists = await fs.stat(systemTrayIcon) + .then(() => true) + .catch(() => false); + if (icon_exists) { + // 需要判断图标格式,默认只支持ico和png两种 + let iconExt = path.extname(systemTrayIcon).toLowerCase(); + if (iconExt == ".png" || iconExt == ".icon") { + useDefaultIcon = false; + const trayIcoPath = path.join(npmDirectory, `src-tauri/png/${name.toLowerCase()}${iconExt}`); + tauriConf.tauri.systemTray.iconPath = `png/${name.toLowerCase()}${iconExt}`; + await fs.copyFile(systemTrayIcon, trayIcoPath); + } else { + logger.warn(`file type for system tray icon mut be .ico or .png , but you give ${iconExt}`); + logger.warn(`system tray icon file will not change with default.`); + } + } else { + logger.warn(`${systemTrayIcon} not exists!`) + logger.warn(`system tray icon file will not change with default.`); + } + } + // 处理托盘默认图标 + if (useDefaultIcon) { + if (process.platform === "linux" || process.platform === "win32") { + tauriConf.tauri.systemTray.iconPath = tauriConf.tauri.bundle.icon[0]; + } else { + tauriConf.tauri.systemTray.iconPath = "png/icon_512.png"; + } + } + + // 保存配置文件 let configPath = ""; switch (process.platform) { case "win32": { @@ -143,6 +309,15 @@ export async function mergeTauriConfig( Buffer.from(JSON.stringify(bundleConf, null, '\t'), 'utf-8') ); + const pakeConfigPath = path.join(npmDirectory, 'src-tauri/pake.json') + await fs.writeFile( + pakeConfigPath, + Buffer.from(JSON.stringify(tauriConf.pake, null, 4), 'utf-8') + ); + + let tauriConf2 = JSON.parse(JSON.stringify(tauriConf)); + delete tauriConf2.pake; + delete tauriConf2.tauri.bundle; const configJsonPath = path.join(npmDirectory, 'src-tauri/tauri.conf.json') await fs.writeFile( diff --git a/bin/builders/tauriConf.js b/bin/builders/tauriConf.js index 2b5fd20..53122b8 100644 --- a/bin/builders/tauriConf.js +++ b/bin/builders/tauriConf.js @@ -1,11 +1,13 @@ import CommonConf from '../../src-tauri/tauri.conf.json'; +import pakeConf from '../../src-tauri/pake.json'; import WinConf from '../../src-tauri/tauri.windows.conf.json'; import MacConf from '../../src-tauri/tauri.macos.conf.json'; import LinuxConf from '../../src-tauri/tauri.linux.conf.json'; let tauriConf = { package: CommonConf.package, - tauri: CommonConf.tauri + tauri: CommonConf.tauri, + pake: pakeConf } switch (process.platform) { case "win32": { diff --git a/bin/cli.ts b/bin/cli.ts index ffed3ca..3bdfcdf 100644 --- a/bin/cli.ts +++ b/bin/cli.ts @@ -13,17 +13,32 @@ program.version(packageJson.version).description('A command-line tool that can q program .showHelpAfterError() - .argument('[url]', 'the web URL you want to package', validateUrlInput) - .option('-n, --name ', 'application name') - .option('-i, --icon ', 'application icon', DEFAULT_PAKE_OPTIONS.icon) - .option('-w, --width ', 'window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width) - .option('-h, --height ', 'window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height) - .option('-f, --fullscreen', 'start in full screen mode', DEFAULT_PAKE_OPTIONS.fullscreen) - .option('-t, --transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent) - .option('-r, --no-resizable', 'whether the window can be resizable', DEFAULT_PAKE_OPTIONS.resizable) - .option('-d, --debug', 'debug', DEFAULT_PAKE_OPTIONS.debug) - .option('-m, --multi-arch', "available for Mac only, and supports both Intel and M1", DEFAULT_PAKE_OPTIONS.multiArch) - .option('--targets ', "Select the output package format, support deb/appimage/all, only for Linux", DEFAULT_PAKE_OPTIONS.targets) + .argument('[url]', 'the web url you want to package', validateUrlInput) + .option('--name ', 'application name') + .option('--icon ', 'application icon', DEFAULT_PAKE_OPTIONS.icon) + .option('--height ', 'window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height) + .option('--width ', 'window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width) + .option('--no-resizable', 'whether the window can be resizable', DEFAULT_PAKE_OPTIONS.resizable) + .option('--fullscreen', 'makes the packaged app start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen) + .option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent) + .option('--user-agent ', 'custom user agent', DEFAULT_PAKE_OPTIONS.userAgent) + .option('--show-menu', 'show menu in app', DEFAULT_PAKE_OPTIONS.showMenu) + .option('--show-system-tray', 'show system tray in app', DEFAULT_PAKE_OPTIONS.showSystemTray) + .option('--system-tray-icon ', 'custom system tray icon', DEFAULT_PAKE_OPTIONS.systemTrayIcon) + .option('--iter-copy-file', + 'copy all static file to pake app when url is a local file', + DEFAULT_PAKE_OPTIONS.iterCopyFile) + .option( + '-m, --multi-arch', + "available for Mac only, and supports both Intel and M1", + DEFAULT_PAKE_OPTIONS.multiArch + ) + .option( + '--targets ', + 'only for linux, default is "deb", option "appaimge" or "all"(deb & appimage)', + DEFAULT_PAKE_OPTIONS.targets + ) + .option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent) .action(async (url: string, options: PakeCliOptions) => { await checkUpdateTips(); @@ -40,10 +55,10 @@ program const builder = BuilderFactory.create(); await builder.prepare(); - + // logger.warn("you input url is ", url); const appOptions = await handleInputOptions(options, url); - - await builder.build(url, appOptions); + // logger.info(JSON.stringify(appOptions, null, 4)); + builder.build(url, appOptions); }); program.parse(); diff --git a/bin/defaults.ts b/bin/defaults.ts index c1959f5..73e5255 100644 --- a/bin/defaults.ts +++ b/bin/defaults.ts @@ -7,6 +7,13 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = { fullscreen: false, resizable: true, transparent: false, + userAgent: '', + showMenu: false, + showSystemTray: false, + multiArch: false, + targets: 'deb', + iterCopyFile: false, + systemTrayIcon: '', debug: false, multiArch: false, targets: "all", diff --git a/bin/helpers/rust.ts b/bin/helpers/rust.ts index 9e9287a..875e43e 100644 --- a/bin/helpers/rust.ts +++ b/bin/helpers/rust.ts @@ -2,9 +2,17 @@ import { IS_WIN } from '@/utils/platform.js'; import ora from 'ora'; import shelljs from 'shelljs'; import { shellExec } from '../utils/shell.js'; +import {isChinaDomain} from '@/utils/ip_addr.js' -const RustInstallScriptFocMac = - "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"; +const is_china = isChinaDomain("sh.rustup.rs"); +let RustInstallScriptFocMac = ""; +if (is_china) { + RustInstallScriptFocMac = + 'export RUSTUP_DIST_SERVER="https://rsproxy.cn" && export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup" && curl --proto "=https" --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh'; +} else { + RustInstallScriptFocMac = + "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"; +} const RustInstallScriptForWin = 'winget install --id Rustlang.Rustup'; export async function installRust() { diff --git a/bin/options/index.ts b/bin/options/index.ts index 921ed59..f259dd5 100644 --- a/bin/options/index.ts +++ b/bin/options/index.ts @@ -3,15 +3,22 @@ import { getDomain } from '@/utils/url.js'; import { getIdentifier } from '../helpers/tauriConfig.js'; import { PakeAppOptions, PakeCliOptions } from '../types.js'; import { handleIcon } from './icon.js'; +import fs from 'fs/promises'; export default async function handleOptions(options: PakeCliOptions, url: string): Promise { const appOptions: PakeAppOptions = { ...options, identifier: '', }; - + const url_exists = await fs.stat(url) + .then(() => true) + .catch(() => false); if (!appOptions.name) { - appOptions.name = await promptText('Please enter the name of your application.', getDomain(url)); + if (!url_exists) { + appOptions.name = await promptText('please input your application name', getDomain(url)); + } else { + appOptions.name = await promptText('please input your application name', ""); + } } appOptions.identifier = getIdentifier(appOptions.name, url); diff --git a/bin/types.ts b/bin/types.ts index c4d29fe..419a807 100644 --- a/bin/types.ts +++ b/bin/types.ts @@ -20,6 +20,27 @@ export interface PakeCliOptions { /** 是否开启沉浸式头部,默认为 false 不开启 ƒ*/ transparent: boolean; + /** 自定义UA,默认为不开启 ƒ*/ + userAgent: string; + + /** 开启菜单栏,MacOS默认开启,Windows,Linux默认不开启 ƒ*/ + showMenu: boolean; + + /** 开启系统托盘,MacOS默认不开启,Windows,Linux默认开启 ƒ*/ + showSystemTray: boolean; + + /** 托盘图标, Windows、Linux默认和应用图标共用一样的,MacOS需要提别提供, 格式为png或者ico */ + systemTrayIcon: string; + + // /** 递归拷贝,当url为本地文件路径时候,若开启该选项,则将url路径文件所在文件夹以及所有子文件都拷贝到pake静态文件夹,默认不开启 */ + iterCopyFile: false; + + /** mutli arch, Supports both Intel and m1 chips, only for Mac */ + multiArch: boolean; + + // 包输出产物,对linux用户有效,默认为deb,可选appimage, 或者all(即同时输出deb和all); + targets: string; + /** 调试模式,会输出更多日志 */ debug: boolean; diff --git a/bin/utils/ip_addr.ts b/bin/utils/ip_addr.ts new file mode 100644 index 0000000..bcb11b7 --- /dev/null +++ b/bin/utils/ip_addr.ts @@ -0,0 +1,35 @@ +import { exec } from 'child_process'; +import { promisify } from 'util'; +import dns from 'dns'; + +const resolve = promisify(dns.resolve); + +async function isChinaDomain(domain: string): Promise { + try { + // 解析域名为IP地址 + const [ip] = await resolve(domain); + return await isChinaIP(ip); + } catch (error) { + // 域名无法解析,返回false + return false; + } +} + +async function isChinaIP(ip: string): Promise { + return new Promise((resolve, reject) => { + exec(`ping -c 1 -w 1 ${ip}`, (error, stdout, stderr) => { + if (error) { + // 命令执行出错,返回false + resolve(false); + } else { + // 解析输出信息,提取延迟值 + const match = stdout.match(/time=(\d+\.\d+) ms/); + const latency = match ? parseFloat(match[1]) : 0; + // 判断延迟是否超过100ms + resolve(latency > 100); + } + }); + }); +} + +export { isChinaDomain, isChinaIP }; \ No newline at end of file diff --git a/bin/utils/validate.ts b/bin/utils/validate.ts index 54add5b..c01c79e 100644 --- a/bin/utils/validate.ts +++ b/bin/utils/validate.ts @@ -1,5 +1,6 @@ import * as Commander from 'commander'; import { normalizeUrl } from './url.js'; +import fs from 'fs'; export function validateNumberInput(value: string) { const parsedValue = Number(value); @@ -10,9 +11,13 @@ export function validateNumberInput(value: string) { } export function validateUrlInput(url: string) { - try { - return normalizeUrl(url); - } catch (error) { - throw new Commander.InvalidArgumentError(error.message); + if(!fs.existsSync(url)) { + try { + return normalizeUrl(url) + } catch (error) { + throw new Commander.InvalidArgumentError(error.message); + } + } else { + return url; } } diff --git a/dist/about_pake.html b/dist/about_pake.html new file mode 100644 index 0000000..83cb1d5 --- /dev/null +++ b/dist/about_pake.html @@ -0,0 +1,16 @@ + + + + + + Document + + +
Welcome from Pake!
+

version: 1.0.9

+ Project link
+ Discussions
+ Issues
+

LICENSE: MIT

+ + \ No newline at end of file diff --git a/dist/cli.js b/dist/cli.js index c08611d..f4a0edf 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -3,9 +3,11 @@ import { program } from 'commander'; import log from 'loglevel'; import url, { fileURLToPath } from 'url'; import isurl from 'is-url'; +import fs from 'fs'; import prompts from 'prompts'; import path from 'path'; -import fs from 'fs/promises'; +import fs$1 from 'fs/promises'; +import fs2 from 'fs-extra'; import chalk from 'chalk'; import crypto from 'crypto'; import axios from 'axios'; @@ -13,31 +15,34 @@ import { fileTypeFromBuffer } from 'file-type'; import { dir } from 'tmp-promise'; import ora from 'ora'; import shelljs from 'shelljs'; +import { exec } from 'child_process'; +import { promisify } from 'util'; +import dns from 'dns'; import updateNotifier from 'update-notifier'; -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ - -function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); } const DEFAULT_PAKE_OPTIONS = { @@ -47,6 +52,13 @@ const DEFAULT_PAKE_OPTIONS = { fullscreen: false, resizable: true, transparent: false, + userAgent: '', + showMenu: false, + showSystemTray: false, + multiArch: false, + targets: 'deb', + iterCopyFile: false, + systemTrayIcon: '', debug: false, multiArch: false, targets: "all", @@ -1585,11 +1597,16 @@ function validateNumberInput(value) { return parsedValue; } function validateUrlInput(url) { - try { - return normalizeUrl(url); + if (!fs.existsSync(url)) { + try { + return normalizeUrl(url); + } + catch (error) { + throw new Commander.InvalidArgumentError(error.message); + } } - catch (error) { - throw new Commander.InvalidArgumentError(error.message); + else { + return url; } } @@ -1626,7 +1643,7 @@ function promptText(message, initial) { } function mergeTauriConfig(url, options, tauriConf) { return __awaiter(this, void 0, void 0, function* () { - const { width, height, fullscreen, transparent, resizable, identifier, name, } = options; + const { width, height, fullscreen, transparent, resizable, userAgent, showMenu, showSystemTray, systemTrayIcon, iterCopyFile, identifier, name, } = options; const tauriConfWindowOptions = { width, height, @@ -1652,10 +1669,120 @@ function mergeTauriConfig(url, options, tauriConf) { process.exit(); } } - Object.assign(tauriConf.tauri.windows[0], Object.assign({ url }, tauriConfWindowOptions)); + // logger.warn(JSON.stringify(tauriConf.pake.windows, null, 4)); + Object.assign(tauriConf.pake.windows[0], Object.assign({ url }, tauriConfWindowOptions)); + // 判断一下url类型,是文件还是网站 + // 如果是文件,并且开启了递归拷贝功能,则需要将该文件以及所在文件夹下的所有文件拷贝到src目录下,否则只拷贝单个文件。 + const url_exists = yield fs$1.stat(url) + .then(() => true) + .catch(() => false); + if (url_exists) { + logger.warn("you input may a local file"); + tauriConf.pake.windows[0].url_type = "local"; + const file_name = path.basename(url); + const dir_name = path.dirname(url); + if (!iterCopyFile) { + const url_path = path.join(npmDirectory, "dist/", file_name); + yield fs$1.copyFile(url, url_path); + } + else { + const old_dir = path.join(npmDirectory, "dist/"); + const new_dir = path.join(npmDirectory, "dist_bak/"); + fs2.moveSync(old_dir, new_dir, { "overwrite": true }); + fs2.copySync(dir_name, old_dir, { "overwrite": true }); + // logger.warn("dir name", dir_name); + // 将dist_bak里面的cli.js和about_pake.html拷贝回去 + const cli_path = path.join(new_dir, "cli.js"); + const cli_path_target = path.join(old_dir, "cli.js"); + const about_pake_path = path.join(new_dir, "about_pake.html"); + const about_patk_path_target = path.join(old_dir, "about_pake.html"); + fs$1.copyFile(cli_path, cli_path_target); + fs$1.copyFile(about_pake_path, about_patk_path_target); + } + tauriConf.pake.windows[0].url = file_name; + tauriConf.pake.windows[0].url_type = "local"; + } + else { + tauriConf.pake.windows[0].url_type = "web"; + } + // 处理user-agent + logger.warn(userAgent); + if (userAgent.length > 0) { + if (process.platform === "win32") { + tauriConf.pake.user_agent.windows = userAgent; + } + if (process.platform === "linux") { + tauriConf.pake.user_agent.linux = userAgent; + } + if (process.platform === "darwin") { + tauriConf.pake.user_agent.macos = userAgent; + } + } + // 处理菜单栏 + if (showMenu) { + if (process.platform === "win32") { + tauriConf.pake.menu.windows = true; + } + if (process.platform === "linux") { + tauriConf.pake.menu.linux = true; + } + if (process.platform === "darwin") { + tauriConf.pake.user_agent.macos = true; + } + } + else { + if (process.platform === "win32") { + tauriConf.pake.menu.windows = false; + } + if (process.platform === "linux") { + tauriConf.pake.menu.linux = false; + } + if (process.platform === "darwin") { + tauriConf.pake.user_agent.macos = false; + } + } + // 处理托盘 + if (showSystemTray) { + if (process.platform === "win32") { + tauriConf.pake.system_tray.windows = true; + } + if (process.platform === "linux") { + tauriConf.pake.system_tray.linux = true; + } + if (process.platform === "darwin") { + tauriConf.pake.system_tray.macos = true; + } + } + else { + if (process.platform === "win32") { + tauriConf.pake.system_tray.windows = false; + } + if (process.platform === "linux") { + tauriConf.pake.system_tray.linux = false; + } + if (process.platform === "darwin") { + tauriConf.pake.system_tray.macos = false; + } + } + // 处理targets 暂时只对linux开放 + if (process.platform === "linux") { + if (options.targets.length > 0) { + if (options.targets === "deb" || options.targets === "appimage" || options.targets === "all") { + tauriConf.tauri.bundle.targets = [options.targets]; + } + } + } + else { + tauriConf.tauri.bundle.targets = ["deb"]; + } tauriConf.package.productName = name; tauriConf.tauri.bundle.identifier = identifier; - const exists = yield fs.stat(options.icon) + // 删除映射关系 + if (process.platform === "linux") { + delete tauriConf.tauri.bundle.deb.files; + } + // 处理应用图标 + const exists = yield fs$1.stat(options.icon) .then(() => true) .catch(() => false); if (process.platform === "linux") { @@ -1674,22 +1801,25 @@ function mergeTauriConfig(url, options, tauriConf) { if (customIconExt === ".ico") { const ico_path = path.join(npmDirectory, `src-tauri/png/${name.toLowerCase()}_32.ico`); tauriConf.tauri.bundle.resources = [`png/${name.toLowerCase()}_32.ico`]; - yield fs.copyFile(options.icon, ico_path); + yield fs$1.copyFile(options.icon, ico_path); } else { updateIconPath = false; logger.warn(`icon file in Windows must be 256 * 256 pix with .ico type, but you give ${customIconExt}`); + tauriConf.tauri.bundle.icon = ["png/icon_256.ico"]; } } if (process.platform === "linux") { if (customIconExt != ".png") { updateIconPath = false; logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`); + tauriConf.tauri.bundle.icon = ["png/icon_512.png"]; } } if (process.platform === "darwin" && customIconExt !== ".icns") { updateIconPath = false; logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`); + tauriConf.tauri.bundle.icon = ["icons/icon.icns"]; } if (updateIconPath) { tauriConf.tauri.bundle.icon = [options.icon]; @@ -1716,6 +1846,41 @@ function mergeTauriConfig(url, options, tauriConf) { } } } + // 处理托盘自定义图标 + let useDefaultIcon = true; // 是否使用默认托盘图标 + if (systemTrayIcon.length > 0) { + const icon_exists = yield fs$1.stat(systemTrayIcon) + .then(() => true) + .catch(() => false); + if (icon_exists) { + // 需要判断图标格式,默认只支持ico和png两种 + let iconExt = path.extname(systemTrayIcon).toLowerCase(); + if (iconExt == ".png" || iconExt == ".icon") { + useDefaultIcon = false; + const trayIcoPath = path.join(npmDirectory, `src-tauri/png/${name.toLowerCase()}${iconExt}`); + tauriConf.tauri.systemTray.iconPath = `png/${name.toLowerCase()}${iconExt}`; + yield fs$1.copyFile(systemTrayIcon, trayIcoPath); + } + else { + logger.warn(`file type for system tray icon mut be .ico or .png , but you give ${iconExt}`); + logger.warn(`system tray icon file will not change with default.`); + } + } + else { + logger.warn(`${systemTrayIcon} not exists!`); + logger.warn(`system tray icon file will not change with default.`); + } + } + // 处理托盘默认图标 + if (useDefaultIcon) { + if (process.platform === "linux" || process.platform === "win32") { + tauriConf.tauri.systemTray.iconPath = tauriConf.tauri.bundle.icon[0]; + } + else { + tauriConf.tauri.systemTray.iconPath = "png/icon_512.png"; + } + } + // 保存配置文件 let configPath = ""; switch (process.platform) { case "win32": { @@ -1732,9 +1897,14 @@ function mergeTauriConfig(url, options, tauriConf) { } } let bundleConf = { tauri: { bundle: tauriConf.tauri.bundle } }; - yield fs.writeFile(configPath, Buffer.from(JSON.stringify(bundleConf, null, '\t'), 'utf-8')); + yield fs$1.writeFile(configPath, Buffer.from(JSON.stringify(bundleConf, null, 4), 'utf-8')); + const pakeConfigPath = path.join(npmDirectory, 'src-tauri/pake.json'); + yield fs$1.writeFile(pakeConfigPath, Buffer.from(JSON.stringify(tauriConf.pake, null, 4), 'utf-8')); + let tauriConf2 = JSON.parse(JSON.stringify(tauriConf)); + delete tauriConf2.pake; + delete tauriConf2.tauri.bundle; const configJsonPath = path.join(npmDirectory, 'src-tauri/tauri.conf.json'); - yield fs.writeFile(configJsonPath, Buffer.from(JSON.stringify(tauriConf, null, '\t'), 'utf-8')); + yield fs$1.writeFile(configJsonPath, Buffer.from(JSON.stringify(tauriConf2, null, 4), 'utf-8')); }); } @@ -1801,7 +1971,7 @@ function downloadIcon(iconUrl) { } const { path } = yield dir(); const iconPath = `${path}/icon.${fileDetails.ext}`; - yield fs.writeFile(iconPath, iconData); + yield fs$1.writeFile(iconPath, iconData); return iconPath; }); } @@ -1809,8 +1979,16 @@ function downloadIcon(iconUrl) { function handleOptions(options, url) { return __awaiter(this, void 0, void 0, function* () { const appOptions = Object.assign(Object.assign({}, options), { identifier: '' }); + const url_exists = yield fs$1.stat(url) + .then(() => true) + .catch(() => false); if (!appOptions.name) { - appOptions.name = yield promptText('Please enter the name of your application.', getDomain(url)); + if (!url_exists) { + appOptions.name = yield promptText('please input your application name', getDomain(url)); + } + else { + appOptions.name = yield promptText('please input your application name', ""); + } } appOptions.identifier = getIdentifier(appOptions.name, url); appOptions.icon = yield handleIcon(appOptions); @@ -1831,7 +2009,50 @@ function shellExec(command) { }); } -const RustInstallScriptFocMac = "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"; +const resolve = promisify(dns.resolve); +function isChinaDomain(domain) { + return __awaiter(this, void 0, void 0, function* () { + try { + // 解析域名为IP地址 + const [ip] = yield resolve(domain); + return yield isChinaIP(ip); + } + catch (error) { + // 域名无法解析,返回false + return false; + } + }); +} +function isChinaIP(ip) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => { + exec(`ping -c 1 -w 1 ${ip}`, (error, stdout, stderr) => { + if (error) { + // 命令执行出错,返回false + resolve(false); + } + else { + // 解析输出信息,提取延迟值 + const match = stdout.match(/time=(\d+\.\d+) ms/); + const latency = match ? parseFloat(match[1]) : 0; + // 判断延迟是否超过100ms + resolve(latency > 100); + } + }); + }); + }); +} + +const is_china = isChinaDomain("sh.rustup.rs"); +let RustInstallScriptFocMac = ""; +if (is_china) { + RustInstallScriptFocMac = + 'export RUSTUP_DIST_SERVER="https://rsproxy.cn" && export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup" && curl --proto "=https" --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh'; +} +else { + RustInstallScriptFocMac = + "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"; +} const RustInstallScriptForWin = 'winget install --id Rustlang.Rustup'; function installRust() { return __awaiter(this, void 0, void 0, function* () { @@ -1852,24 +2073,22 @@ function checkRustInstalled() { } var tauri$3 = { - windows: [ - { - url: "https://weread.qq.com/", - transparent: true, - fullscreen: false, - width: 1200, - height: 780, - resizable: true - } - ], security: { csp: null }, updater: { active: false + }, + systemTray: { + iconPath: "png/weread_512.png", + iconAsTemplate: true + }, + allowlist: { + all: true } }; var build = { + withGlobalTauri: true, devPath: "../dist", distDir: "../dist", beforeBuildCommand: "", @@ -1884,6 +2103,39 @@ var CommonConf = { build: build }; +var windows = [ + { + url: "https://weread.qq.com/", + transparent: true, + fullscreen: false, + width: 1200, + height: 780, + resizable: true, + url_type: "web" + } +]; +var user_agent = { + macos: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15", + linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" +}; +var menu = { + macos: true, + linux: false, + windows: false +}; +var system_tray = { + macos: false, + linux: true, + windows: true +}; +var pakeConf = { + windows: windows, + user_agent: user_agent, + menu: menu, + system_tray: system_tray +}; + var tauri$2 = { bundle: { icon: [ @@ -1964,16 +2216,8 @@ var tauri = { copyright: "", deb: { depends: [ - "libwebkit2gtk-4.0-dev", - "build-essential", "curl", - "wget", - "libssl-dev", - "libgtk-3-dev", - "libayatana-appindicator3-dev", - "librsvg2-dev", - "gnome-video-effects", - "gnome-video-effects-extra" + "wget" ], files: { "/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop" @@ -1997,7 +2241,8 @@ var LinuxConf = { let tauriConf = { package: CommonConf.package, - tauri: CommonConf.tauri + tauri: CommonConf.tauri, + pake: pakeConf }; switch (process.platform) { case "win32": { @@ -2042,11 +2287,28 @@ class MacBuilder { yield mergeTauriConfig(url, options, tauriConf); let dmgName; if (options.multiArch) { - yield shellExec(`cd "${npmDirectory}" && npm install --verbose && npm run build:mac`); + const isChina = isChinaDomain("www.npmjs.com"); + if (isChina) { + // crates.io也顺便换源 + const rust_project_dir = path.join(npmDirectory, 'src-tauri', ".cargo"); + const project_cn_conf = path.join(rust_project_dir, "cn_config.bak"); + const project_conf = path.join(rust_project_dir, "config"); + fs$1.copyFile(project_cn_conf, project_conf); + yield shellExec(`cd ${npmDirectory} && npm install --registry=https://registry.npmmirror.com && npm run build:mac`); + } + else { + yield shellExec(`cd ${npmDirectory} && npm install && npm run build:mac`); + } dmgName = `${name}_${tauriConf.package.version}_universal.dmg`; } else { - yield shellExec(`cd "${npmDirectory}" && npm install --verbose && npm run build`); + const isChina = isChinaDomain("www.npmjs.com"); + if (isChina) { + yield shellExec(`cd ${npmDirectory} && npm install --registry=https://registry.npmmirror.com && npm run build`); + } + else { + yield shellExec(`cd ${npmDirectory} && npm install && npm run build`); + } let arch = "x64"; if (process.arch === "arm64") { arch = "aarch64"; @@ -2058,8 +2320,8 @@ class MacBuilder { } const appPath = this.getBuildAppPath(npmDirectory, dmgName, options.multiArch); const distPath = path.resolve(`${name}.dmg`); - yield fs.copyFile(appPath, distPath); - yield fs.unlink(appPath); + yield fs$1.copyFile(appPath, distPath); + yield fs$1.unlink(appPath); logger.success('Build success!'); logger.success('You can find the app installer in', distPath); }); @@ -2104,14 +2366,25 @@ class WinBuilder { logger.debug('PakeAppOptions', options); const { name } = options; yield mergeTauriConfig(url, options, tauriConf); - yield shellExec(`cd "${npmDirectory}" && npm install --verbose && npm run build`); + const isChina = isChinaDomain("www.npmjs.com"); + if (isChina) { + // crates.io也顺便换源 + const rust_project_dir = path.join(npmDirectory, 'src-tauri', ".cargo"); + const project_cn_conf = path.join(rust_project_dir, "cn_config.bak"); + const project_conf = path.join(rust_project_dir, "config"); + fs$1.copyFile(project_cn_conf, project_conf); + yield shellExec(`cd ${npmDirectory} && npm install --registry=https://registry.npmmirror.com && npm run build`); + } + else { + yield shellExec(`cd ${npmDirectory} && npm install && npm run build`); + } 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.getBuildAppPath(npmDirectory, msiName); const distPath = path.resolve(`${name}.msi`); - yield fs.copyFile(appPath, distPath); - yield fs.unlink(appPath); + yield fs$1.copyFile(appPath, distPath); + yield fs$1.unlink(appPath); logger.success('Build success!'); logger.success('You can find the app installer in', distPath); }); @@ -2149,7 +2422,18 @@ class LinuxBuilder { logger.debug('PakeAppOptions', options); const { name } = options; yield mergeTauriConfig(url, options, tauriConf); - yield shellExec(`cd "${npmDirectory}" && npm install --verbose && npm run build`); + const isChina = isChinaDomain("www.npmjs.com"); + if (isChina) { + // crates.io也顺便换源 + const rust_project_dir = path.join(npmDirectory, 'src-tauri', ".cargo"); + const project_cn_conf = path.join(rust_project_dir, "cn_config.bak"); + const project_conf = path.join(rust_project_dir, "config"); + fs$1.copyFile(project_cn_conf, project_conf); + yield shellExec(`cd ${npmDirectory} && npm install --registry=https://registry.npmmirror.com && npm run build`); + } + else { + yield shellExec(`cd ${npmDirectory} && npm install && npm run build`); + } let arch; if (process.arch === "x64") { arch = "amd64"; @@ -2161,8 +2445,8 @@ class LinuxBuilder { const debName = `${name}_${tauriConf.package.version}_${arch}.deb`; const appPath = this.getBuildAppPath(npmDirectory, "deb", debName); const distPath = path.resolve(`${name}.deb`); - yield fs.copyFile(appPath, distPath); - yield fs.unlink(appPath); + yield fs$1.copyFile(appPath, distPath); + yield fs$1.unlink(appPath); logger.success('Build Deb success!'); logger.success('You can find the deb app installer in', distPath); } @@ -2170,8 +2454,8 @@ class LinuxBuilder { const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`; const appImagePath = this.getBuildAppPath(npmDirectory, "appimage", appImageName); const distAppPath = path.resolve(`${name}.AppImage`); - yield fs.copyFile(appImagePath, distAppPath); - yield fs.unlink(appImagePath); + yield fs$1.copyFile(appImagePath, distAppPath); + yield fs$1.unlink(appImagePath); logger.success('Build AppImage success!'); logger.success('You can find the AppImage app installer in', distAppPath); } @@ -2250,6 +2534,7 @@ var dependencies = { chalk: "^5.1.2", commander: "^9.4.1", "file-type": "^18.0.0", + "fs-extra": "^11.1.0", "is-url": "^1.2.4", loglevel: "^1.8.1", ora: "^6.1.2", @@ -2264,6 +2549,7 @@ var devDependencies = { "@rollup/plugin-json": "^5.0.1", "@rollup/plugin-terser": "^0.1.0", "@rollup/plugin-typescript": "^9.0.2", + "@types/fs-extra": "^9.0.13", "@types/is-url": "^1.2.30", "@types/page-icon": "^0.3.4", "@types/prompts": "^2.4.1", @@ -2304,17 +2590,22 @@ function checkUpdateTips() { program.version(packageJson.version).description('A command-line tool that can quickly convert a webpage into a desktop application.'); program .showHelpAfterError() - .argument('[url]', 'the web URL you want to package', validateUrlInput) - .option('-n, --name ', 'application name') - .option('-i, --icon ', 'application icon', DEFAULT_PAKE_OPTIONS.icon) - .option('-w, --width ', 'window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width) - .option('-h, --height ', 'window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height) - .option('-f, --fullscreen', 'start in full screen mode', DEFAULT_PAKE_OPTIONS.fullscreen) - .option('-t, --transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent) - .option('-r, --no-resizable', 'whether the window can be resizable', DEFAULT_PAKE_OPTIONS.resizable) - .option('-d, --debug', 'debug', DEFAULT_PAKE_OPTIONS.debug) + .argument('[url]', 'the web url you want to package', validateUrlInput) + .option('--name ', 'application name') + .option('--icon ', 'application icon', DEFAULT_PAKE_OPTIONS.icon) + .option('--height ', 'window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height) + .option('--width ', 'window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width) + .option('--no-resizable', 'whether the window can be resizable', DEFAULT_PAKE_OPTIONS.resizable) + .option('--fullscreen', 'makes the packaged app start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen) + .option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent) + .option('--user-agent ', 'custom user agent', DEFAULT_PAKE_OPTIONS.userAgent) + .option('--show-menu', 'show menu in app', DEFAULT_PAKE_OPTIONS.showMenu) + .option('--show-system-tray', 'show system tray in app', DEFAULT_PAKE_OPTIONS.showSystemTray) + .option('--system-tray-icon ', 'custom system tray icon', DEFAULT_PAKE_OPTIONS.systemTrayIcon) + .option('--iter-copy-file', 'copy all static file to pake app when url is a local file', DEFAULT_PAKE_OPTIONS.iterCopyFile) .option('-m, --multi-arch', "available for Mac only, and supports both Intel and M1", DEFAULT_PAKE_OPTIONS.multiArch) - .option('--targets ', "Select the output package format, support deb/appimage/all, only for Linux", DEFAULT_PAKE_OPTIONS.targets) + .option('--targets ', 'only for linux, default is "deb", option "appaimge" or "all"(deb & appimage)', DEFAULT_PAKE_OPTIONS.targets) + .option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent) .action((url, options) => __awaiter(void 0, void 0, void 0, function* () { yield checkUpdateTips(); if (!url) { @@ -2327,7 +2618,9 @@ program } const builder = BuilderFactory.create(); yield builder.prepare(); + // logger.warn("you input url is ", url); const appOptions = yield handleOptions(options, url); - yield builder.build(url, appOptions); + // logger.info(JSON.stringify(appOptions, null, 4)); + builder.build(url, appOptions); })); program.parse(); diff --git a/package.json b/package.json index 18154e4..2c5e7c7 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "chalk": "^5.1.2", "commander": "^9.4.1", "file-type": "^18.0.0", + "fs-extra": "^11.1.0", "is-url": "^1.2.4", "loglevel": "^1.8.1", "ora": "^6.1.2", @@ -66,6 +67,7 @@ "@rollup/plugin-json": "^5.0.1", "@rollup/plugin-terser": "^0.1.0", "@rollup/plugin-typescript": "^9.0.2", + "@types/fs-extra": "^9.0.13", "@types/is-url": "^1.2.30", "@types/page-icon": "^0.3.4", "@types/prompts": "^2.4.1", diff --git a/script/build.bat b/script/build.bat new file mode 100644 index 0000000..7dccb34 --- /dev/null +++ b/script/build.bat @@ -0,0 +1,99 @@ +@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 +for /f %%a in (' find /c /v "" ^<"app.csv" ') do set /A total=%%a +:: ignore first header line +set /A total=total-1 + +set old_name=weread +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 + +for /f "skip=1 tokens=1-4 delims=," %%i in (app.csv) do ( + setlocal enabledelayedexpansion + set name=%%i + set title=%%j + set name_zh=%%k + set url=%%l + @echo on + + ::echo name is !name! !name_zh! !url! + :: replace url + .\script\sd.exe -s !old_url! !url! src-tauri\pake.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 package info + set old_zh_name=!name_zh! + set old_name=!name! + set old_title=!title! + 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\!title!_x64.msi + ::rm cache + del /q /f /s src-tauri\target\x86_64-pc-windows-msvc\release\*.exe + del /q /f /s src-tauri\target\x86_64-pc-windows-msvc\release\resources\*.ico + del /q /f /s src-tauri\target\x86_64-pc-windows-msvc\release\png\*.ico + del /q /f /s src-tauri\target\x86_64-pc-windows-msvc\release\wix\*.* + del /q /f /s src-tauri\target\x86_64-pc-windows-msvc\release\app.* + rd /s /q src-tauri\target\x86_64-pc-windows-msvc\release\resources + rd /s /q src-tauri\target\x86_64-pc-windows-msvc\release\png + rd /s /q src-tauri\target\x86_64-pc-windows-msvc\release\wix + @echo on + echo package build success! + echo. + echo. + + set /A index=index+1 + @echo off + +) + +:: 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\pake.json +.\script\sd.exe %title% %init_title% src-tauri\tauri.conf.json +.\script\sd.exe %name% %init_name% src-tauri\tauri.conf.json +.\script\sd.exe %name% %init_name% src-tauri\tauri.windows.conf.json \ No newline at end of file diff --git a/script/build.ps1 b/script/build.ps1 index e71ae83..eee84b9 100644 --- a/script/build.ps1 +++ b/script/build.ps1 @@ -29,6 +29,7 @@ $identifier_prefix = "com.tw93" # total package number $index = 1 $total = (Get-Content ./app.csv | Measure-Object -Line).Lines +$pake_conf_path = "src-tauri/pake.json" $common_conf_path = "src-tauri/tauri.conf.json" $windows_conf_path = "src-tauri/tauri.windows.conf.json" @@ -47,20 +48,27 @@ ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) { Write-Host "name_zh = ${name_zh}" Write-Host "url = ${url}" Write-Host "==========================" - # -- replace url -- + # -- replace url -- # # clear url with regex - (Get-Content -Path $common_conf_path -Raw) -replace '"url":\s*"[^"]*"', '"url": ""' | Set-Content -Path $common_conf_path + (Get-Content -Path $pake_conf_path -Raw) -replace '"url":\s*"[^"]*"', '"url": ""' | Set-Content -Path $pake_conf_path # replace url with no regex - (Get-Content -Path $common_conf_path -Raw) | ForEach-Object { $_.Replace('"url": ""', "`"url`": `"${url}`"") } | Set-Content $common_conf_path + (Get-Content -Path $pake_conf_path -Raw) | ForEach-Object { $_.Replace('"url": ""', "`"url`": `"${url}`"") } | Set-Content $pake_conf_path - # replace package name + # -- replace package name -- # # clear package_name with regex (Get-Content -Path $common_conf_path -Raw) -replace '"productName":\s*"[^"]*"', '"productName": ""' | Set-Content -Path $common_conf_path # replace package_name with no regex (Get-Content -Path $common_conf_path -Raw) | ForEach-Object { $_.Replace('"productName": ""', "`"productName`": `"${title}`"") } | Set-Content $common_conf_path - # -- replace icon -- + + # -- replace systemTray iconPath -- # + # clear systemTray iconPath with regex + (Get-Content -Path $common_conf_path -Raw) -replace '"iconPath":\s*"[^"]*"', '"iconPath": ""' | Set-Content -Path $common_conf_path + # replace systemTray iconPath with no regex + (Get-Content -Path $common_conf_path -Raw) | ForEach-Object { $_.Replace('"iconPath": ""', "`"iconPath`": `"png/${name}_32.ico`"") } | Set-Content $common_conf_path + + # -- replace icon -- # clear icon path with regex (Get-Content -Path $windows_conf_path -Raw) -replace '(?s)"icon":\s*\[[^\]]*\]', '"icon": []' | Set-Content -Path $windows_conf_path # replace icon path with no regex @@ -85,7 +93,7 @@ ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) { if (-not (Test-Path "src-tauri\png\${name}_256.ico")) { Copy-Item "src-tauri\png\icon_256.ico" "src-tauri\png\${name}_256.ico" } - + # build package Write-Host "npm run build:windows" npm run tauri build -- --target x86_64-pc-windows-msvc diff --git a/script/build.sh b/script/build.sh index a138809..a8a5317 100755 --- a/script/build.sh +++ b/script/build.sh @@ -61,12 +61,12 @@ do package_title=${arr[1]} package_zh_name=${arr[2]} url=${arr[3]} - + # replace package info # clear url with regex - $sd "\"url\": \"(.*?)\"," "\"url\": \"\"," src-tauri/tauri.conf.json + $sd "\"url\": \"(.*?)\"," "\"url\": \"\"," src-tauri/pake.json # replace url with no regex - $sd -s "\"url\": \"\"," "\"url\": \"${url}\"," src-tauri/tauri.conf.json + $sd -s "\"url\": \"\"," "\"url\": \"${url}\"," src-tauri/pake.json # for apple, need replace title if [[ "$OSTYPE" =~ ^darwin ]]; then @@ -106,14 +106,25 @@ do echo "warning" cp "src-tauri/png/icon_512.png" "src-tauri/png/${package_name}_512.png" fi + # -- replace package name -- # # clear package_name with regex $sd "\"productName\": \"(.*?)\"," "\"productName\": \"\"," src-tauri/tauri.conf.json # replace package_name with no regex $sd -s "\"productName\": \"\"," "\"productName\": \"${package_prefix}-${package_name}\"," src-tauri/tauri.conf.json + + # -- replace systemTray iconPath -- # + # clear systemTray iconPath with regex + $sd "\"iconPath\": \"(.*?)\"," "\"iconPath\": \"\"," src-tauri/tauri.conf.json + # replace systemTray iconPath with no regex + $sd -s "\"iconPath\": \"\"," "\"iconPath\": \"png/${package_name}_512.png\"," src-tauri/tauri.conf.json + + # -- replace icon -- # # clear icon path with regex $sd "\"icon\": \[\"(.*?)\"\]," "\"icon\": [\"\"]," src-tauri/tauri.linux.conf.json # replace icon path with no regex $sd -s "\"icon\": [\"\"]," "\"icon\": [\"png/${package_name}_512.png\"]," src-tauri/tauri.linux.conf.json + + # -- replace identifier -- # # clear identifier with regex $sd "\"identifier\": \"(.*?)\"," "\"identifier\": \"\"," src-tauri/tauri.linux.conf.json # replace identifier with not regex @@ -122,10 +133,10 @@ do new_desktop="${PROJECT_FOLDER}/src-tauri/assets/${package_prefix}-${package_name}.desktop" new_desktop_map_path="/usr/share/applications/${package_prefix}-${package_name}.desktop" - for file in `ls ${PROJECT_FOLDER}/src-tauri/assets/` + for file in `ls ${PROJECT_FOLDER}/src-tauri/assets/*.desktop` do - mv "${PROJECT_FOLDER}/src-tauri/assets/${file}" "${new_desktop}" - echo mv "${PROJECT_FOLDER}/src-tauri/assets/${file}" "${new_desktop}" + mv "${file}" "${new_desktop}" + echo mv "${file}" "${new_desktop}" done # clear desktop file with regex $sd "\"files\": \{\"(.*)\"\}" "\"files\": \{\"\"\}" src-tauri/tauri.linux.conf.json diff --git a/script/sd.exe b/script/sd.exe deleted file mode 100644 index 285ed10..0000000 Binary files a/script/sd.exe and /dev/null differ diff --git a/src-tauri/.cargo/cn_config.bak b/src-tauri/.cargo/cn_config.bak new file mode 100644 index 0000000..dbd564d --- /dev/null +++ b/src-tauri/.cargo/cn_config.bak @@ -0,0 +1,14 @@ +[source.crates-io] +# To use sparse index, change 'rsproxy' to 'rsproxy-sparse' +replace-with = 'rsproxy' + +[source.rsproxy] +registry = "https://rsproxy.cn/crates.io-index" +[source.rsproxy-sparse] +registry = "sparse+https://rsproxy.cn/index/" + +[registries.rsproxy] +index = "https://rsproxy.cn/crates.io-index" + +[net] +git-fetch-with-cli = true diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index e2a31cd..a21994a 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -34,24 +34,24 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.68" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" +checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" [[package]] name = "app" version = "0.1.0" dependencies = [ "dirs", + "download_rs", "home", "image", + "libc", "serde", "serde_json", "tauri", "tauri-build", - "tauri-utils", - "webbrowser", - "wry", + "tauri-plugin-window-state", ] [[package]] @@ -61,7 +61,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c3d816ce6f0e2909a96830d6911c2aff044370b1ef92d7f267b43bae5addedd" dependencies = [ "atk-sys", - "bitflags", + "bitflags 1.3.2", "glib", "libc", ] @@ -75,7 +75,23 @@ dependencies = [ "glib-sys", "gobject-sys", "libc", - "system-deps 6.0.3", + "system-deps 6.0.4", +] + +[[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]] @@ -91,10 +107,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] -name = "bit_field" -version = "0.10.1" +name = "base64" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit_field" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" [[package]] name = "bitflags" @@ -102,6 +133,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c70beb79cbb5ce9c4f8e20849978f34225931f665bb49efa6982875a4d5facb3" + [[package]] name = "block" version = "0.1.6" @@ -110,9 +147,9 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" [[package]] name = "block-buffer" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array", ] @@ -140,11 +177,12 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.17" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" dependencies = [ "memchr", + "serde", ] [[package]] @@ -155,9 +193,9 @@ checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "bytemuck" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" +checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" [[package]] name = "byteorder" @@ -165,6 +203,12 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "bytes" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + [[package]] name = "bytes" version = "1.4.0" @@ -177,7 +221,7 @@ version = "0.15.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c76ee391b03d35510d9fa917357c7f1855bd9a6659c95a1b392e33f49b3369bc" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cairo-sys-rs", "glib", "libc", @@ -192,7 +236,7 @@ checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8" dependencies = [ "glib-sys", "libc", - "system-deps 6.0.3", + "system-deps 6.0.4", ] [[package]] @@ -202,7 +246,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497049e9477329f8f6a559972ee42e117487d01d1e8c2cc9f836ea6fa23a9e1a" dependencies = [ "serde", - "toml", + "toml 0.5.11", ] [[package]] @@ -238,13 +282,19 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.11.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0357a6402b295ca3a86bc148e84df46c02e41f41fef186bda662557ef6328aa" +checksum = "a35b255461940a32985c627ce82900867c61db1659764d3675ea81963f72a4c6" dependencies = [ "smallvec", ] +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + [[package]] name = "cfg-if" version = "1.0.0" @@ -257,7 +307,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "cocoa-foundation", "core-foundation", @@ -269,11 +319,11 @@ dependencies = [ [[package]] name = "cocoa-foundation" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" +checksum = "931d3837c286f56e3c58423ce4eba12d08db2374461a785c86f672b08b5650d6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "core-foundation", "core-graphics-types", @@ -294,10 +344,23 @@ version = "4.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" dependencies = [ - "bytes", + "bytes 1.4.0", "memchr", ] +[[package]] +name = "console" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.42.0", +] + [[package]] name = "convert_case" version = "0.4.0" @@ -316,9 +379,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "core-graphics" @@ -326,7 +389,7 @@ version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-graphics-types", "foreign-types", @@ -339,7 +402,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "foreign-types", "libc", @@ -347,9 +410,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" dependencies = [ "libc", ] @@ -360,50 +423,50 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] name = "crossbeam-channel" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.13" +version = "0.9.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" +checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" dependencies = [ "autocfg", - "cfg-if", + "cfg-if 1.0.0", "crossbeam-utils", - "memoffset 0.7.1", + "memoffset", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -436,7 +499,7 @@ dependencies = [ "proc-macro2", "quote", "smallvec", - "syn", + "syn 1.0.109", ] [[package]] @@ -446,7 +509,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e" dependencies = [ "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -456,15 +519,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ "quote", - "syn", + "syn 1.0.109", ] -[[package]] -name = "cty" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" - [[package]] name = "darling" version = "0.13.4" @@ -486,7 +543,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 1.0.109", ] [[package]] @@ -497,7 +554,18 @@ checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ "darling_core", "quote", - "syn", + "syn 1.0.109", +] + +[[package]] +name = "dbus" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b" +dependencies = [ + "libc", + "libdbus-sys", + "winapi 0.3.9", ] [[package]] @@ -509,8 +577,8 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version 0.4.0", - "syn", + "rustc_version", + "syn 1.0.109", ] [[package]] @@ -525,9 +593,9 @@ dependencies = [ [[package]] name = "dirs" -version = "4.0.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +checksum = "dece029acd3353e3a58ac2e3eb3c8d6c35827a892edc6cc4138ef9c33df46ecd" dependencies = [ "dirs-sys", ] @@ -538,19 +606,19 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "dirs-sys-next", ] [[package]] name = "dirs-sys" -version = "0.3.7" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +checksum = "04414300db88f70d74c5ff54e50f9e1d1737d9a5b90f53fcf2e95ca2a9ab554b" dependencies = [ "libc", "redox_users", - "winapi", + "windows-sys 0.45.0", ] [[package]] @@ -561,7 +629,7 @@ checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", "redox_users", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -570,6 +638,17 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" +[[package]] +name = "download_rs" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c47d9680cf49ce700aba2ea4991f745fbe06b54b2262ea6bf8e1798f436b2bad" +dependencies = [ + "indicatif", + "reqwest", + "tokio 0.2.25", +] + [[package]] name = "dtoa" version = "0.4.8" @@ -604,58 +683,86 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" [[package]] -name = "encoding_rs" -version = "0.8.31" +name = "encode_unicode" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "encoding_rs" +version = "0.8.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", +] + +[[package]] +name = "errno" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", ] [[package]] name = "exr" -version = "1.5.2" +version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb5f255b5980bb0c8cf676b675d1a99be40f316881444f44e0462eaf5df5ded" +checksum = "bdd2162b720141a91a054640662d3edce3d50a944a50ffca5313cd951abb35b4" dependencies = [ "bit_field", "flume", "half", "lebe", "miniz_oxide", + "rayon-core", "smallvec", - "threadpool", + "zune-inflate", ] [[package]] name = "fastrand" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] [[package]] name = "field-offset" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92" +checksum = "a3cf3a800ff6e860c863ca6d4b16fd999db8b752819c1606884047b73e468535" dependencies = [ - "memoffset 0.6.5", - "rustc_version 0.3.3", + "memoffset", + "rustc_version", ] [[package]] name = "filetime" -version = "0.2.19" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9" +checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", - "redox_syscall", - "windows-sys", + "redox_syscall 0.2.16", + "windows-sys 0.48.0", ] [[package]] @@ -711,6 +818,22 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags 1.3.2", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + [[package]] name = "futf" version = "0.1.5" @@ -723,24 +846,24 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-executor" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" dependencies = [ "futures-core", "futures-task", @@ -749,43 +872,45 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] name = "futures-macro" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.13", ] [[package]] name = "futures-sink" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" [[package]] name = "futures-task" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-util" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-core", + "futures-io", "futures-macro", "futures-task", - "pin-project-lite", + "memchr", + "pin-project-lite 0.2.9", "pin-utils", "slab", ] @@ -805,7 +930,7 @@ version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6e05c1f572ab0e1f15be94217f0dc29088c248b14f792a5ff0af0d84bcda9e8" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cairo-rs", "gdk-pixbuf", "gdk-sys", @@ -821,7 +946,7 @@ version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad38dd9cc8b099cceecdf41375bb6d481b1b5a7cd5cd603e10a69a9383f8619a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "gdk-pixbuf-sys", "gio", "glib", @@ -838,7 +963,7 @@ dependencies = [ "glib-sys", "gobject-sys", "libc", - "system-deps 6.0.3", + "system-deps 6.0.4", ] [[package]] @@ -855,7 +980,7 @@ dependencies = [ "libc", "pango-sys", "pkg-config", - "system-deps 6.0.3", + "system-deps 6.0.4", ] [[package]] @@ -867,28 +992,28 @@ dependencies = [ "gdk-sys", "glib-sys", "libc", - "system-deps 6.0.3", + "system-deps 6.0.4", "x11", ] [[package]] name = "generator" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d266041a359dfa931b370ef684cceb84b166beb14f7f0421f4a6a3d0c446d12e" +checksum = "33a20a288a94683f5f4da0adecdbe095c94a77c295e514cc6484e9394dd8376e" dependencies = [ "cc", "libc", "log", "rustversion", - "windows", + "windows 0.44.0", ] [[package]] name = "generic-array" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -900,18 +1025,18 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", "wasi 0.9.0+wasi-snapshot-preview1", ] [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", @@ -920,9 +1045,9 @@ dependencies = [ [[package]] name = "gif" -version = "0.11.4" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06" +checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045" dependencies = [ "color_quant", "weezl", @@ -934,7 +1059,7 @@ version = "0.15.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68fdbc90312d462781a395f7a16d96a2b379bb6ef8cd6310a2df272771c4283b" dependencies = [ - "bitflags", + "bitflags 1.3.2", "futures-channel", "futures-core", "futures-io", @@ -954,8 +1079,8 @@ dependencies = [ "glib-sys", "gobject-sys", "libc", - "system-deps 6.0.3", - "winapi", + "system-deps 6.0.4", + "winapi 0.3.9", ] [[package]] @@ -964,7 +1089,7 @@ version = "0.15.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edb0306fbad0ab5428b0ca674a23893db909a98582969c9b537be4ced78c505d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "futures-channel", "futures-core", "futures-executor", @@ -980,17 +1105,17 @@ dependencies = [ [[package]] name = "glib-macros" -version = "0.15.11" +version = "0.15.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a68131a662b04931e71891fb14aaf65ee4b44d08e8abc10f49e77418c86c64" +checksum = "10c6ae9f6fa26f4fb2ac16b528d138d971ead56141de489f8111e259b9df3c4a" dependencies = [ "anyhow", - "heck 0.4.0", + "heck 0.4.1", "proc-macro-crate", "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1000,7 +1125,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef4b192f8e65e9cf76cbf4ea71fa8e3be4a0e18ffe3d68b8da6836974cc5bad4" dependencies = [ "libc", - "system-deps 6.0.3", + "system-deps 6.0.4", ] [[package]] @@ -1011,9 +1136,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a" +checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" dependencies = [ "aho-corasick", "bstr", @@ -1030,7 +1155,7 @@ checksum = "0d57ce44246becd17153bd035ab4d32cfee096a657fc01f2231c9278378d1e0a" dependencies = [ "glib-sys", "libc", - "system-deps 6.0.3", + "system-deps 6.0.4", ] [[package]] @@ -1040,7 +1165,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92e3004a2d5d6d8b5057d2b57b3712c9529b62e82c77f25c1fecde1fd5c23bd0" dependencies = [ "atk", - "bitflags", + "bitflags 1.3.2", "cairo-rs", "field-offset", "futures-channel", @@ -1071,21 +1196,41 @@ dependencies = [ "gobject-sys", "libc", "pango-sys", - "system-deps 6.0.3", + "system-deps 6.0.4", ] [[package]] name = "gtk3-macros" -version = "0.15.4" +version = "0.15.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24f518afe90c23fba585b2d7697856f9e6a7bbc62f65588035e66f6afb01a2e9" +checksum = "684c0456c086e8e7e9af73ec5b84e35938df394712054550e81558d21c44ab0d" dependencies = [ "anyhow", "proc-macro-crate", "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.109", +] + +[[package]] +name = "h2" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" +dependencies = [ + "bytes 0.5.6", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio 0.2.25", + "tokio-util", + "tracing", + "tracing-futures", ] [[package]] @@ -1114,9 +1259,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -1127,13 +1272,19 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "home" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1147,18 +1298,28 @@ dependencies = [ "markup5ever", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "http" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ - "bytes", + "bytes 1.4.0", "fnv", - "itoa 1.0.5", + "itoa 1.0.6", +] + +[[package]] +name = "http-body" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +dependencies = [ + "bytes 0.5.6", + "http", ] [[package]] @@ -1167,6 +1328,55 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" + +[[package]] +name = "hyper" +version = "0.13.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" +dependencies = [ + "bytes 0.5.6", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa 0.4.8", + "pin-project", + "socket2", + "tokio 0.2.25", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" +dependencies = [ + "bytes 0.5.6", + "hyper", + "native-tls", + "tokio 0.2.25", + "tokio-tls", +] + [[package]] name = "ico" version = "0.2.0" @@ -1213,9 +1423,9 @@ dependencies = [ [[package]] name = "image" -version = "0.24.5" +version = "0.24.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69b7ea949b537b0fd0af141fff8c77690f2ce96f4f41f042ccb6c69c6c965945" +checksum = "527909aa81e20ac3a44803521443a765550f09b5130c2c2fa1ea59c2f8f50a3a" dependencies = [ "bytemuck", "byteorder", @@ -1226,20 +1436,32 @@ dependencies = [ "num-rational", "num-traits", "png", - "scoped_threadpool", + "qoi", "tiff", ] [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown", ] +[[package]] +name = "indicatif" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8572bccfb0665e70b7faf44ee28841b8e0823450cd4ad562a76b5a3c4bf48487" +dependencies = [ + "console", + "lazy_static", + "number_prefix", + "regex", +] + [[package]] name = "infer" version = "0.7.0" @@ -1255,9 +1477,35 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] +[[package]] +name = "io-lifetimes" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +dependencies = [ + "hermit-abi 0.3.1", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + +[[package]] +name = "ipnet" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" + [[package]] name = "itoa" version = "0.4.8" @@ -1266,9 +1514,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "javascriptcore-rs" @@ -1276,7 +1524,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf053e7843f2812ff03ef5afe34bb9c06ffee120385caad4f6b9967fcd37d41c" dependencies = [ - "bitflags", + "bitflags 1.3.2", "glib", "javascriptcore-rs-sys", ] @@ -1324,9 +1572,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] @@ -1342,6 +1590,16 @@ dependencies = [ "treediff", ] +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "kuchiki" version = "0.8.1" @@ -1367,10 +1625,53 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] -name = "libc" -version = "0.2.139" +name = "libappindicator" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "db2d3cb96d092b4824cb306c9e544c856a4cb6210c1081945187f7f1924b47e8" +dependencies = [ + "glib", + "gtk", + "gtk-sys", + "libappindicator-sys", + "log", +] + +[[package]] +name = "libappindicator-sys" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1b3b6681973cea8cc3bce7391e6d7d5502720b80a581c9a95c9cbaf592826aa" +dependencies = [ + "gtk-sys", + "libloading", + "once_cell", +] + +[[package]] +name = "libc" +version = "0.2.141" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" + +[[package]] +name = "libdbus-sys" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f8d7ae751e1cb825c840ae5e682f59b098cdfd213c350ac268b61449a5f58a0" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if 1.0.0", + "winapi 0.3.9", +] [[package]] name = "line-wrap" @@ -1381,6 +1682,12 @@ dependencies = [ "safemem", ] +[[package]] +name = "linux-raw-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" + [[package]] name = "lock_api" version = "0.4.9" @@ -1397,7 +1704,7 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -1406,7 +1713,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "generator", "scoped-tls", "serde", @@ -1421,6 +1728,19 @@ 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" @@ -1467,20 +1787,27 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.6.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" dependencies = [ "autocfg", ] [[package]] -name = "memoffset" -version = "0.7.1" +name = "mime" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" dependencies = [ - "autocfg", + "mime", + "unicase", ] [[package]] @@ -1492,13 +1819,94 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +dependencies = [ + "cfg-if 0.1.10", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow 0.2.2", + "net2", + "slab", + "winapi 0.2.8", +] + +[[package]] +name = "mio-named-pipes" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" +dependencies = [ + "log", + "mio", + "miow 0.3.7", + "winapi 0.3.9", +] + +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio", +] + +[[package]] +name = "miow" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "nanorand" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", +] + +[[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]] @@ -1507,7 +1915,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" dependencies = [ - "bitflags", + "bitflags 1.3.2", "jni-sys", "ndk-sys", "num_enum", @@ -1529,6 +1937,17 @@ dependencies = [ "jni-sys", ] +[[package]] +name = "net2" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "winapi 0.3.9", +] + [[package]] name = "new_debug_unreachable" version = "1.0.4" @@ -1541,6 +1960,18 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +[[package]] +name = "notify-rust" +version = "4.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bfa211d18e360f08e36c364308f394b5eb23a6629150690e109a916dc6f610e" +dependencies = [ + "dbus", + "log", + "mac-notification-sys", + "tauri-winrt-notification", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1548,7 +1979,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" dependencies = [ "overload", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1587,39 +2018,36 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] [[package]] name = "num_enum" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d829733185c1ca374f17e52b762f24f535ec625d2cc1f070e34c8a9068f341b" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2be1598bf1c313dcdd12092e3f1920f463462525a21b7b4e11b4168353d0123e" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] -name = "num_threads" -version = "0.1.6" +name = "number_prefix" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] +checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" [[package]] name = "objc" @@ -1631,6 +2059,17 @@ 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" @@ -1651,9 +2090,84 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" + +[[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.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d2f106ab837a24e03672c59b1239669a0596406ff657c3c0835b6b7f0f35a33" +dependencies = [ + "bitflags 1.3.2", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.13", +] + +[[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.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a20eace9dc2d82904039cb76dcf50fb1a0bba071cfd1629720b5d6f1ddba0fa" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "os_info" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "006e42d5b888366f1880eda20371fedde764ed2213dc8496f49622fa0c99cd5e" +dependencies = [ + "log", + "serde", + "winapi 0.3.9", +] + +[[package]] +name = "os_pipe" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a53dbb20faf34b16087a931834cba2d7a73cc74af2b7ef345a4c8324e2409a12" +dependencies = [ + "libc", + "windows-sys 0.45.0", +] [[package]] name = "overload" @@ -1667,7 +2181,7 @@ version = "0.15.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22e4045548659aee5313bde6c582b0d83a627b7904dd20dc2d9ef0895d414e4f" dependencies = [ - "bitflags", + "bitflags 1.3.2", "glib", "libc", "once_cell", @@ -1683,7 +2197,7 @@ dependencies = [ "glib-sys", "gobject-sys", "libc", - "system-deps 6.0.3", + "system-deps 6.0.4", ] [[package]] @@ -1698,22 +2212,28 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "paste" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" +checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" + +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" [[package]] name = "percent-encoding" @@ -1721,16 +2241,6 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" -[[package]] -name = "pest" -version = "2.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ab62d2fa33726dbe6321cc97ef96d8cde531e3eeaf858a058de53a8a6d40d8f" -dependencies = [ - "thiserror", - "ucd-trie", -] - [[package]] name = "phf" version = "0.8.0" @@ -1794,7 +2304,7 @@ dependencies = [ "proc-macro-hack", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1808,7 +2318,7 @@ dependencies = [ "proc-macro-hack", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1846,9 +2356,15 @@ checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] +[[package]] +name = "pin-project-lite" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" + [[package]] name = "pin-project-lite" version = "0.2.9" @@ -1869,14 +2385,14 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "plist" -version = "1.4.0" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5329b8f106a176ab0dce4aae5da86bfcb139bb74fb00882859e03745011f3635" +checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590" dependencies = [ - "base64", + "base64 0.21.0", "indexmap", "line-wrap", - "quick-xml", + "quick-xml 0.28.1", "serde", "time", ] @@ -1887,7 +2403,7 @@ version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d708eaf860a19b19ce538740d2b4bdeeb8337fa53f7738455e706623ad5c638" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crc32fast", "flate2", "miniz_oxide", @@ -1907,13 +2423,12 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] @@ -1925,7 +2440,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "version_check", ] @@ -1948,27 +2463,45 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] [[package]] -name = "quick-xml" -version = "0.26.0" +name = "qoi" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f50b1c63b38611e7d4d7f68b82d3ad0cc71a2ad2e7f61fc10f1328d917c93cd" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "quick-xml" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11bafc859c6815fbaffbbbf4229ecb767ac913fecb27f9ad4343662e9ef099ea" +dependencies = [ + "memchr", +] + +[[package]] +name = "quick-xml" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5c1a97b1bc42b1d550bfb48d4262153fe400a12bab1511821736f7eac76d7e2" dependencies = [ "memchr", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] @@ -2033,7 +2566,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", ] [[package]] @@ -2056,18 +2589,15 @@ dependencies = [ [[package]] name = "raw-window-handle" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed7e3d950b66e19e0c372f3fa3fbbcf85b1746b571f74e0c2af6042a5c93420a" -dependencies = [ - "cty", -] +checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" [[package]] name = "rayon" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" dependencies = [ "either", "rayon-core", @@ -2075,9 +2605,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.10.2" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -2091,7 +2621,16 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", ] [[package]] @@ -2100,16 +2639,16 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.8", - "redox_syscall", + "getrandom 0.2.9", + "redox_syscall 0.2.16", "thiserror", ] [[package]] name = "regex" -version = "1.7.1" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" dependencies = [ "aho-corasick", "memchr", @@ -2127,26 +2666,67 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] -name = "remove_dir_all" -version = "0.5.3" +name = "reqwest" +version = "0.10.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c" dependencies = [ - "winapi", + "base64 0.13.1", + "bytes 0.5.6", + "encoding_rs", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "lazy_static", + "log", + "mime", + "mime_guess", + "native-tls", + "percent-encoding", + "pin-project-lite 0.2.9", + "serde", + "serde_urlencoded", + "tokio 0.2.25", + "tokio-tls", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", ] [[package]] -name = "rustc_version" -version = "0.3.3" +name = "rfd" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +checksum = "0149778bd99b6959285b0933288206090c50e2327f47a9c463bfdbf45c8823ea" dependencies = [ - "semver 0.11.0", + "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]] @@ -2155,20 +2735,34 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.16", + "semver", +] + +[[package]] +name = "rustix" +version = "0.37.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", ] [[package]] name = "rustversion" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" +checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" [[package]] name = "ryu" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "safemem" @@ -2185,31 +2779,57 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys 0.42.0", +] + [[package]] name = "scoped-tls" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" - [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "security-framework" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "selectors" version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df320f1889ac4ba6bc0cdc9c9af7af4bd64bb927bccdf32d81140dc1f9be12fe" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cssparser", "derive_more", "fxhash", @@ -2225,71 +2845,74 @@ dependencies = [ [[package]] name = "semver" -version = "0.11.0" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" +checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" dependencies = [ "serde", ] -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - [[package]] name = "serde" -version = "1.0.152" +version = "1.0.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.13", ] [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744" dependencies = [ - "itoa 1.0.5", + "itoa 1.0.6", "ryu", "serde", ] [[package]] name = "serde_repr" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e" +checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.13", +] + +[[package]] +name = "serde_spanned" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +dependencies = [ + "serde", +] + +[[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.6", + "ryu", + "serde", ] [[package]] @@ -2311,7 +2934,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2333,7 +2956,7 @@ checksum = "74064874e9f6a15f04c1f3cb627902d0e6b410abbf36668afa873c61889f1763" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2352,7 +2975,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "cpufeatures", "digest", ] @@ -2366,6 +2989,31 @@ 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 0.3.9", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "238abfbb77c1915110ad968465608b68e869e0772622c9656714e73e5a1a522f" + [[package]] name = "siphasher" version = "0.3.10" @@ -2374,9 +3022,9 @@ checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -2387,13 +3035,24 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "socket2" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "winapi 0.3.9", +] + [[package]] name = "soup2" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2b4d76501d8ba387cf0fefbe055c3e0a59891d09f0f995ae4e4b16f6b60f3c0" dependencies = [ - "bitflags", + "bitflags 1.3.2", "gio", "glib", "libc", @@ -2407,7 +3066,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "009ef427103fcb17f802871647a7fa6c60cbb654b4c4e4c0ac60a31c5f6dc9cf" dependencies = [ - "bitflags", + "bitflags 1.3.2", "gio-sys", "glib-sys", "gobject-sys", @@ -2417,9 +3076,9 @@ dependencies = [ [[package]] name = "spin" -version = "0.9.4" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" dependencies = [ "lock_api", ] @@ -2441,9 +3100,9 @@ dependencies = [ [[package]] name = "string_cache" -version = "0.8.4" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" dependencies = [ "new_debug_unreachable", "once_cell", @@ -2472,10 +3131,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] -name = "syn" -version = "1.0.107" +name = "strum" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +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 1.0.109", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" dependencies = [ "proc-macro2", "quote", @@ -2491,20 +3182,20 @@ dependencies = [ "cfg-expr 0.9.1", "heck 0.3.3", "pkg-config", - "toml", + "toml 0.5.11", "version-compare 0.0.11", ] [[package]] name = "system-deps" -version = "6.0.3" +version = "6.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2955b1fe31e1fa2fbd1976b71cc69a606d7d4da16f6de3333d0c92d51419aeff" +checksum = "555fc8147af6256f3931a36bb83ad0023240ce9cf2b319dec8236fd1f220b05f" dependencies = [ - "cfg-expr 0.11.0", - "heck 0.4.0", + "cfg-expr 0.14.0", + "heck 0.4.1", "pkg-config", - "toml", + "toml 0.7.3", "version-compare 0.1.1", ] @@ -2514,13 +3205,14 @@ version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac8e6399427c8494f9849b58694754d7cc741293348a6836b6c8d2c5aa82d8e6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cairo-rs", "cc", "cocoa", "core-foundation", "core-graphics", "crossbeam-channel", + "dirs-next", "dispatch", "gdk", "gdk-pixbuf", @@ -2534,6 +3226,7 @@ dependencies = [ "instant", "jni", "lazy_static", + "libappindicator", "libc", "log", "ndk", @@ -2548,8 +3241,8 @@ dependencies = [ "scopeguard", "serde", "unicode-segmentation", - "uuid 1.2.2", - "windows", + "uuid 1.3.0", + "windows 0.39.0", "windows-implement", "x11-dl", ] @@ -2572,6 +3265,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe7e0f1d535e7cbbbab43c82be4fc992b84f9156c16c160955617e0260ebc449" dependencies = [ "anyhow", + "attohttpc", "cocoa", "dirs-next", "embed_plist", @@ -2581,19 +3275,26 @@ dependencies = [ "glib", "glob", "gtk", - "heck 0.4.0", + "heck 0.4.1", "http", "ignore", + "notify-rust", "objc", "once_cell", + "open", + "os_info", + "os_pipe", "percent-encoding", "rand 0.8.5", "raw-window-handle", - "semver 1.0.16", + "regex", + "rfd", + "semver", "serde", "serde_json", "serde_repr", "serialize-to-javascript", + "shared_child", "state", "tar", "tauri-macros", @@ -2602,12 +3303,12 @@ dependencies = [ "tauri-utils", "tempfile", "thiserror", - "tokio", + "tokio 1.27.0", "url", - "uuid 1.2.2", + "uuid 1.3.0", "webkit2gtk", "webview2-com", - "windows", + "windows 0.39.0", ] [[package]] @@ -2618,9 +3319,9 @@ checksum = "8807c85d656b2b93927c19fe5a5f1f1f348f96c2de8b90763b3c2d561511f9b4" dependencies = [ "anyhow", "cargo_toml", - "heck 0.4.0", + "heck 0.4.1", "json-patch", - "semver 1.0.16", + "semver", "serde_json", "tauri-utils", "winres", @@ -2632,7 +3333,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14388d484b6b1b5dc0f6a7d6cc6433b3b230bec85eaa576adcdf3f9fafa49251" dependencies = [ - "base64", + "base64 0.13.1", "brotli", "ico", "json-patch", @@ -2640,14 +3341,15 @@ dependencies = [ "png", "proc-macro2", "quote", - "semver 1.0.16", + "regex", + "semver", "serde", "serde_json", "sha2", "tauri-utils", "thiserror", "time", - "uuid 1.2.2", + "uuid 1.3.0", "walkdir", ] @@ -2657,14 +3359,28 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "069319e5ecbe653a799b94b0690d9f9bf5d00f7b1d3989aa331c524d4e354075" dependencies = [ - "heck 0.4.0", + "heck 0.4.1", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "tauri-codegen", "tauri-utils", ] +[[package]] +name = "tauri-plugin-window-state" +version = "0.1.0" +source = "git+https://github.com/tauri-apps/plugins-workspace?branch=dev#cea1d4f7b54b94354e8100daf804b810c680efd7" +dependencies = [ + "bincode", + "bitflags 2.1.0", + "log", + "serde", + "serde_json", + "tauri", + "thiserror", +] + [[package]] name = "tauri-runtime" version = "0.12.1" @@ -2680,9 +3396,9 @@ dependencies = [ "serde_json", "tauri-utils", "thiserror", - "uuid 1.2.2", + "uuid 1.3.0", "webview2-com", - "windows", + "windows 0.39.0", ] [[package]] @@ -2698,10 +3414,10 @@ dependencies = [ "raw-window-handle", "tauri-runtime", "tauri-utils", - "uuid 1.2.2", + "uuid 1.3.0", "webkit2gtk", "webview2-com", - "windows", + "windows 0.39.0", "wry", ] @@ -2714,7 +3430,7 @@ dependencies = [ "brotli", "ctor", "glob", - "heck 0.4.0", + "heck 0.4.1", "html5ever", "infer", "json-patch", @@ -2723,28 +3439,38 @@ dependencies = [ "phf 0.10.1", "proc-macro2", "quote", - "semver 1.0.16", + "semver", "serde", "serde_json", "serde_with", "thiserror", "url", "walkdir", - "windows", + "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 0.23.1", + "strum", + "windows 0.39.0", ] [[package]] name = "tempfile" -version = "3.3.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", + "redox_syscall 0.3.5", + "rustix", + "windows-sys 0.45.0", ] [[package]] @@ -2766,42 +3492,34 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.13", ] [[package]] name = "thread_local" -version = "1.1.4" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ + "cfg-if 1.0.0", "once_cell", ] -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - [[package]] name = "tiff" version = "0.8.1" @@ -2815,13 +3533,29 @@ dependencies = [ [[package]] name = "time" -version = "0.3.15" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d634a985c4d4238ec39cacaed2e7ae552fbd3c476b552c1deac3021b7d7eaf0c" +checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" dependencies = [ - "itoa 1.0.5", - "libc", - "num_threads", + "itoa 1.0.6", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" + +[[package]] +name = "time-macros" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" +dependencies = [ + "time-core", ] [[package]] @@ -2835,22 +3569,80 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.25.0" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" +dependencies = [ + "bytes 0.5.6", + "fnv", + "futures-core", + "iovec", + "lazy_static", + "libc", + "memchr", + "mio", + "mio-named-pipes", + "mio-uds", + "num_cpus", + "pin-project-lite 0.1.12", + "signal-hook-registry", + "slab", + "tokio-macros", + "winapi 0.3.9", +] + +[[package]] +name = "tokio" +version = "1.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" dependencies = [ "autocfg", - "bytes", - "memchr", + "bytes 1.4.0", "num_cpus", - "pin-project-lite", - "windows-sys", + "pin-project-lite 0.2.9", + "windows-sys 0.45.0", +] + +[[package]] +name = "tokio-macros" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "tokio-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" +dependencies = [ + "native-tls", + "tokio 0.2.25", +] + +[[package]] +name = "tokio-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +dependencies = [ + "bytes 0.5.6", + "futures-core", + "futures-sink", + "log", + "pin-project-lite 0.1.12", + "tokio 0.2.25", ] [[package]] @@ -2862,14 +3654,55 @@ dependencies = [ "serde", ] +[[package]] +name = "toml" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if", - "pin-project-lite", + "cfg-if 1.0.0", + "log", + "pin-project-lite 0.2.9", "tracing-attributes", "tracing-core", ] @@ -2882,7 +3715,7 @@ checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2895,6 +3728,16 @@ dependencies = [ "valuable", ] +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + [[package]] name = "tracing-log" version = "0.1.3" @@ -2933,6 +3776,12 @@ dependencies = [ "serde_json", ] +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + [[package]] name = "typenum" version = "1.16.0" @@ -2940,22 +3789,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] -name = "ucd-trie" -version = "0.1.5" +name = "unicase" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] [[package]] name = "unicode-bidi" -version = "0.3.10" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "unicode-normalization" @@ -2972,6 +3824,12 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + [[package]] name = "url" version = "2.3.1" @@ -2998,11 +3856,11 @@ checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" [[package]] name = "uuid" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c" +checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" dependencies = [ - "getrandom 0.2.8", + "getrandom 0.2.9", ] [[package]] @@ -3011,6 +3869,12 @@ 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" @@ -3031,15 +3895,24 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.2" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" dependencies = [ "same-file", - "winapi", "winapi-util", ] +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -3054,34 +3927,48 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", + "serde", + "serde_json", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] [[package]] -name = "wasm-bindgen-macro" -version = "0.2.83" +name = "wasm-bindgen-futures" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3089,57 +3976,40 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "web-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" dependencies = [ "js-sys", "wasm-bindgen", ] -[[package]] -name = "webbrowser" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d1fa1e5c829b2bf9eb1e28fb950248b797cd6a04866fbdfa8bc31e5eef4c78" -dependencies = [ - "core-foundation", - "dirs", - "jni", - "log", - "ndk-context", - "objc", - "raw-window-handle", - "url", - "web-sys", -] - [[package]] name = "webkit2gtk" version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8f859735e4a452aeb28c6c56a852967a8a76c8eb1cc32dbf931ad28a13d6370" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cairo-rs", "gdk", "gdk-sys", @@ -3164,7 +4034,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d76ca6ecc47aeba01ec61e480139dda143796abcae6f83bcddf50d6b5b1dcf3" dependencies = [ "atk-sys", - "bitflags", + "bitflags 1.3.2", "cairo-sys-rs", "gdk-pixbuf-sys", "gdk-sys", @@ -3177,7 +4047,7 @@ dependencies = [ "pango-sys", "pkg-config", "soup2-sys", - "system-deps 6.0.3", + "system-deps 6.0.4", ] [[package]] @@ -3188,7 +4058,7 @@ checksum = "b4a769c9f1a64a8734bde70caafac2b96cada12cd4aefa49196b3a386b8b4178" dependencies = [ "webview2-com-macros", "webview2-com-sys", - "windows", + "windows 0.39.0", "windows-implement", ] @@ -3200,7 +4070,7 @@ checksum = "eaebe196c01691db62e9e4ca52c5ef1e4fd837dcae27dae3ada599b5a8fd05ac" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -3213,7 +4083,7 @@ dependencies = [ "serde", "serde_json", "thiserror", - "windows", + "windows 0.39.0", "windows-bindgen", "windows-metadata", ] @@ -3224,6 +4094,12 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + [[package]] name = "winapi" version = "0.3.9" @@ -3234,6 +4110,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -3246,7 +4128,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3255,6 +4137,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[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" @@ -3269,6 +4164,15 @@ dependencies = [ "windows_x86_64_msvc 0.39.0", ] +[[package]] +name = "windows" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-bindgen" version = "0.39.0" @@ -3285,7 +4189,7 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba01f98f509cb5dc05f4e5fc95e535f78260f15fea8fe1a8abdd08f774f1cee7" dependencies = [ - "syn", + "syn 1.0.109", "windows-tokens", ] @@ -3301,13 +4205,61 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] @@ -3318,9 +4270,21 @@ checksum = "f838de2fe15fe6bac988e74b798f26499a8b21a9d97edec321e79b28d1d7f597" [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + +[[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" @@ -3330,9 +4294,21 @@ checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + +[[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" @@ -3342,9 +4318,21 @@ checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + +[[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" @@ -3354,9 +4342,21 @@ checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + +[[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" @@ -3366,15 +4366,33 @@ checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + +[[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" @@ -3384,9 +4402,33 @@ checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + +[[package]] +name = "winnow" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +dependencies = [ + "winapi 0.3.9", +] [[package]] name = "winres" @@ -3394,7 +4436,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" dependencies = [ - "toml", + "toml 0.5.11", ] [[package]] @@ -3403,7 +4445,7 @@ version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c1ad8e2424f554cc5bdebe8aa374ef5b433feff817aebabca0389961fc7ef98" dependencies = [ - "base64", + "base64 0.13.1", "block", "cocoa", "core-graphics", @@ -3431,10 +4473,20 @@ dependencies = [ "webkit2gtk", "webkit2gtk-sys", "webview2-com", - "windows", + "windows 0.39.0", "windows-implement", ] +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "x11" version = "2.21.0" @@ -3464,3 +4516,12 @@ checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" dependencies = [ "libc", ] + +[[package]] +name = "zune-inflate" +version = "0.2.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "440a08fd59c6442e4b846ea9b10386c38307eae728b216e1ab2c305d1c9daaf8" +dependencies = [ + "simd-adler32", +] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index fe127cb..b40edcc 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "app" version = "0.1.0" -description = "Pake 打包工具" +description = "🤱🏻 Turn any webpage into a desktop app with Rust." authors = ["Tw93"] -license = "" -repository = "" +license = "MIT" +repository = "https://github.com/tw93/Pake" default-run = "app" edition = "2021" rust-version = "1.63.0" @@ -15,15 +15,15 @@ rust-version = "1.63.0" tauri-build = { version = "1.2.1", features = [] } [dependencies] -serde_json = "1.0.91" -serde = { version = "1.0.152", features = ["derive"] } -tauri = { version = "1.2.4", features = [] } +serde_json = "1.0.89" +serde = { version = "1.0.150", features = ["derive"] } +tauri = { version = "1.2.1", features = ["api-all", "devtools", "system-tray"] } image = "0.24.5" -home = "0.5.4" -tauri-utils = "1.2.1" -webbrowser = "0.8.7" -wry = "0.23.4" -dirs = "4.0" +home = "0.5" +dirs = "5.0" +libc = "0.2" +download_rs = { version = "0.2.0", features = ["sync_download"] } +tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } [features] # by default Tauri runs in production mode @@ -32,5 +32,3 @@ default = ["custom-protocol"] # this feature is used used for production builds where `devPath` points to the filesystem # DO NOT remove this custom-protocol = ["tauri/custom-protocol"] -# Enable DevTools for debugging. -devtools = [] diff --git a/src-tauri/pake.json b/src-tauri/pake.json new file mode 100644 index 0000000..a97dcc7 --- /dev/null +++ b/src-tauri/pake.json @@ -0,0 +1,28 @@ +{ + "windows": [ + { + "url": "https://weread.qq.com/", + "transparent": true, + "fullscreen": false, + "width": 1200, + "height": 780, + "resizable": true, + "url_type": "web" + } + ], + "user_agent": { + "macos": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15", + "linux": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", + "windows": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" + }, + "menu": { + "macos": true, + "linux": false, + "windows": false + }, + "system_tray": { + "macos": false, + "linux": true, + "windows": true + } +} diff --git a/src-tauri/src/app/config.rs b/src-tauri/src/app/config.rs new file mode 100644 index 0000000..048e202 --- /dev/null +++ b/src-tauri/src/app/config.rs @@ -0,0 +1,63 @@ +use serde::Deserialize; + +#[derive(Debug, Deserialize)] +pub struct WindowConfig { + pub url: String, + pub transparent: bool, + pub fullscreen: bool, + pub width: f64, + pub height: f64, + pub resizable: bool, + pub url_type: String, +} + +#[derive(Debug, Deserialize)] +pub struct PlatformSpecific { + pub macos: T, + pub linux: T, + pub windows: T, +} + +impl PlatformSpecific { + pub const fn get(&self) -> &T { + #[cfg(target_os = "macos")] + let platform = &self.macos; + #[cfg(target_os = "linux")] + let platform = &self.linux; + #[cfg(target_os = "windows")] + let platform = &self.windows; + + platform + } +} + +impl PlatformSpecific +where + T: Copy, +{ + pub const fn copied(&self) -> T { + *self.get() + } +} + +pub type UserAgent = PlatformSpecific; +pub type FunctionON = PlatformSpecific; + +#[derive(Debug, Deserialize)] +pub struct PakeConfig { + pub windows: Vec, + pub user_agent: UserAgent, + pub menu: FunctionON, + pub system_tray: FunctionON, +} + +impl PakeConfig { + pub fn show_menu(&self) -> bool { + self.menu.copied() + } + + #[cfg(not(target_os = "macos"))] + pub fn show_system_tray(&self) -> bool { + self.system_tray.copied() + } +} diff --git a/src-tauri/src/app/invoke.rs b/src-tauri/src/app/invoke.rs new file mode 100644 index 0000000..97df997 --- /dev/null +++ b/src-tauri/src/app/invoke.rs @@ -0,0 +1,47 @@ +use crate::util::{check_file_or_append, get_download_message, show_toast}; +use download_rs::sync_download::Download; +use tauri::{api, command, AppHandle, Manager, Window}; + +#[derive(serde::Deserialize)] +pub struct DownloadFileParams { + url: String, + filename: String, +} + +#[command] +pub fn drag_window(app: AppHandle) { + app.get_window("pake").unwrap().start_dragging().unwrap(); +} + +#[command] +pub fn fullscreen(app: AppHandle) { + let win = app.get_window("pake").unwrap(); + if win.is_fullscreen().unwrap() { + win.set_fullscreen(false).unwrap(); + } else { + win.set_fullscreen(true).unwrap(); + } +} + +#[tauri::command] +pub fn open_browser(app: AppHandle, url: String) { + api::shell::open(&app.shell_scope(), url, None).unwrap(); +} + +#[command] +pub async fn download_file(app: AppHandle, params: DownloadFileParams) -> Result<(), String> { + let window: Window = app.get_window("pake").unwrap(); + let output_path = api::path::download_dir().unwrap().join(params.filename); + let file_path = check_file_or_append(output_path.to_str().unwrap()); + let download = Download::new(¶ms.url, Some(&file_path), None); + match download.download() { + Ok(_) => { + show_toast(&window, &get_download_message()); + Ok(()) + } + Err(e) => { + show_toast(&window, &e.to_string()); + Err(e.to_string()) + } + } +} diff --git a/src-tauri/src/app/menu.rs b/src-tauri/src/app/menu.rs new file mode 100644 index 0000000..cfab669 --- /dev/null +++ b/src-tauri/src/app/menu.rs @@ -0,0 +1,106 @@ +use tauri::MenuItem; + +use tauri::{CustomMenuItem, Menu, Submenu, WindowMenuEvent}; + +#[cfg(any(target_os = "linux", target_os = "windows"))] +use tauri::{Manager, SystemTray, SystemTrayEvent, SystemTrayMenu, WindowBuilder, WindowUrl}; + +#[cfg(any(target_os = "linux", target_os = "windows"))] +use tauri_plugin_window_state::{AppHandleExt, StateFlags}; + +pub fn get_menu() -> Menu { + let close = CustomMenuItem::new("close".to_string(), "Close Window").accelerator("CmdOrCtrl+W"); + let first_menu = Menu::new() + .add_native_item(MenuItem::Copy) + .add_native_item(MenuItem::Cut) + .add_native_item(MenuItem::Paste) + .add_native_item(MenuItem::Undo) + .add_native_item(MenuItem::Redo) + .add_native_item(MenuItem::SelectAll) + .add_native_item(MenuItem::Separator) + .add_native_item(MenuItem::EnterFullScreen) + .add_native_item(MenuItem::Minimize) + .add_native_item(MenuItem::Hide) + .add_native_item(MenuItem::HideOthers) + .add_native_item(MenuItem::ShowAll) + .add_native_item(MenuItem::Separator) + .add_item(close) + .add_native_item(MenuItem::Quit); + + let app_menu = Submenu::new("File", first_menu); + Menu::new().add_submenu(app_menu) +} + +pub fn menu_event_handle(event: WindowMenuEvent) { + if event.menu_item_id() == "close" { + event.window().minimize().expect("can't minimize window"); + } +} + +#[cfg(any(target_os = "linux", target_os = "windows"))] +pub fn get_system_tray(show_menu: bool) -> SystemTray { + let hide_app = CustomMenuItem::new("hide_app".to_string(), "Hide App"); + let show_app = CustomMenuItem::new("show_app".to_string(), "Show App"); + let quit = CustomMenuItem::new("quit".to_string(), "Quit"); + let about = CustomMenuItem::new("about".to_string(), "About"); + let tray_menu = SystemTrayMenu::new().add_item(hide_app).add_item(show_app); + if show_menu { + let hide_menu = CustomMenuItem::new("hide_menu".to_string(), "Hide Menu"); + let show_menu = CustomMenuItem::new("show_menu".to_string(), "Show Menu"); + let tray_menu = tray_menu + .add_item(hide_menu) + .add_item(show_menu) + .add_item(quit) + .add_item(about); + SystemTray::new().with_menu(tray_menu) + } else { + let tray_menu = tray_menu.add_item(quit).add_item(about); + SystemTray::new().with_menu(tray_menu) + } +} + +#[cfg(any(target_os = "linux", target_os = "windows"))] +pub fn system_tray_handle(app: &tauri::AppHandle, event: SystemTrayEvent) { + if let SystemTrayEvent::MenuItemClick { tray_id: _, id, .. } = event { + match id.as_str() { + "hide_app" => { + app.get_window("pake").unwrap().hide().unwrap(); + } + "show_app" => { + app.get_window("pake").unwrap().show().unwrap(); + } + "hide_menu" => { + app.get_window("pake") + .unwrap() + .menu_handle() + .hide() + .unwrap(); + } + "show_menu" => { + app.get_window("pake") + .unwrap() + .menu_handle() + .show() + .unwrap(); + } + "quit" => { + let _res = app.save_window_state(StateFlags::all()); + // println!("save windows state result {:?}", _res); + std::process::exit(0); + } + "about" => { + let _about_window = WindowBuilder::new( + app, + "about", + WindowUrl::App(std::path::PathBuf::from("about_pake.html")), + ) + .resizable(true) + .title("About") + .inner_size(600.0, 400.0) + .build() + .expect("can't open about!"); + } + _ => {} + } + }; +} diff --git a/src-tauri/src/app/mod.rs b/src-tauri/src/app/mod.rs new file mode 100644 index 0000000..41ebf62 --- /dev/null +++ b/src-tauri/src/app/mod.rs @@ -0,0 +1,4 @@ +pub mod config; +pub mod invoke; +pub mod menu; +pub mod window; diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rs new file mode 100644 index 0000000..89f86cf --- /dev/null +++ b/src-tauri/src/app/window.rs @@ -0,0 +1,48 @@ +use crate::app::config::PakeConfig; +use std::path::PathBuf; +use tauri::{App, Window, WindowBuilder, WindowUrl}; + +#[cfg(target_os = "macos")] +use tauri::TitleBarStyle; + +pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Window { + let window_config = config + .windows + .first() + .expect("At least one window configuration is required"); + + let user_agent = config.user_agent.get(); + + let url = match window_config.url_type.as_str() { + "web" => WindowUrl::App(window_config.url.parse().unwrap()), + "local" => WindowUrl::App(PathBuf::from(&window_config.url)), + _ => panic!("url type can only be web or local"), + }; + + let mut window_builder = WindowBuilder::new(app, "pake", url) + .title("") + .user_agent(user_agent) + .resizable(window_config.resizable) + .fullscreen(window_config.fullscreen) + .inner_size(window_config.width, window_config.height) + .visible(false) // Prevent initial shaking + .initialization_script(include_str!("../inject/style.js")) + .initialization_script(include_str!("../inject/index.js")); + + #[cfg(target_os = "macos")] + { + let title_bar_style = if window_config.transparent { + TitleBarStyle::Overlay + } else { + TitleBarStyle::Visible + }; + window_builder = window_builder.title_bar_style(title_bar_style) + } + + #[cfg(not(target_os = "macos"))] + { + window_builder = window_builder.data_directory(_data_dir); + } + + window_builder.build().unwrap() +} diff --git a/src-tauri/src/inject/index.js b/src-tauri/src/inject/index.js new file mode 100644 index 0000000..4364aca --- /dev/null +++ b/src-tauri/src/inject/index.js @@ -0,0 +1,170 @@ +const shortcuts = { + ArrowUp: () => scrollTo(0, 0), + ArrowDown: () => scrollTo(0, document.body.scrollHeight), + ArrowLeft: () => window.history.back(), + ArrowRight: () => window.history.forward(), + '[': () => window.history.back(), + ']': () => window.history.forward(), + r: () => window.location.reload(), + '-': () => zoomOut(), + '=': () => zoomIn(), + '+': () => zoomIn(), + 0: () => setZoom('100%'), +}; + +function setZoom(zoom) { + const html = document.getElementsByTagName('html')[0]; + html.style.zoom = zoom; + window.localStorage.setItem('htmlZoom', zoom); +} + +function zoomCommon(zoomChange) { + const currentZoom = window.localStorage.getItem('htmlZoom') || '100%'; + setZoom(zoomChange(currentZoom)); +} + +function zoomIn() { + zoomCommon((currentZoom) => `${Math.min(parseInt(currentZoom) + 10, 200)}%`); +} + +function zoomOut() { + zoomCommon((currentZoom) => `${Math.max(parseInt(currentZoom) - 10, 30)}%`); +} + +function handleShortcut(event) { + if (shortcuts[event.key]) { + event.preventDefault(); + shortcuts[event.key](); + } +} + +//这里参考 ChatGPT 的代码 +const uid = () => window.crypto.getRandomValues(new Uint32Array(1))[0]; +function transformCallback(callback = () => {}, once = false) { + const identifier = uid(); + const prop = `_${identifier}`; + Object.defineProperty(window, prop, { + value: (result) => { + if (once) { + Reflect.deleteProperty(window, prop); + } + return callback(result); + }, + writable: false, + configurable: true, + }); + return identifier; +} +async function invoke(cmd, args) { + return new Promise((resolve, reject) => { + if (!window.__TAURI_POST_MESSAGE__) + reject('__TAURI_POST_MESSAGE__ does not exist~'); + const callback = transformCallback((e) => { + resolve(e); + Reflect.deleteProperty(window, `_${error}`); + }, true); + const error = transformCallback((e) => { + reject(e); + Reflect.deleteProperty(window, `_${callback}`); + }, true); + window.__TAURI_POST_MESSAGE__({ + cmd, + callback, + error, + ...args, + }); + }); +} + +document.addEventListener('DOMContentLoaded', () => { + const topDom = document.createElement('div'); + topDom.id = 'pack-top-dom'; + document.body.appendChild(topDom); + const domEl = document.getElementById('pack-top-dom'); + + domEl.addEventListener('mousedown', (e) => { + e.preventDefault(); + if (e.buttons === 1 && e.detail !== 2) { + invoke('drag_window'); + } + }); + + domEl.addEventListener('touchstart', () => { + invoke('drag_window'); + }); + + domEl.addEventListener('dblclick', () => { + invoke('fullscreen'); + }); + + document.addEventListener('keyup', (event) => { + if (/windows|linux/i.test(navigator.userAgent) && event.ctrlKey) { + handleShortcut(event); + } + if (/macintosh|mac os x/i.test(navigator.userAgent) && event.metaKey) { + handleShortcut(event); + } + }); + + document.addEventListener('click', (e) => { + const anchorElement = e.target.closest('a'); + + if (anchorElement && anchorElement.href) { + const target = anchorElement.target; + anchorElement.target = '_self'; + const hrefUrl = new URL(anchorElement.href); + const absoluteUrl = hrefUrl.href; + + // 处理外部链接跳转 + if (window.location.host !== hrefUrl.host && target === '_blank') { + e.preventDefault(); + invoke('open_browser', { url: absoluteUrl }); + return; + } + + // 处理下载链接让Rust处理 + if (/\.[a-zA-Z0-9]+$/i.test(absoluteUrl)) { + e.preventDefault(); + // invoke('open_browser', { url: absoluteUrl }); + invoke('download_file', { + params: { + url: absoluteUrl, + filename: getFilenameFromUrl(absoluteUrl), + }, + }); + } + } + }); + + setDefaultZoom(); +}); + +function setDefaultZoom() { + const htmlZoom = window.localStorage.getItem('htmlZoom'); + if (htmlZoom) { + setZoom(htmlZoom); + } +} + +function getFilenameFromUrl(url) { + const urlPath = new URL(url).pathname; + const filename = urlPath.substring(urlPath.lastIndexOf('/') + 1); + return filename; +} + +function pakeToast(msg) { + const m = document.createElement('div'); + m.innerHTML = msg; + m.style.cssText = + 'max-width:60%;min-width: 80px;padding:0 12px;height: 32px;color: rgb(255, 255, 255);line-height: 32px;text-align: center;border-radius: 8px;position: fixed; bottom:24px;right: 28px;z-index: 999999;background: rgba(0, 0, 0,.8);font-size: 13px;'; + document.body.appendChild(m); + setTimeout(function () { + const d = 0.5; + m.style.transition = + 'transform ' + d + 's ease-in, opacity ' + d + 's ease-in'; + m.style.opacity = '0'; + setTimeout(function () { + document.body.removeChild(m); + }, d * 1000); + }, 3000); +} diff --git a/src-tauri/src/pake.js b/src-tauri/src/inject/style.js similarity index 88% rename from src-tauri/src/pake.js rename to src-tauri/src/inject/style.js index 2b0bbb3..25470b7 100644 --- a/src-tauri/src/pake.js +++ b/src-tauri/src/inject/style.js @@ -1,39 +1,5 @@ -/** - * @typedef {string} KeyboardKey `event.key` 的代号, - * 见 - * @typedef {() => void} OnKeyDown 使用者按下 [CtrlKey] 或者 ⌘ [KeyboardKey]时应该执行的行为 - * 以 Ctrl键或者Meta 键 (⌘) 为首的快捷键清单。 - * 每个写在这里的 shortcuts 都会运行 {@link Event.preventDefault}. - * @type {Record} - */ - -const metaKeyShortcuts = { - ArrowUp: () => scrollTo(0, 0), - ArrowDown: () => scrollTo(0, document.body.scrollHeight), - "[": () => window.history.back(), - "]": () => window.history.forward(), - r: () => window.location.reload(), - "-": () => zoomOut(), - "=": () => zoomIn(), - "+": () => zoomIn(), - 0: () => zoomCommon(() => "100%"), -}; - -const ctrlKeyShortcuts = { - ArrowUp: () => scrollTo(0, 0), - ArrowDown: () => scrollTo(0, document.body.scrollHeight), - ArrowLeft: () => window.history.back(), - ArrowRight: () => window.history.forward(), - r: () => window.location.reload(), - "-": () => zoomOut(), - "=": () => zoomIn(), - "+": () => zoomIn(), - 0: () => zoomCommon(() => "100%"), -}; - -window.addEventListener("DOMContentLoaded", (_event) => { - const style = document.createElement("style"); - style.innerHTML = ` +window.addEventListener('DOMContentLoaded', (_event) => { + const css = ` #page #footer-wrapper, .drawing-board .toolbar .toolbar-action, .c-swiper-container, @@ -49,6 +15,8 @@ window.addEventListener("DOMContentLoaded", (_event) => { #masthead-ad, #app > header > div > div.menu, #root > div > div.fixed.top-0.left-0.w-64.h-screen.p-10.pb-0.flex.flex-col.justify-between > div > div.space-y-4 > a:nth-child(3), + #app > div.layout > div.main-container > div.side-bar > div, + #app > div.layout > div.main-container > div.side-bar > li.divider, #Rightbar > div:nth-child(6) > div.sidebar_compliance { display: none !important; } @@ -130,7 +98,8 @@ window.addEventListener("DOMContentLoaded", (_event) => { top: 30px; } - .geist-page nav.dashboard_nav__PRmJv { + .geist-page nav.dashboard_nav__PRmJv, + #app > div.layout > div.header-container.showSearchBoxOrHeaderFixed > header > a { padding-top:10px; } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index d9cee38..66a5e33 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1,278 +1,73 @@ -// at the top of main.rs - that will prevent the console from showing -#![windows_subsystem = "windows"] -extern crate image; +#![cfg_attr( + all(not(debug_assertions), target_os = "windows"), + windows_subsystem = "windows" +)] -use dirs::download_dir; -use std::path::PathBuf; -use tauri_utils::config::{Config, WindowConfig}; -use wry::{ - application::{ - event::{Event, StartCause, WindowEvent}, - event_loop::{ControlFlow, EventLoop}, - menu::MenuType, - window::{Fullscreen, Window, WindowBuilder}, - }, - webview::WebViewBuilder, -}; +mod app; +mod util; -#[cfg(target_os = "macos")] -use wry::application::{ - accelerator::{Accelerator, SysMods}, - keyboard::KeyCode, - menu::{MenuBar as Menu, MenuItem, MenuItemAttributes}, - platform::macos::WindowBuilderExtMacOS, -}; +use app::{invoke, menu, window}; +use invoke::{download_file, drag_window, fullscreen, open_browser}; +use menu::{get_menu, menu_event_handle}; +use tauri_plugin_window_state::{Builder as windowStatePlugin, StateFlags, WindowExt}; +use util::{get_data_dir, get_pake_config}; +use window::get_window; -#[cfg(target_os = "windows")] -use wry::application::window::Icon; +pub fn run_app() { + let (pake_config, tauri_config) = get_pake_config(); + let show_menu = pake_config.show_menu(); + let menu = get_menu(); + let data_dir = get_data_dir(tauri_config); -#[cfg(any(target_os = "linux", target_os = "windows"))] -use wry::webview::WebContext; + let mut tauri_app = tauri::Builder::default(); -enum UserEvent { - DownloadStarted(String, String), - DownloadComplete(Option, bool), -} - -fn main() -> wry::Result<()> { - #[cfg(target_os = "macos")] - let (menu_bar_menu, close_item) = { - let mut menu_bar_menu = Menu::new(); - let mut first_menu = Menu::new(); - first_menu.add_native_item(MenuItem::Hide); - first_menu.add_native_item(MenuItem::EnterFullScreen); - first_menu.add_native_item(MenuItem::Minimize); - first_menu.add_native_item(MenuItem::Separator); - first_menu.add_native_item(MenuItem::Copy); - first_menu.add_native_item(MenuItem::Cut); - first_menu.add_native_item(MenuItem::Paste); - first_menu.add_native_item(MenuItem::Undo); - first_menu.add_native_item(MenuItem::Redo); - first_menu.add_native_item(MenuItem::SelectAll); - first_menu.add_native_item(MenuItem::Separator); - let close_item = first_menu.add_item( - MenuItemAttributes::new("CloseWindow") - .with_accelerators(&Accelerator::new(SysMods::Cmd, KeyCode::KeyW)), - ); - first_menu.add_native_item(MenuItem::Quit); - menu_bar_menu.add_submenu("App", true, first_menu); - (menu_bar_menu, close_item) - }; - - #[cfg(any(target_os = "linux", target_os = "windows"))] - let ( - package_name, - WindowConfig { - url, - width, - height, - resizable, - fullscreen, - .. - }, - ) = { - let (package_name, windows_config) = get_windows_config(); - ( - package_name - .expect("can't get package name in config file") - .to_lowercase(), - windows_config.unwrap_or_default(), - ) - }; - - #[cfg(target_os = "macos")] - let WindowConfig { - url, - width, - height, - resizable, - transparent, - fullscreen, - .. - } = get_windows_config().1.unwrap_or_default(); - - let event_loop: EventLoop = EventLoop::with_user_event(); - let proxy = event_loop.create_proxy(); - let common_window = WindowBuilder::new() - .with_title("") - .with_resizable(resizable) - .with_fullscreen(if fullscreen { - Some(Fullscreen::Borderless(None)) - } else { - None - }) - .with_inner_size(wry::application::dpi::LogicalSize::new(width, height)); - - #[cfg(target_os = "windows")] - let window = { - let mut icon_path = format!("png/{}_32.ico", package_name); - // If there is no setting, use the default one. - if !std::path::Path::new(&icon_path).exists() { - icon_path = "png/icon_32.ico".to_string(); - } - let icon = load_icon(std::path::Path::new(&icon_path)); - common_window - .with_decorations(true) - .with_window_icon(Some(icon)) - .build(&event_loop) - .unwrap() - }; - - #[cfg(target_os = "linux")] - let window = common_window.build(&event_loop).unwrap(); - - #[cfg(target_os = "macos")] - let window = common_window - .with_fullsize_content_view(true) - .with_titlebar_buttons_hidden(false) - .with_titlebar_transparent(transparent) - .with_title_hidden(true) - .with_menu(menu_bar_menu) - .build(&event_loop) - .unwrap(); - - // Handling events of JS -> Rust - let handler = move |window: &Window, req: String| { - if req == "drag_window" { - let _ = window.drag_window(); - } else if req == "fullscreen" { - let is_maximized = window.is_maximized(); - window.set_maximized(!is_maximized); - } else if req.starts_with("open_browser") { - let href = req.replace("open_browser:", ""); - webbrowser::open(&href).expect("no browser"); - } - }; - - let download_started = { - let proxy = proxy.clone(); - move |uri: String, default_path: &mut PathBuf| { - let path = download_dir() - .unwrap() - .join(default_path.display().to_string()) - .as_path() - .to_path_buf(); - *default_path = path.clone(); - let submitted = proxy - .send_event(UserEvent::DownloadStarted(uri, path.display().to_string())) - .is_ok(); - submitted - } - }; - - let download_completed = { - move |_uri, path, success| { - let _ = proxy.send_event(UserEvent::DownloadComplete(path, success)); - } - }; - - #[cfg(target_os = "macos")] - let webview = { - let user_agent_string = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15"; - WebViewBuilder::new(window)? - .with_user_agent(user_agent_string) - .with_url(&url.to_string())? - .with_devtools(cfg!(feature = "devtools")) - .with_initialization_script(include_str!("pake.js")) - .with_ipc_handler(handler) - .with_back_forward_navigation_gestures(true) - .with_download_started_handler(download_started) - .with_download_completed_handler(download_completed) - .build()? - }; - - #[cfg(any(target_os = "linux", target_os = "windows"))] - let webview = { - let home_dir = match home::home_dir() { - Some(path1) => path1, - None => panic!("Error, can't found you home dir!!"), - }; - #[cfg(target_os = "windows")] - let data_dir = home_dir.join("AppData").join("Roaming").join(package_name); - #[cfg(target_os = "linux")] - let data_dir = home_dir.join(".config").join(package_name); - if !data_dir.exists() { - std::fs::create_dir(&data_dir) - .unwrap_or_else(|_| panic!("can't create dir {}", data_dir.display())); - } - let mut web_content = WebContext::new(Some(data_dir)); - #[cfg(target_os = "windows")] - let user_agent_string = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"; - #[cfg(target_os = "linux")] - let user_agent_string = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"; - WebViewBuilder::new(window)? - .with_user_agent(user_agent_string) - .with_url(&url.to_string())? - .with_devtools(cfg!(feature = "devtools")) - .with_initialization_script(include_str!("pake.js")) - .with_ipc_handler(handler) - .with_web_context(&mut web_content) - .with_download_started_handler(download_started) - .with_download_completed_handler(download_completed) - .build()? - }; - #[cfg(feature = "devtools")] - { - webview.open_devtools(); + if show_menu { + tauri_app = tauri_app.menu(menu).on_menu_event(menu_event_handle); } - event_loop.run(move |event, _, control_flow| { - *control_flow = ControlFlow::Wait; + #[cfg(not(target_os = "macos"))] + { + use menu::{get_system_tray, system_tray_handle}; - match event { - Event::NewEvents(StartCause::Init) => println!("Wry has started!"), - Event::WindowEvent { - event: WindowEvent::CloseRequested, - .. - } => *control_flow = ControlFlow::Exit, - Event::MenuEvent { - menu_id, - origin: MenuType::MenuBar, - .. - } => { - #[cfg(target_os = "macos")] - if menu_id == close_item.clone().id() { - webview.window().set_minimized(true); - } - println!("Clicked on {menu_id:?}"); - } - Event::UserEvent(UserEvent::DownloadStarted(uri, temp_dir)) => { - println!("Download: {uri}"); - println!("Will write to: {temp_dir:?}"); - } - Event::UserEvent(UserEvent::DownloadComplete(_, success)) => { - println!("Succeeded: {success}"); - if success { - let _ = webview - .evaluate_script("window.pakeToast('Downloaded to download folder~')"); - } else { - println!("No output path") - } - } - _ => (), + let show_system_tray = pake_config.show_system_tray(); + let system_tray = get_system_tray(show_menu); + + if show_system_tray { + tauri_app = tauri_app + .system_tray(system_tray) + .on_system_tray_event(system_tray_handle); } - }); + } + + tauri_app + .plugin(windowStatePlugin::default().build()) + .invoke_handler(tauri::generate_handler![ + drag_window, + fullscreen, + open_browser, + download_file + ]) + .setup(|app| { + let _window = get_window(app, pake_config, data_dir); + // Prevent initial shaking + _window.restore_state(StateFlags::all()).unwrap(); + _window.show().unwrap(); + #[cfg(feature = "devtools")] + { + _window.open_devtools(); + } + Ok(()) + }) + .on_window_event(|event| { + if let tauri::WindowEvent::CloseRequested { api, .. } = event.event() { + event.window().minimize().unwrap(); + api.prevent_close(); + } + }) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); } -fn get_windows_config() -> (Option, Option) { - let config_file = include_str!("../tauri.conf.json"); - let config: Config = serde_json::from_str(config_file).expect("failed to parse windows config"); - ( - config.package.product_name.clone(), - config.tauri.windows.first().cloned(), - ) -} - -#[cfg(target_os = "windows")] -fn load_icon(path: &std::path::Path) -> Icon { - let (icon_rgba, icon_width, icon_height) = { - // alternatively, you can embed the icon in the binary through `include_bytes!` macro and use `image::load_from_memory` - let image = image::open(path) - .expect("Failed to open icon path") - .into_rgba8(); - let (width, height) = image.dimensions(); - let rgba = image.into_raw(); - (rgba, width, height) - }; - Icon::from_rgba(icon_rgba, icon_width, icon_height).expect("Failed to open icon") +fn main() { + run_app() } diff --git a/src-tauri/src/util.rs b/src-tauri/src/util.rs new file mode 100644 index 0000000..e6f4674 --- /dev/null +++ b/src-tauri/src/util.rs @@ -0,0 +1,60 @@ +use crate::app::config::PakeConfig; +use dirs::config_dir; +use libc::getenv; +use std::ffi::CStr; +use std::path::PathBuf; +use tauri::{Config, Window}; + +pub fn get_pake_config() -> (PakeConfig, Config) { + let pake_config: PakeConfig = + serde_json::from_str(include_str!("../pake.json")).expect("Failed to parse pake config"); + + let tauri_config: Config = serde_json::from_str(include_str!("../tauri.conf.json")) + .expect("Failed to parse tauri config"); + + (pake_config, tauri_config) +} + +pub fn get_data_dir(_tauri_config: Config) -> PathBuf { + { + let package_name = _tauri_config.package.product_name.unwrap(); + let data_dir = config_dir() + .expect("Failed to get data dirname") + .join(package_name); + + if !data_dir.exists() { + std::fs::create_dir(&data_dir) + .unwrap_or_else(|_| panic!("Can't create dir {}", data_dir.display())); + } + data_dir + } +} + +pub fn show_toast(window: &Window, message: &str) { + let script = format!(r#"pakeToast("{}");"#, message); + window.eval(&script).unwrap(); +} + +pub fn get_download_message() -> String { + let lang_env_var = unsafe { CStr::from_ptr(getenv(b"LANG\0".as_ptr() as *const i8)) }; + let lang_str = lang_env_var.to_string_lossy().to_lowercase(); + if lang_str.starts_with("zh") { + "下载成功,已保存到下载目录~".to_string() + } else { + "Download successful, saved to download directory~".to_string() + } +} + +// Check if the file exists, if it exists, add a number to file name +pub fn check_file_or_append(file_path: &str) -> String { + let mut new_path = PathBuf::from(file_path); + let mut counter = 1; + while new_path.exists() { + let file_stem = new_path.file_stem().unwrap().to_string_lossy().to_string(); + let extension = new_path.extension().unwrap().to_string_lossy().to_string(); + let parent_dir = new_path.parent().unwrap(); + new_path = parent_dir.join(format!("{}-{}.{}", file_stem, counter, extension)); + counter += 1; + } + new_path.to_string_lossy().into_owned() +} diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 257bd74..b8cb4e2 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,31 +1,28 @@ { - "package": { - "productName": "WeRead", - "version": "1.0.0" - }, - "tauri": { - "windows": [ - { - "url": "https://weread.qq.com/", - "transparent": true, - "fullscreen": false, - "width": 1200, - "height": 780, - "resizable": true - } - ], - "security": { - "csp": null - }, - "updater": { - "active": false - } - }, - "build": { - "devPath": "../dist", - "distDir": "../dist", - "beforeBuildCommand": "", - "beforeDevCommand": "" - } + "package": { + "productName": "WeRead", + "version": "1.0.0" + }, + "tauri": { + "security": { + "csp": null + }, + "updater": { + "active": false + }, + "systemTray": { + "iconPath": "png/weread_512.png", + "iconAsTemplate": true + }, + "allowlist": { + "all": true + } + }, + "build": { + "withGlobalTauri": true, + "devPath": "../dist", + "distDir": "../dist", + "beforeBuildCommand": "", + "beforeDevCommand": "" } - \ No newline at end of file +} diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json index 8934409..72b95b6 100644 --- a/src-tauri/tauri.linux.conf.json +++ b/src-tauri/tauri.linux.conf.json @@ -1,32 +1,33 @@ { - "tauri": { - "bundle": { - "icon": ["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", - "gnome-video-effects", - "gnome-video-effects-extra" - ], - "files": {"/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"} - }, - "externalBin": [], - "longDescription": "", - "resources": [], - "shortDescription": "", - "targets": ["deb", "appimage"] - } - } + "tauri": { + "bundle": { + "icon": ["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", + "gnome-video-effects", + "gnome-video-effects-extra" + ], + "files": { + "/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop" + } + }, + "externalBin": [], + "longDescription": "", + "resources": [], + "shortDescription": "", + "targets": ["deb", "appimage"] + } } - \ No newline at end of file +}