From 950cdaac94e0b7b8d3e1d3265413bb3c136fb4af Mon Sep 17 00:00:00 2001 From: Tw93 Date: Thu, 20 Jul 2023 18:20:03 +0800 Subject: [PATCH 01/17] :art: Format update --- src-tauri/src/app/invoke.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src-tauri/src/app/invoke.rs b/src-tauri/src/app/invoke.rs index 4c4aebe..16bc9f3 100644 --- a/src-tauri/src/app/invoke.rs +++ b/src-tauri/src/app/invoke.rs @@ -19,11 +19,14 @@ pub async fn download_file(app: AppHandle, params: DownloadFileParams) -> Result let file_path = check_file_or_append(output_path.to_str().unwrap()); let client = ClientBuilder::new().build().unwrap(); - let response = client.send( - HttpRequestBuilder::new("GET", ¶ms.url) - .unwrap() - .response_type(ResponseType::Binary) - ).await; + let response = client + .send( + HttpRequestBuilder::new("GET", ¶ms.url) + .unwrap() + .response_type(ResponseType::Binary), + ) + .await; + match response { Ok(res) => { From 32822f9b697cf013416047e48e4396ed3677f2df Mon Sep 17 00:00:00 2001 From: Tw93 Date: Thu, 20 Jul 2023 18:35:30 +0800 Subject: [PATCH 02/17] :art: Format update --- src-tauri/src/app/invoke.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src-tauri/src/app/invoke.rs b/src-tauri/src/app/invoke.rs index 16bc9f3..2a91de8 100644 --- a/src-tauri/src/app/invoke.rs +++ b/src-tauri/src/app/invoke.rs @@ -1,8 +1,8 @@ -use crate::util::{check_file_or_append, get_download_message, MessageType, show_toast}; -use tauri::{api, command, AppHandle, Manager, Window}; -use tauri::api::http::{ClientBuilder, HttpRequestBuilder, ResponseType}; +use crate::util::{check_file_or_append, get_download_message, show_toast, MessageType}; use std::fs::File; use std::io::Write; +use tauri::api::http::{ClientBuilder, HttpRequestBuilder, ResponseType}; +use tauri::{api, command, AppHandle, Manager, Window}; #[derive(serde::Deserialize)] pub struct DownloadFileParams { @@ -27,7 +27,6 @@ pub async fn download_file(app: AppHandle, params: DownloadFileParams) -> Result ) .await; - match response { Ok(res) => { let bytes = res.bytes().await.unwrap().data; From 7100f0636f75cef8c33cf0eb5763c271eb4f6064 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Thu, 20 Jul 2023 18:57:41 +0800 Subject: [PATCH 03/17] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pake_build.yaml | 104 +++++++++++++++++------------- 1 file changed, 60 insertions(+), 44 deletions(-) diff --git a/.github/workflows/pake_build.yaml b/.github/workflows/pake_build.yaml index 044a411..c22d3f4 100644 --- a/.github/workflows/pake_build.yaml +++ b/.github/workflows/pake_build.yaml @@ -13,57 +13,73 @@ jobs: matrix: build: [linux, windows, macos] include: - - build: linux - os: ubuntu-20.04 - rust: stable - target: x86_64-unknown-linux-musl - - build: windows - os: windows-latest - rust: stable-x86_64-msvc - target: x86_64-pc-windows-msvc - - build: macos - os: macos-latest - rust: stable - target: x86_64-apple-darwin + - build: linux + os: ubuntu-20.04 + rust: stable + target: x86_64-unknown-linux-musl + - build: windows + os: windows-latest + rust: stable-x86_64-msvc + target: x86_64-pc-windows-msvc + - build: macos + os: macos-latest + rust: stable + target: x86_64-apple-darwin fail-fast: false steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - - name: install node - uses: actions/setup-node@v3 - with: - node-version: 18 + - name: install node + uses: actions/setup-node@v3 + with: + node-version: 18 - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ matrix.rust }} + target: ${{ matrix.target }} - - name: install dependencies (ubuntu only) - if: matrix.os == '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 dependencies (ubuntu only) + if: matrix.os == '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: rust cache - uses: Swatinem/rust-cache@v2 + - name: rust cache restore + uses: actions/cache/restore@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + src-tauri/target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: build for Ubuntu - if: matrix.os == 'ubuntu-20.04' - run: npm run build:all-unix + - name: build for Ubuntu + if: matrix.os == 'ubuntu-20.04' + run: npm run build:all-unix - - name: build for MacOS - if: matrix.os == 'macos-latest' - run: | - rustup target add aarch64-apple-darwin - npm run build:all-unix + - name: build for MacOS + if: matrix.os == 'macos-latest' + run: | + rustup target add aarch64-apple-darwin + npm run build:all-unix - - name: build for windows - if: matrix.os == 'windows-latest' - shell: pwsh - run: | - npm run build:all-windows + - name: build for windows + if: matrix.os == 'windows-latest' + shell: pwsh + run: | + npm run build:all-windows + + - name: Upload files + # arg info: https://github.com/ncipollo/release-action#release-action + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: "output/*/*.*" + token: ${{ secrets.GITHUB_TOKEN }} From 4052fd164c3699d7a2a3e6b50b5718eaf3848c12 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Thu, 20 Jul 2023 19:04:35 +0800 Subject: [PATCH 04/17] :bug: Restore rust cache --- .github/workflows/pake-cli.yaml | 150 +++++++++++-------- .github/workflows/pake_build_with_cache.yaml | 133 +++++++++------- 2 files changed, 162 insertions(+), 121 deletions(-) diff --git a/.github/workflows/pake-cli.yaml b/.github/workflows/pake-cli.yaml index 93b4249..ad00b9b 100644 --- a/.github/workflows/pake-cli.yaml +++ b/.github/workflows/pake-cli.yaml @@ -8,9 +8,9 @@ on: default: "macos-latest" type: choice options: - - "windows-latest" - - "macos-latest" - - "ubuntu-20.04" + - "windows-latest" + - "macos-latest" + - "ubuntu-20.04" url: description: "[URL]" required: true @@ -44,9 +44,9 @@ on: default: "deb" type: choice options: - - "deb" - - "appimage" - - "all" + - "deb" + - "appimage" + - "all" jobs: @@ -57,71 +57,91 @@ jobs: fail-fast: false steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - - name: install node - uses: actions/setup-node@v3 - with: - node-version: 18 + - name: install node + uses: actions/setup-node@v3 + with: + node-version: 18 - - name: Install Rust for ubuntu-20.04 - if: inputs.platform == 'ubuntu-20.04' - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - target: x86_64-unknown-linux-musl + - name: Install Rust for ubuntu-20.04 + if: inputs.platform == 'ubuntu-20.04' + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + target: x86_64-unknown-linux-musl - - name: Install Rust for windows-latest - if: inputs.platform == 'windows-latest' - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable-x86_64-msvc - target: x86_64-pc-windows-msvc + - name: Install Rust for windows-latest + if: inputs.platform == 'windows-latest' + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable-x86_64-msvc + target: x86_64-pc-windows-msvc - - name: Install Rust for macos-latest - if: inputs.platform == 'macos-latest' - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - target: x86_64-apple-darwin + - name: Install Rust for macos-latest + if: inputs.platform == 'macos-latest' + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + 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 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: | - echo "install pake on local" - npm install pake-cli + - name: install pake-cli local + shell: bash + run: | + echo "install pake on local" + npm install pake-cli - - name: rust cache - uses: Swatinem/rust-cache@v2 + - name: rust cache restore + uses: actions/cache/restore@v3 + id: cache_store + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + node_modules/pake-cli/src-tauri/target/ + key: ${{ inputs.platform }}-cargo-${{ hashFiles('node_modules/pake-cli/src-tauri/Cargo.lock') }} - - name: build with pake-cli - shell: pwsh - run: | - pwsh ./script/build_with_pake_cli.ps1 - env: - URL: ${{ inputs.url }} - NAME: ${{ inputs.name }} - ICON: ${{ inputs.icon }} - HEIGHT: ${{ inputs.height }} - WIDTH: ${{ inputs.width }} - TRANSPARENT: ${{ inputs.transparent }} - FULLSCREEN: ${{ inputs.fullscreen }} - RESIZE: ${{ inputs.resize }} - MULTI_ARCH: ${{ inputs.multi_arch }} - TARGETS: ${{ inputs.targets }} + - name: build with pake-cli + shell: pwsh + run: | + pwsh ./script/build_with_pake_cli.ps1 + env: + URL: ${{ inputs.url }} + NAME: ${{ inputs.name }} + ICON: ${{ inputs.icon }} + HEIGHT: ${{ inputs.height }} + WIDTH: ${{ inputs.width }} + TRANSPARENT: ${{ inputs.transparent }} + FULLSCREEN: ${{ inputs.fullscreen }} + RESIZE: ${{ inputs.resize }} + MULTI_ARCH: ${{ inputs.multi_arch }} + TARGETS: ${{ inputs.targets }} - - name: Upload archive - uses: actions/upload-artifact@v3 - with: - name: output-${{ inputs.platform }}.zip - path: node_modules/pake-cli/output/* - retention-days: 3 - \ No newline at end of file + - name: Upload archive + uses: actions/upload-artifact@v3 + with: + name: output-${{ inputs.platform }}.zip + path: node_modules/pake-cli/output/* + retention-days: 3 + + - name: rust cache store + uses: actions/cache/save@v3 + if: steps.cache_store.outputs.cache-hit != 'true' + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + node_modules/pake-cli/src-tauri/target/ + key: ${{ inputs.platform }}-cargo-${{ hashFiles('node_modules/pake-cli/src-tauri/Cargo.lock') }} diff --git a/.github/workflows/pake_build_with_cache.yaml b/.github/workflows/pake_build_with_cache.yaml index aecfcee..cc6ddff 100644 --- a/.github/workflows/pake_build_with_cache.yaml +++ b/.github/workflows/pake_build_with_cache.yaml @@ -21,70 +21,91 @@ jobs: matrix: build: [linux, windows, macos] include: - - build: linux - os: ubuntu-20.04 - rust: stable - target: x86_64-unknown-linux-musl - # archive-name: target-linux.tar.gz - - build: windows - os: windows-latest - rust: stable-x86_64-msvc - target: x86_64-pc-windows-msvc - # archive-name: target-windows.tar.gz - - build: macos - os: macos-latest - rust: stable - target: x86_64-apple-darwin - # archive-name: target-macos.tar.gz + - build: linux + os: ubuntu-20.04 + rust: stable + target: x86_64-unknown-linux-musl + # archive-name: target-linux.tar.gz + - build: windows + os: windows-latest + rust: stable-x86_64-msvc + target: x86_64-pc-windows-msvc + # archive-name: target-windows.tar.gz + - build: macos + os: macos-latest + rust: stable + target: x86_64-apple-darwin + # archive-name: target-macos.tar.gz fail-fast: false steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - - name: install node - uses: actions/setup-node@v3 - with: - node-version: 18 + - name: install node + uses: actions/setup-node@v3 + with: + node-version: 18 - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ matrix.rust }} + target: ${{ matrix.target }} - - name: install dependencies (ubuntu only) - if: matrix.os == '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 dependencies (ubuntu only) + if: matrix.os == '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: rust cache - uses: Swatinem/rust-cache@v2 + - name: rust cache restore + uses: actions/cache/restore@v3 + id: cache_store + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + src-tauri/target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: build for Ubuntu - if: matrix.os == 'ubuntu-20.04' - run: npm run build:all-unix + - name: build for Ubuntu + if: matrix.os == 'ubuntu-20.04' + run: npm run build:all-unix - - name: build for MacOS - if: matrix.os == 'macos-latest' - run: | - rustup target add aarch64-apple-darwin - npm run build:all-unix + - name: build for MacOS + if: matrix.os == 'macos-latest' + run: | + rustup target add aarch64-apple-darwin + npm run build:all-unix - - name: build for windows - if: matrix.os == 'windows-latest' - shell: pwsh - run: | - npm run build:all-windows + - name: build for windows + if: matrix.os == 'windows-latest' + shell: pwsh + run: | + npm run build:all-windows - - name: Upload files - # arg info: https://github.com/ncipollo/release-action#release-action - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - prerelease: ${{ inputs.is_pre_release }} - artifacts: "output/*/*.*" - tag: ${{ inputs.version }} - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + - name: Upload files + # arg info: https://github.com/ncipollo/release-action#release-action + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + prerelease: ${{ inputs.is_pre_release }} + artifacts: "output/*/*.*" + tag: ${{ inputs.version }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: rust cache store + uses: actions/cache/save@v3 + if: steps.cache_store.outputs.cache-hit != 'true' + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + src-tauri/target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} From 15a07707b3c47054133d83b5b8efe80eadf5eea7 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Thu, 20 Jul 2023 22:26:30 +0800 Subject: [PATCH 05/17] :bug: Actions support set domain --- script/build.ps1 | 5 ++++- script/build.sh | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/script/build.ps1 b/script/build.ps1 index 03747cd..9c951a6 100644 --- a/script/build.ps1 +++ b/script/build.ps1 @@ -38,7 +38,7 @@ $total = $total - 1 # for windows, we need replace package name to title ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) { - $name, $title, $name_zh, $url = $line.Split(",") + $name, $title, $name_zh, $url = $line.Split(","), $domain = ([Uri]$url).Host Write-Host "building package ${index}/${total}" Write-Host "package name is ${name} ${name_zh}" Write-Host "==========================" @@ -54,6 +54,9 @@ ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) { # replace url with no regex (Get-Content -Path $pake_conf_path -Raw) | ForEach-Object { $_.Replace('"url": ""', "`"url`": `"${url}`"") } | Set-Content $pake_conf_path + # -- replace domain -- # + (Get-Content -Path $common_conf_path -Raw) -replace '"domain":\s*"[^"]*"', '"domain": ""' | Set-Content -Path $common_conf_path + (Get-Content -Path $common_conf_path -Raw) | ForEach-Object { $_.Replace('"domain": ""', "`"domain`": `"${domain}`"") } | Set-Content $common_conf_path # -- replace package name -- # # clear package_name with regex diff --git a/script/build.sh b/script/build.sh index bc27133..a5af78e 100755 --- a/script/build.sh +++ b/script/build.sh @@ -59,6 +59,8 @@ do package_title=${arr[1]} package_zh_name=${arr[2]} url=${arr[3]} + domain=${url//http*:\/\//} + domain=${domain%%/*} # replace package info # clear url with regex @@ -66,6 +68,10 @@ do # replace url with no regex $sd -s "\"url\": \"\"," "\"url\": \"${url}\"," src-tauri/pake.json + # replace dangerousRemoteDomainIpcAccess domain + $sd "\"domain\": \"(.*?)\"," "\"domain\": \"\"," src-tauri/tauri.conf.json + $sd -s "\"domain\": \"\"," "\"domain\": \"${domain}\"," src-tauri/tauri.conf.json + # for apple, need replace title if [[ "$OSTYPE" =~ ^darwin ]]; then # update icon @@ -157,8 +163,8 @@ do if [[ "$OSTYPE" =~ ^linux ]]; then npm run tauri build - mv src-tauri/target/release/bundle/deb/${package_prefix}-"${package_name}"*.deb output/linux/"${package_title}"_`arch`.deb - mv src-tauri/target/release/bundle/appimage/${package_prefix}-"${package_name}"*.AppImage output/linux/"${package_title}"_`arch`.AppImage + mv "src-tauri/target/release/bundle/deb/${package_prefix}-${package_name}"*.deb "output/linux/${package_title}_`arch`.deb" + mv "src-tauri/target/release/bundle/appimage/${package_prefix}-${package_name}"*.AppImage "output/linux/${package_title}_`arch`.AppImage" echo clear cache rm src-tauri/target/release rm -rf src-tauri/target/release/bundle From c5d337640a70e5433c3009ff22335bb14db2ee7f Mon Sep 17 00:00:00 2001 From: Tw93 Date: Thu, 20 Jul 2023 22:33:27 +0800 Subject: [PATCH 06/17] :bug: Fix windows --- script/build.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/build.ps1 b/script/build.ps1 index 9c951a6..5fa9c46 100644 --- a/script/build.ps1 +++ b/script/build.ps1 @@ -38,7 +38,8 @@ $total = $total - 1 # for windows, we need replace package name to title ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) { - $name, $title, $name_zh, $url = $line.Split(","), $domain = ([Uri]$url).Host + $name, $title, $name_zh, $url = $line.Split(",") + $domain = ([Uri]$url).Host Write-Host "building package ${index}/${total}" Write-Host "package name is ${name} ${name_zh}" Write-Host "==========================" From 33c52d6816f95ef8cc1cefb021dbe8944a5c63e0 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Thu, 20 Jul 2023 23:17:20 +0800 Subject: [PATCH 07/17] :bug: Fix Linux packaging issues --- script/build.sh | 6 +++--- src-tauri/tauri.linux.conf.json | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/script/build.sh b/script/build.sh index a5af78e..a353f93 100755 --- a/script/build.sh +++ b/script/build.sh @@ -151,7 +151,7 @@ do $sd "Icon=.*" "Icon=" "${new_desktop}" $sd "Name=.*" "Name=" "${new_desktop}" $sd "Name\[zh_CN\]=.*" "Name[zh_CN]=" "${new_desktop}" - # repleace dekstop content with no reg + # replace desktop content with no reg $sd -s "Exec=" "Exec=${package_prefix}-${package_name}" "${new_desktop}" $sd -s "Icon=" "Icon=${package_prefix}-${package_name}" "${new_desktop}" $sd -s "Name=" "Name=${package_title}" "${new_desktop}" @@ -163,8 +163,8 @@ do if [[ "$OSTYPE" =~ ^linux ]]; then npm run tauri build - mv "src-tauri/target/release/bundle/deb/${package_prefix}-${package_name}"*.deb "output/linux/${package_title}_`arch`.deb" - mv "src-tauri/target/release/bundle/appimage/${package_prefix}-${package_name}"*.AppImage "output/linux/${package_title}_`arch`.AppImage" + mv src-tauri/target/release/bundle/deb/${package_prefix}-"${package_name}"*.deb output/linux/"${package_title}"_`arch`.deb + mv src-tauri/target/release/bundle/appimage/${package_prefix}-"${package_name}"*.AppImage output/linux/"${package_title}"_`arch`.AppImage echo clear cache rm src-tauri/target/release rm -rf src-tauri/target/release/bundle diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json index 8c8eef0..df90475 100644 --- a/src-tauri/tauri.linux.conf.json +++ b/src-tauri/tauri.linux.conf.json @@ -8,9 +8,7 @@ "copyright": "", "deb": { "depends": ["curl", "wget"], - "files": { - "/usr/share/applications/com-pake-weread.desktop": "assets/com-pake-weread.desktop" - } + "files": {"/usr/share/applications/com-pake-weread.desktop": "assets/com-pake-weread.desktop"} }, "externalBin": [], "longDescription": "", From e314842482ffaa99dda3f5c16d6cce945a4adb7f Mon Sep 17 00:00:00 2001 From: Tw93 Date: Thu, 20 Jul 2023 23:31:42 +0800 Subject: [PATCH 08/17] :art: update pic --- README.md | 2 +- README_CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 61f05b5..9e0ee79 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ - + Flomo diff --git a/README_CN.md b/README_CN.md index 26325da..d1bfff2 100644 --- a/README_CN.md +++ b/README_CN.md @@ -106,7 +106,7 @@ - + Flomo From 0a607f509a2cb9117c826db9e0dc8448070ce2ef Mon Sep 17 00:00:00 2001 From: Tw93 Date: Fri, 21 Jul 2023 09:23:55 +0800 Subject: [PATCH 09/17] :bug: Compatible with downloading and using actions. --- app.csv | 2 +- bin/helpers/rust.ts | 3 ++- dist/cli.js | 5 +++-- package.json | 2 +- src-tauri/rust_proxy.toml | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app.csv b/app.csv index a2ff863..ee95b96 100644 --- a/app.csv +++ b/app.csv @@ -1,7 +1,7 @@ name(Linux),name(Mac/Windows),name_zh,url programmusic,ProgramMusic,ProgramMusic,https://musicforprogramming.net/ twitter,Twitter,推特,https://twitter.com/ -youtube,YouTube,YouTube,https://youtube.com +youtube,YouTube,YouTube,https://www.youtube.com reference,Reference,Reference,https://quickref.me/zh-CN/ coderunner,CodeRunner,CodeRunner,https://riju.codes/ chatgpt,ChatGPT,ChatGPT,https://chat.openai.com/chat diff --git a/bin/helpers/rust.ts b/bin/helpers/rust.ts index bf53087..a6e74a9 100644 --- a/bin/helpers/rust.ts +++ b/bin/helpers/rust.ts @@ -7,8 +7,9 @@ import { shellExec } from '@/utils/shell'; import { isChinaDomain } from '@/utils/ip'; export async function installRust() { + const isActions = process.env.GITHUB_ACTIONS; const isInChina = await isChinaDomain('sh.rustup.rs'); - const rustInstallScriptForMac = isInChina + const rustInstallScriptForMac = isInChina && !isActions ? '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' : "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"; const rustInstallScriptForWindows = 'winget install --id Rustlang.Rustup'; diff --git a/dist/cli.js b/dist/cli.js index e35433e..81e7672 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -20,7 +20,7 @@ import isUrl from 'is-url'; import fs from 'fs'; var name = "pake-cli"; -var version = "2.2.0"; +var version = "2.2.1"; var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。"; var engines = { node: ">=16.0.0" @@ -436,8 +436,9 @@ async function isChinaIP(ip, domain) { } async function installRust() { + const isActions = process.env.GITHUB_ACTIONS; const isInChina = await isChinaDomain('sh.rustup.rs'); - const rustInstallScriptForMac = isInChina + const rustInstallScriptForMac = isInChina && !isActions ? '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' : "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"; const rustInstallScriptForWindows = 'winget install --id Rustlang.Rustup'; diff --git a/package.json b/package.json index 67b1527..ad28ea3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pake-cli", - "version": "2.2.0", + "version": "2.2.1", "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。", "engines": { "node": ">=16.0.0" diff --git a/src-tauri/rust_proxy.toml b/src-tauri/rust_proxy.toml index dbd564d..eee0c01 100644 --- a/src-tauri/rust_proxy.toml +++ b/src-tauri/rust_proxy.toml @@ -1,6 +1,6 @@ [source.crates-io] # To use sparse index, change 'rsproxy' to 'rsproxy-sparse' -replace-with = 'rsproxy' +replace-with = 'rsproxy-sparse' [source.rsproxy] registry = "https://rsproxy.cn/crates.io-index" From 4758951064f83e51facbd232e0ec22ea62de7632 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Fri, 21 Jul 2023 20:10:36 +0800 Subject: [PATCH 10/17] :bug: Fix the problem of Linux retrieving remote images --- bin/options/icon.ts | 5 ++--- package.json | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/options/icon.ts b/bin/options/icon.ts index 6ee54e6..a7c4fd8 100644 --- a/bin/options/icon.ts +++ b/bin/options/icon.ts @@ -2,7 +2,6 @@ import path from 'path'; import axios from 'axios'; import fsExtra from 'fs-extra'; import chalk from 'chalk'; -import { dir } from 'tmp-promise'; import logger from './logger'; import { npmDirectory } from '@/utils/dir'; @@ -44,8 +43,8 @@ export async function downloadIcon(iconUrl: string) { return null; } - const { path: tempPath } = await dir(); - const iconPath = `${tempPath}/icon.${fileDetails.ext}`; + const iconPath = `assets/icon.${fileDetails.ext}`; + await fsExtra.outputFile(`./src-tauri/${iconPath}`, iconData); await fsExtra.outputFile(iconPath, iconData); spinner.succeed(chalk.green('Icon downloaded successfully!')); return iconPath; diff --git a/package.json b/package.json index ad28ea3..344537a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pake-cli", - "version": "2.2.1", + "version": "2.2.2", "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。", "engines": { "node": ">=16.0.0" @@ -59,7 +59,6 @@ "prompts": "^2.4.2", "psl": "^1.9.0", "shelljs": "^0.8.5", - "tmp-promise": "^3.0.3", "update-notifier": "^6.0.2" }, "devDependencies": { From 26f2156e57782b923bb48f6dd2862f5acc6d711d Mon Sep 17 00:00:00 2001 From: Tw93 Date: Fri, 21 Jul 2023 20:11:05 +0800 Subject: [PATCH 11/17] :bookmark: 2.2.2 --- dist/cli.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dist/cli.js b/dist/cli.js index 81e7672..4ff51ee 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -13,14 +13,13 @@ import http from 'http'; import { promisify } from 'util'; import updateNotifier from 'update-notifier'; import axios from 'axios'; -import { dir } from 'tmp-promise'; import { fileTypeFromBuffer } from 'file-type'; import psl from 'psl'; import isUrl from 'is-url'; import fs from 'fs'; var name = "pake-cli"; -var version = "2.2.1"; +var version = "2.2.2"; var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。"; var engines = { node: ">=16.0.0" @@ -79,7 +78,6 @@ var dependencies = { prompts: "^2.4.2", psl: "^1.9.0", shelljs: "^0.8.5", - "tmp-promise": "^3.0.3", "update-notifier": "^6.0.2" }; var devDependencies = { @@ -821,8 +819,8 @@ async function downloadIcon(iconUrl) { if (!fileDetails) { return null; } - const { path: tempPath } = await dir(); - const iconPath = `${tempPath}/icon.${fileDetails.ext}`; + const iconPath = `assets/icon.${fileDetails.ext}`; + await fsExtra.outputFile(`./src-tauri/${iconPath}`, iconData); await fsExtra.outputFile(iconPath, iconData); spinner.succeed(chalk.green('Icon downloaded successfully!')); return iconPath; From 95d44daa82f5fe7f49e82b84a7a2a21547c96444 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Fri, 21 Jul 2023 21:33:07 +0800 Subject: [PATCH 12/17] :bookmark: 2.2.3 --- bin/options/icon.ts | 5 +++-- dist/cli.js | 8 +++++--- package.json | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/options/icon.ts b/bin/options/icon.ts index a7c4fd8..6ee54e6 100644 --- a/bin/options/icon.ts +++ b/bin/options/icon.ts @@ -2,6 +2,7 @@ import path from 'path'; import axios from 'axios'; import fsExtra from 'fs-extra'; import chalk from 'chalk'; +import { dir } from 'tmp-promise'; import logger from './logger'; import { npmDirectory } from '@/utils/dir'; @@ -43,8 +44,8 @@ export async function downloadIcon(iconUrl: string) { return null; } - const iconPath = `assets/icon.${fileDetails.ext}`; - await fsExtra.outputFile(`./src-tauri/${iconPath}`, iconData); + const { path: tempPath } = await dir(); + const iconPath = `${tempPath}/icon.${fileDetails.ext}`; await fsExtra.outputFile(iconPath, iconData); spinner.succeed(chalk.green('Icon downloaded successfully!')); return iconPath; diff --git a/dist/cli.js b/dist/cli.js index 4ff51ee..a4169bf 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -13,13 +13,14 @@ import http from 'http'; import { promisify } from 'util'; import updateNotifier from 'update-notifier'; import axios from 'axios'; +import { dir } from 'tmp-promise'; import { fileTypeFromBuffer } from 'file-type'; import psl from 'psl'; import isUrl from 'is-url'; import fs from 'fs'; var name = "pake-cli"; -var version = "2.2.2"; +var version = "2.2.3"; var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。"; var engines = { node: ">=16.0.0" @@ -78,6 +79,7 @@ var dependencies = { prompts: "^2.4.2", psl: "^1.9.0", shelljs: "^0.8.5", + "tmp-promise": "^3.0.3", "update-notifier": "^6.0.2" }; var devDependencies = { @@ -819,8 +821,8 @@ async function downloadIcon(iconUrl) { if (!fileDetails) { return null; } - const iconPath = `assets/icon.${fileDetails.ext}`; - await fsExtra.outputFile(`./src-tauri/${iconPath}`, iconData); + const { path: tempPath } = await dir(); + const iconPath = `${tempPath}/icon.${fileDetails.ext}`; await fsExtra.outputFile(iconPath, iconData); spinner.succeed(chalk.green('Icon downloaded successfully!')); return iconPath; diff --git a/package.json b/package.json index 344537a..667add3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pake-cli", - "version": "2.2.2", + "version": "2.2.3", "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。", "engines": { "node": ">=16.0.0" @@ -59,6 +59,7 @@ "prompts": "^2.4.2", "psl": "^1.9.0", "shelljs": "^0.8.5", + "tmp-promise": "^3.0.3", "update-notifier": "^6.0.2" }, "devDependencies": { From 764e28849d4b9864efbf854c8b28a0b99c0e8eec Mon Sep 17 00:00:00 2001 From: Tw93 Date: Fri, 21 Jul 2023 21:55:36 +0800 Subject: [PATCH 13/17] :bookmark: 2.2.4 --- dist/cli.js | 2 +- package.json | 2 +- src-tauri/rust_proxy.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/cli.js b/dist/cli.js index a4169bf..2047c1f 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -20,7 +20,7 @@ import isUrl from 'is-url'; import fs from 'fs'; var name = "pake-cli"; -var version = "2.2.3"; +var version = "2.2.4"; var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。"; var engines = { node: ">=16.0.0" diff --git a/package.json b/package.json index 667add3..b415dc7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pake-cli", - "version": "2.2.3", + "version": "2.2.4", "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。", "engines": { "node": ">=16.0.0" diff --git a/src-tauri/rust_proxy.toml b/src-tauri/rust_proxy.toml index eee0c01..dbd564d 100644 --- a/src-tauri/rust_proxy.toml +++ b/src-tauri/rust_proxy.toml @@ -1,6 +1,6 @@ [source.crates-io] # To use sparse index, change 'rsproxy' to 'rsproxy-sparse' -replace-with = 'rsproxy-sparse' +replace-with = 'rsproxy' [source.rsproxy] registry = "https://rsproxy.cn/crates.io-index" From 21ff3f3a65e192985ae35455020de80b0520eb14 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Sat, 22 Jul 2023 01:15:54 +0800 Subject: [PATCH 14/17] :bookmark: 2.2.5 --- bin/options/icon.ts | 9 ++++++++- dist/cli.js | 12 ++++++++++-- package.json | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/options/icon.ts b/bin/options/icon.ts index 6ee54e6..55c8c23 100644 --- a/bin/options/icon.ts +++ b/bin/options/icon.ts @@ -45,7 +45,14 @@ export async function downloadIcon(iconUrl: string) { } const { path: tempPath } = await dir(); - const iconPath = `${tempPath}/icon.${fileDetails.ext}`; + let iconPath = `${tempPath}/icon.${fileDetails.ext}`; + // Fix this for linux + if (IS_LINUX) { + iconPath = 'png/linux_temp.png'; + await fsExtra.outputFile(`${npmDirectory}/src-tauri/${iconPath}`, iconData); + } else { + await fsExtra.outputFile(iconPath, iconData); + } await fsExtra.outputFile(iconPath, iconData); spinner.succeed(chalk.green('Icon downloaded successfully!')); return iconPath; diff --git a/dist/cli.js b/dist/cli.js index 2047c1f..ec36287 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -20,7 +20,7 @@ import isUrl from 'is-url'; import fs from 'fs'; var name = "pake-cli"; -var version = "2.2.4"; +var version = "2.2.5"; var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。"; var engines = { node: ">=16.0.0" @@ -822,7 +822,15 @@ async function downloadIcon(iconUrl) { return null; } const { path: tempPath } = await dir(); - const iconPath = `${tempPath}/icon.${fileDetails.ext}`; + let iconPath = `${tempPath}/icon.${fileDetails.ext}`; + // Fix this for linux + if (IS_LINUX) { + iconPath = 'png/linux_temp.png'; + await fsExtra.outputFile(`${npmDirectory}/src-tauri/${iconPath}`, iconData); + } + else { + await fsExtra.outputFile(iconPath, iconData); + } await fsExtra.outputFile(iconPath, iconData); spinner.succeed(chalk.green('Icon downloaded successfully!')); return iconPath; diff --git a/package.json b/package.json index b415dc7..eb6676c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pake-cli", - "version": "2.2.4", + "version": "2.2.5", "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。", "engines": { "node": ">=16.0.0" From 2e7cc3fed9a6ceb572d2f2922de2fba013ce62f7 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Sat, 22 Jul 2023 22:45:06 +0800 Subject: [PATCH 15/17] :pencil: Update Description --- README_CN.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README_CN.md b/README_CN.md index d1bfff2..8482210 100644 --- a/README_CN.md +++ b/README_CN.md @@ -3,7 +3,7 @@

Pake

-

很简单的用 Rust 打包网页生成很小的桌面App

+

利用 Rust 轻松构建轻量级跨端桌面应用

twitter diff --git a/package.json b/package.json index eb6676c..4531caf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pake-cli", "version": "2.2.5", - "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。", + "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级跨端桌面应用。", "engines": { "node": ">=16.0.0" }, From 8a402c17b21e165886d8b17b3fc1af7d08aacb3f Mon Sep 17 00:00:00 2001 From: Tw93 Date: Sun, 23 Jul 2023 08:08:00 +0800 Subject: [PATCH 16/17] :pencil: Update Description --- README_CN.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README_CN.md b/README_CN.md index 8482210..43ecd2f 100644 --- a/README_CN.md +++ b/README_CN.md @@ -3,7 +3,7 @@

Pake

-

利用 Rust 轻松构建轻量级跨端桌面应用

+

利用 Rust 轻松构建轻量级多端桌面应用

twitter diff --git a/package.json b/package.json index 4531caf..e38024f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pake-cli", "version": "2.2.5", - "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级跨端桌面应用。", + "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。", "engines": { "node": ">=16.0.0" }, From 95259eceae60181e08c2e59c91f7ab88eb9baf3a Mon Sep 17 00:00:00 2001 From: Tw93 Date: Wed, 26 Jul 2023 15:27:49 +0800 Subject: [PATCH 17/17] :art: Compatible chatgpt --- src-tauri/src/inject/style.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src-tauri/src/inject/style.js b/src-tauri/src/inject/style.js index 9792638..5baccf8 100644 --- a/src-tauri/src/inject/style.js +++ b/src-tauri/src/inject/style.js @@ -180,6 +180,11 @@ window.addEventListener('DOMContentLoaded', _event => { visibility: hidden !important; } + #__next > div.overflow-hidden.w-full.h-full .absolute.bottom-0.left-0.w-full > div.text-center.text-xs { + visibility: hidden !important; + height: 0px !important; + } + #react-root [data-testid="primaryColumn"] > div > div { position: relative !important; }