Merge remote-tracking branch 'origin/master' into dev
This commit is contained in:
150
.github/workflows/pake-cli.yaml
vendored
150
.github/workflows/pake-cli.yaml
vendored
@@ -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
|
||||
|
||||
- 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') }}
|
||||
|
||||
104
.github/workflows/pake_build.yaml
vendored
104
.github/workflows/pake_build.yaml
vendored
@@ -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 }}
|
||||
|
||||
133
.github/workflows/pake_build_with_cache.yaml
vendored
133
.github/workflows/pake_build_with_cache.yaml
vendored
@@ -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 }}
|
||||
- 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') }}
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/i2eg6G.png width=600/></td>
|
||||
<td><img src=https://cdn.fliggy.com/upic/fS1lVi.jpg width=600/></td>
|
||||
<td><img src=https://cdn.fliggy.com/upic/mUzOek.jpg width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Flomo
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<img src=https://gw.alipayobjects.com/zos/k/fa/logo-modified.png width=138/>
|
||||
</p>
|
||||
<h1 align="center">Pake</h1>
|
||||
<p align="center"><strong>很简单的用 Rust 打包网页生成很小的桌面App</strong></p>
|
||||
<p align="center"><strong>利用 Rust 轻松构建轻量级多端桌面应用</strong></p>
|
||||
<div align="center">
|
||||
<a href="https://twitter.com/HiTw93" target="_blank">
|
||||
<img alt="twitter" src="https://img.shields.io/badge/follow-Tw93-red?style=flat-square&logo=Twitter"></a>
|
||||
@@ -106,7 +106,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/i2eg6G.png width=600/></td>
|
||||
<td><img src=https://cdn.fliggy.com/upic/fS1lVi.jpg width=600/></td>
|
||||
<td><img src=https://cdn.fliggy.com/upic/mUzOek.jpg width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Flomo
|
||||
|
||||
2
app.csv
2
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
|
||||
|
||||
|
3
bin/helpers/rust.ts
vendored
3
bin/helpers/rust.ts
vendored
@@ -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';
|
||||
|
||||
9
bin/options/icon.ts
vendored
9
bin/options/icon.ts
vendored
@@ -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;
|
||||
|
||||
37
dist/cli.js
vendored
37
dist/cli.js
vendored
@@ -11,16 +11,16 @@ import { fileURLToPath } from 'url';
|
||||
import dns from 'dns';
|
||||
import http from 'http';
|
||||
import { promisify } from 'util';
|
||||
import fs from 'fs';
|
||||
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.0";
|
||||
var version = "2.2.5";
|
||||
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。";
|
||||
var engines = {
|
||||
node: ">=16.0.0"
|
||||
@@ -53,14 +53,12 @@ var scripts = {
|
||||
start: "npm run dev",
|
||||
dev: "npm run tauri dev",
|
||||
build: "npm run tauri build --release",
|
||||
"build:debug": "npm run tauri build -- --debug",
|
||||
"build:mac": "npm run tauri build -- --target universal-apple-darwin",
|
||||
"build:all-unix": "chmod +x ./script/build.sh && ./script/build.sh",
|
||||
"build:all-windows": "pwsh ./script/build.ps1",
|
||||
analyze: "cd src-tauri && cargo bloat --release --crates",
|
||||
tauri: "tauri",
|
||||
cli: "rollup -c rollup.config.js --watch",
|
||||
"cli:dev": "cross-env NODE_ENV=development rollup -c rollup.config.js -w",
|
||||
"cli:build": "cross-env NODE_ENV=production rollup -c rollup.config.js",
|
||||
prepublishOnly: "npm run cli:build"
|
||||
};
|
||||
@@ -88,7 +86,6 @@ var devDependencies = {
|
||||
"@rollup/plugin-alias": "^4.0.2",
|
||||
"@rollup/plugin-commonjs": "^23.0.2",
|
||||
"@rollup/plugin-json": "^5.0.2",
|
||||
"@rollup/plugin-replace": "^5.0.2",
|
||||
"@rollup/plugin-terser": "^0.1.0",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/is-url": "^1.2.30",
|
||||
@@ -126,7 +123,7 @@ var packageJson = {
|
||||
var windows = [
|
||||
{
|
||||
url: "https://weread.qq.com/",
|
||||
transparent: false,
|
||||
transparent: true,
|
||||
fullscreen: false,
|
||||
width: 1200,
|
||||
height: 780,
|
||||
@@ -140,7 +137,7 @@ var user_agent = {
|
||||
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: false,
|
||||
macos: true,
|
||||
linux: false,
|
||||
windows: false
|
||||
};
|
||||
@@ -149,14 +146,11 @@ var system_tray = {
|
||||
linux: true,
|
||||
windows: true
|
||||
};
|
||||
var inject = [
|
||||
];
|
||||
var pakeConf = {
|
||||
windows: windows,
|
||||
user_agent: user_agent,
|
||||
menu: menu,
|
||||
system_tray: system_tray,
|
||||
inject: inject
|
||||
system_tray: system_tray
|
||||
};
|
||||
|
||||
var tauri$3 = {
|
||||
@@ -176,7 +170,7 @@ var tauri$3 = {
|
||||
active: false
|
||||
},
|
||||
systemTray: {
|
||||
iconPath: "png/icon_512.png",
|
||||
iconPath: "png/weread_512.png",
|
||||
iconAsTemplate: true
|
||||
},
|
||||
allowlist: {
|
||||
@@ -197,11 +191,11 @@ var build = {
|
||||
beforeDevCommand: ""
|
||||
};
|
||||
var CommonConf = {
|
||||
tauri: tauri$3,
|
||||
"package": {
|
||||
productName: "WeRead",
|
||||
version: "1.0.0"
|
||||
},
|
||||
tauri: tauri$3,
|
||||
build: build
|
||||
};
|
||||
|
||||
@@ -245,9 +239,9 @@ var WinConf = {
|
||||
var tauri$1 = {
|
||||
bundle: {
|
||||
icon: [
|
||||
"icons/icon.icns"
|
||||
"icons/weread.icns"
|
||||
],
|
||||
identifier: "com.pake.5b8ae9",
|
||||
identifier: "com.pake.weread",
|
||||
active: true,
|
||||
category: "DeveloperTool",
|
||||
copyright: "",
|
||||
@@ -443,8 +437,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';
|
||||
@@ -876,7 +871,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;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "pake-cli",
|
||||
"version": "2.2.0",
|
||||
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。",
|
||||
"version": "2.2.5",
|
||||
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
},
|
||||
|
||||
4
script/build.ps1
vendored
4
script/build.ps1
vendored
@@ -39,6 +39,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(",")
|
||||
$domain = ([Uri]$url).Host
|
||||
Write-Host "building package ${index}/${total}"
|
||||
Write-Host "package name is ${name} ${name_zh}"
|
||||
Write-Host "=========================="
|
||||
@@ -54,6 +55,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
|
||||
|
||||
8
script/build.sh
vendored
8
script/build.sh
vendored
@@ -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
|
||||
@@ -145,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}"
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
use std::fs;
|
||||
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 {
|
||||
@@ -26,11 +25,13 @@ 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) => {
|
||||
|
||||
5
src-tauri/src/inject/style.js
vendored
5
src-tauri/src/inject/style.js
vendored
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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": "",
|
||||
|
||||
Reference in New Issue
Block a user