✨ 2.0 Upgrade Plan
This commit is contained in:
11
.dockerignore
Normal file
11
.dockerignore
Normal file
@@ -0,0 +1,11 @@
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
**/target
|
||||
**/node_modules
|
||||
|
||||
**/*.log
|
||||
**/*.md
|
||||
**/tmp
|
||||
|
||||
Dockerfile
|
||||
49
.github/workflows/docker-publish.yml
vendored
Normal file
49
.github/workflows/docker-publish.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
name: Build and Publish Docker Image
|
||||
|
||||
on:
|
||||
workflow_dispatch: # Manual
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
type=sha
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
platforms: linux/amd64
|
||||
57
Dockerfile
Normal file
57
Dockerfile
Normal file
@@ -0,0 +1,57 @@
|
||||
# syntax=docker/dockerfile:1.4
|
||||
# Cargo build stage
|
||||
FROM rust:1.80-slim AS cargo-builder
|
||||
# Install Rust dependencies
|
||||
RUN --mount=type=cache,target=/var/cache/apt \
|
||||
--mount=type=cache,target=/usr/local/cargo/registry \
|
||||
apt-get update && apt-get install -y --no-install-recommends \
|
||||
libdbus-1-dev libsoup2.4-dev libjavascriptcoregtk-4.0-dev \
|
||||
libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev \
|
||||
libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev \
|
||||
gnome-video-effects
|
||||
COPY . /pake
|
||||
WORKDIR /pake/src-tauri
|
||||
# Build cargo packages and store cache
|
||||
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||
cargo fetch && \
|
||||
cargo build --release && \
|
||||
mkdir -p /cargo-cache && \
|
||||
cp -R /usr/local/cargo/registry /cargo-cache/ && \
|
||||
cp -R /usr/local/cargo/git /cargo-cache/
|
||||
|
||||
# Verify the content of /cargo-cache && clean unnecessary files
|
||||
RUN ls -la /cargo-cache/registry && ls -la /cargo-cache/git && rm -rfd /cargo-cache/registry/src
|
||||
|
||||
# Main build stage
|
||||
FROM rust:1.80-slim AS builder
|
||||
# Install Rust dependencies
|
||||
RUN --mount=type=cache,target=/var/cache/apt \
|
||||
--mount=type=cache,target=/usr/local/cargo/registry \
|
||||
apt-get update && apt-get install -y --no-install-recommends \
|
||||
libdbus-1-dev libsoup2.4-dev libjavascriptcoregtk-4.0-dev \
|
||||
libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev \
|
||||
libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev \
|
||||
gnome-video-effects
|
||||
|
||||
# Install Node.js 20.x
|
||||
RUN --mount=type=cache,target=/var/cache/apt \
|
||||
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
||||
apt-get update && apt-get install -y nodejs
|
||||
|
||||
# Copy project files
|
||||
COPY . /pake
|
||||
WORKDIR /pake
|
||||
|
||||
# Copy Rust build artifacts
|
||||
COPY --from=cargo-builder /pake/src-tauri /pake/src-tauri
|
||||
COPY --from=cargo-builder /cargo-cache/git /usr/local/cargo/git
|
||||
COPY --from=cargo-builder /cargo-cache/registry /usr/local/cargo/registry
|
||||
|
||||
# Install dependencies and build pake-cli
|
||||
RUN --mount=type=cache,target=/root/.npm \
|
||||
npm install && \
|
||||
npm run cli:build
|
||||
|
||||
# Set up the entrypoint
|
||||
WORKDIR /output
|
||||
ENTRYPOINT ["node", "/pake/cli.js"]
|
||||
40
README.md
40
README.md
@@ -44,8 +44,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/17dC9I.jpg width=600/></td>
|
||||
<td><img src=https://cdn.fliggy.com/upic/mc41xq.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/WeRead.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Twitter.jpg width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ChatGPT
|
||||
@@ -60,8 +60,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/5aO6yP.png width=600/></td>
|
||||
<td><img src=https://cdn.fliggy.com/upic/Ztsx23.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/ChatGPT.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Poe.png width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>YouTube Music
|
||||
@@ -76,8 +76,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/master/pic/12.png width=600/></td>
|
||||
<td><img src=https://gw.alipayobjects.com/zos/k/pn/1.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/YouTubeMusic.png width=600 /></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/YouTube.jpg width=600 /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>LiZhi
|
||||
@@ -92,8 +92,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/nYEKqN.jpg width=600/></td>
|
||||
<td><img src=https://gw.alipayobjects.com/zos/k/r7/0C9lju.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/LiZhi.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/ProgramMusic.jpg width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Qwerty
|
||||
@@ -108,8 +108,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/i2eg6G.png width=600/></td>
|
||||
<td><img src=https://cdn.fliggy.com/upic/mUzOek.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Qwerty.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/CodeRunner.jpg width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Flomo
|
||||
@@ -124,8 +124,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://gw.alipayobjects.com/zos/k/30/RoUSUf.png width=600/></td>
|
||||
<td><img src=https://gw.alipayobjects.com/zos/k/89/yJVwyi.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Flomo.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/XiaoHongShu.png width=600/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -159,7 +159,7 @@ In addition, double-click the title bar to switch to full-screen mode. For Mac u
|
||||
|
||||
## Command-Line Packaging
|
||||
|
||||

|
||||

|
||||
|
||||
**Pake provides a command line tool, making the flow of package customization quicker and easier. See [documentation](./bin/README.md) for more information.**
|
||||
|
||||
@@ -172,6 +172,7 @@ pake url [OPTIONS]...
|
||||
|
||||
# Feel free to play with Pake! It might take a while to prepare the environment the first time you launch Pake.
|
||||
pake https://weekly.tw93.fun --name Weekly --hide-title-bar
|
||||
|
||||
```
|
||||
|
||||
If you are new to the command line, you can compile packages online with _GitHub Actions_. See the [Tutorial](<https://github.com/tw93/Pake/wiki/Online-Compilation-(used-by-ordinary-users)>) for more information.
|
||||
@@ -392,21 +393,28 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
||||
<sub><b>Po Chen</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Tianj0o">
|
||||
<img src="https://avatars.githubusercontent.com/u/68584284?v=4" width="90;" alt="Tianj0o"/>
|
||||
<br />
|
||||
<sub><b>Qitianjia</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/geekvest">
|
||||
<img src="https://avatars.githubusercontent.com/u/126322776?v=4" width="90;" alt="geekvest"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/houhoz">
|
||||
<img src="https://avatars.githubusercontent.com/u/19684376?v=4" width="90;" alt="houhoz"/>
|
||||
<br />
|
||||
<sub><b>Hyzhao</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/lakca">
|
||||
<img src="https://avatars.githubusercontent.com/u/16255922?v=4" width="90;" alt="lakca"/>
|
||||
|
||||
92
README_CN.md
92
README_CN.md
@@ -43,8 +43,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/17dC9I.jpg width=600/></td>
|
||||
<td><img src=https://cdn.fliggy.com/upic/mc41xq.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/WeRead.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Twitter.jpg width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ChatGPT
|
||||
@@ -59,8 +59,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/5aO6yP.png width=600/></td>
|
||||
<td><img src=https://cdn.fliggy.com/upic/Ztsx23.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/ChatGPT.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Poe.png width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>YouTube Music
|
||||
@@ -75,8 +75,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/master/pic/12.png width=600 /></td>
|
||||
<td><img src=https://gw.alipayobjects.com/zos/k/pn/1.jpg width=600 /></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/YouTubeMusic.png width=600 /></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/YouTube.jpg width=600 /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>LiZhi
|
||||
@@ -91,8 +91,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/nYEKqN.jpg width=600/></td>
|
||||
<td><img src=https://gw.alipayobjects.com/zos/k/r7/0C9lju.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/LiZhi.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/ProgramMusic.jpg width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Qwerty
|
||||
@@ -107,8 +107,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/i2eg6G.png width=600/></td>
|
||||
<td><img src=https://cdn.fliggy.com/upic/mUzOek.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Qwerty.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/CodeRunner.jpg width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Flomo
|
||||
@@ -123,8 +123,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://gw.alipayobjects.com/zos/k/30/RoUSUf.png width=600/></td>
|
||||
<td><img src=https://gw.alipayobjects.com/zos/k/89/yJVwyi.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Flomo.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/XiaoHongShu.png width=600/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -159,10 +159,7 @@
|
||||
|
||||
## 命令行一键打包
|
||||
|
||||
<kbd>
|
||||
<img src="https://gw.alipayobjects.com/zos/k/zd/pake.gif" width="100%">
|
||||
</kbd>
|
||||
<br/><br/>
|
||||

|
||||
|
||||
**Pake 提供了命令行工具,可以更快捷方便地一键自定义打你需要的包,详细可见 [文档](./bin/README_CN.md)。**
|
||||
|
||||
@@ -259,6 +256,13 @@ Pake 的发展离不开这些 Hacker 们,一起贡献了大量能力,也欢
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/YangguangZhou">
|
||||
<img src="https://avatars.githubusercontent.com/u/61733195?v=4" width="90;" alt="YangguangZhou"/>
|
||||
<br />
|
||||
<sub><b>Jerry Zhou</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/AielloChan">
|
||||
<img src="https://avatars.githubusercontent.com/u/7900765?v=4" width="90;" alt="AielloChan"/>
|
||||
@@ -280,6 +284,13 @@ Pake 的发展离不开这些 Hacker 们,一起贡献了大量能力,也欢
|
||||
<sub><b>Pake Actions</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/eltociear">
|
||||
<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="90;" alt="eltociear"/>
|
||||
<br />
|
||||
<sub><b>Ikko Eltociear Ashimine</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/QingZ11">
|
||||
<img src="https://avatars.githubusercontent.com/u/38887077?v=4" width="90;" alt="QingZ11"/>
|
||||
@@ -293,7 +304,8 @@ Pake 的发展离不开这些 Hacker 们,一起贡献了大量能力,也欢
|
||||
<br />
|
||||
<sub><b>孟世博</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/2nthony">
|
||||
<img src="https://avatars.githubusercontent.com/u/19513289?v=4" width="90;" alt="2nthony"/>
|
||||
@@ -307,8 +319,7 @@ Pake 的发展离不开这些 Hacker 们,一起贡献了大量能力,也欢
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/imabutahersiddik">
|
||||
<img src="https://avatars.githubusercontent.com/u/138387257?v=4" width="90;" alt="imabutahersiddik"/>
|
||||
@@ -343,6 +354,28 @@ Pake 的发展离不开这些 Hacker 们,一起贡献了大量能力,也欢
|
||||
<br />
|
||||
<sub><b>Fechin</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/ImgBotApp">
|
||||
<img src="https://avatars.githubusercontent.com/u/31427850?v=4" width="90;" alt="ImgBotApp"/>
|
||||
<br />
|
||||
<sub><b>Imgbot</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/droid-Q">
|
||||
<img src="https://avatars.githubusercontent.com/u/708277?v=4" width="90;" alt="droid-Q"/>
|
||||
<br />
|
||||
<sub><b>Jiaqi Gu</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/mattbajorek">
|
||||
<img src="https://avatars.githubusercontent.com/u/17235301?v=4" width="90;" alt="mattbajorek"/>
|
||||
<br />
|
||||
<sub><b>Matt Bajorek</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Milo123459">
|
||||
@@ -357,6 +390,20 @@ Pake 的发展离不开这些 Hacker 们,一起贡献了大量能力,也欢
|
||||
<br />
|
||||
<sub><b>Po Chen</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Tianj0o">
|
||||
<img src="https://avatars.githubusercontent.com/u/68584284?v=4" width="90;" alt="Tianj0o"/>
|
||||
<br />
|
||||
<sub><b>Qitianjia</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/geekvest">
|
||||
<img src="https://avatars.githubusercontent.com/u/126322776?v=4" width="90;" alt="geekvest"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
@@ -373,6 +420,13 @@ Pake 的发展离不开这些 Hacker 们,一起贡献了大量能力,也欢
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/liudonghua123">
|
||||
<img src="https://avatars.githubusercontent.com/u/2276718?v=4" width="90;" alt="liudonghua123"/>
|
||||
<br />
|
||||
<sub><b>Liudonghua</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/liusishan">
|
||||
<img src="https://avatars.githubusercontent.com/u/33129823?v=4" width="90;" alt="liusishan"/>
|
||||
|
||||
66
README_JP.md
66
README_JP.md
@@ -44,8 +44,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/17dC9I.jpg width=600/></td>
|
||||
<td><img src=https://cdn.fliggy.com/upic/mc41xq.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/WeRead.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Twitter.jpg width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ChatGPT
|
||||
@@ -60,8 +60,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/5aO6yP.png width=600/></td>
|
||||
<td><img src=https://cdn.fliggy.com/upic/Ztsx23.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/ChatGPT.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Poe.png width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>YouTube Music
|
||||
@@ -76,8 +76,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/master/pic/12.png width=600/></td>
|
||||
<td><img src=https://gw.alipayobjects.com/zos/k/pn/1.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/YouTubeMusic.png width=600 /></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/YouTube.jpg width=600 /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>LiZhi
|
||||
@@ -92,8 +92,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/nYEKqN.jpg width=600/></td>
|
||||
<td><img src=https://gw.alipayobjects.com/zos/k/r7/0C9lju.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/LiZhi.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/ProgramMusic.jpg width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Qwerty
|
||||
@@ -108,8 +108,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://cdn.fliggy.com/upic/i2eg6G.png width=600/></td>
|
||||
<td><img src=https://cdn.fliggy.com/upic/mUzOek.jpg width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Qwerty.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/CodeRunner.jpg width=600/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Flomo
|
||||
@@ -124,8 +124,8 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src=https://gw.alipayobjects.com/zos/k/30/RoUSUf.png width=600/></td>
|
||||
<td><img src=https://gw.alipayobjects.com/zos/k/89/yJVwyi.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/Flomo.png width=600/></td>
|
||||
<td><img src=https://raw.githubusercontent.com/tw93/static/main/pake/XiaoHongShu.png width=600/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
|
||||
## コマンドラインパッケージング
|
||||
|
||||

|
||||

|
||||
|
||||
**Pake はコマンドラインツールを提供しており、必要なパッケージをより迅速かつ簡単にカスタマイズすることができます。詳細は[ドキュメント](./bin/README.md)をご覧ください。**
|
||||
|
||||
@@ -285,6 +285,13 @@ Pake の開発はこれらのハッカーたちなしにはあり得ませんで
|
||||
<sub><b>Pake Actions</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/eltociear">
|
||||
<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="90;" alt="eltociear"/>
|
||||
<br />
|
||||
<sub><b>Ikko Eltociear Ashimine</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/QingZ11">
|
||||
<img src="https://avatars.githubusercontent.com/u/38887077?v=4" width="90;" alt="QingZ11"/>
|
||||
@@ -298,15 +305,15 @@ Pake の開発はこれらのハッカーたちなしにはあり得ませんで
|
||||
<br />
|
||||
<sub><b>孟世博</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/2nthony">
|
||||
<img src="https://avatars.githubusercontent.com/u/19513289?v=4" width="90;" alt="2nthony"/>
|
||||
<br />
|
||||
<sub><b>2nthony</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/ACGNnsj">
|
||||
<img src="https://avatars.githubusercontent.com/u/22112141?v=4" width="90;" alt="ACGNnsj"/>
|
||||
@@ -348,13 +355,6 @@ Pake の開発はこれらのハッカーたちなしにはあり得ませんで
|
||||
<br />
|
||||
<sub><b>Fechin</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/eltociear">
|
||||
<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="90;" alt="eltociear"/>
|
||||
<br />
|
||||
<sub><b>Ikko Eltociear Ashimine</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
@@ -371,6 +371,13 @@ Pake の開発はこれらのハッカーたちなしにはあり得ませんで
|
||||
<sub><b>Jiaqi Gu</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/mattbajorek">
|
||||
<img src="https://avatars.githubusercontent.com/u/17235301?v=4" width="90;" alt="mattbajorek"/>
|
||||
<br />
|
||||
<sub><b>Matt Bajorek</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Milo123459">
|
||||
<img src="https://avatars.githubusercontent.com/u/50248166?v=4" width="90;" alt="Milo123459"/>
|
||||
@@ -385,13 +392,21 @@ Pake の開発はこれらのハッカーたちなしにはあり得ませんで
|
||||
<sub><b>Po Chen</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Tianj0o">
|
||||
<img src="https://avatars.githubusercontent.com/u/68584284?v=4" width="90;" alt="Tianj0o"/>
|
||||
<br />
|
||||
<sub><b>Qitianjia</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/geekvest">
|
||||
<img src="https://avatars.githubusercontent.com/u/126322776?v=4" width="90;" alt="geekvest"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/houhoz">
|
||||
<img src="https://avatars.githubusercontent.com/u/19684376?v=4" width="90;" alt="houhoz"/>
|
||||
@@ -405,8 +420,7 @@ Pake の開発はこれらのハッカーたちなしにはあり得ませんで
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/liudonghua123">
|
||||
<img src="https://avatars.githubusercontent.com/u/2276718?v=4" width="90;" alt="liudonghua123"/>
|
||||
|
||||
41
bin/README.md
vendored
41
bin/README.md
vendored
@@ -146,6 +146,14 @@ Sets whether the window is always at the top level, defaults to `false`.
|
||||
--always-on-top
|
||||
```
|
||||
|
||||
#### [dark-mode]
|
||||
|
||||
Force Mac to package applications using dark mode, default is `false`.
|
||||
|
||||
```shell
|
||||
--dark-mode
|
||||
```
|
||||
|
||||
#### [disabled-web-shortcuts]
|
||||
|
||||
Sets whether to disable web shortcuts in the original Pake container, defaults to `false`.
|
||||
@@ -211,6 +219,14 @@ Specify the system tray icon. This is only effective when the system tray is ena
|
||||
--system-tray-icon <path>
|
||||
```
|
||||
|
||||
#### [installer-language]
|
||||
|
||||
Set the Windows Installer language. Options include `zh-CN`, `ja-JP`, More at [Tauri Document](https://tauri.app/zh-cn/v1/guides/building/windows/#internationalization). Default is `en-US`.
|
||||
|
||||
```shell
|
||||
--installer-language <language>
|
||||
```
|
||||
|
||||
#### [use-local-file]
|
||||
|
||||
Enable recursive copying. When the URL is a local file path, enabling this option will copy the folder containing the file specified in the URL, as well as all sub-files, to the Pake static folder. This is disabled by default.
|
||||
@@ -227,14 +243,12 @@ Using `inject`, you can inject local absolute and relative path `css` and `js` f
|
||||
--inject ./tools/style.css,./tools/hotkey.js
|
||||
```
|
||||
|
||||
#### [safe-domain]
|
||||
#### [proxy-url]
|
||||
|
||||
This secure domain is a domain other than your currently configured `url` to which you may be redirected or jumped to, and only in domains that have been configured as secure can you use `tauri` to expose `api` to browsers to ensure that pake's built-in enhancements work correctly. Only in a domain that has been configured as secure can you use the `tauri` to expose the `api` to the browser, ensuring that `pake's` built-in enhancements work correctly.
|
||||
|
||||
PS: Secure domains do not need to carry protocols.
|
||||
If you need to proxy requests for some reason, you can set the proxy address using the `proxy-url` option.
|
||||
|
||||
```shell
|
||||
--safe-domain weread.qq.com,google.com
|
||||
--proxy-url <url>
|
||||
```
|
||||
|
||||
#### [debug]
|
||||
@@ -248,3 +262,20 @@ The typed package has dev-tools for debugging, in addition to outputting more lo
|
||||
## Conclusion
|
||||
|
||||
After completing the above steps, your application should be successfully packaged. Please note that the packaging process may take some time depending on your system configuration and network conditions. Be patient, and once the packaging is complete, you can find the application installer in the specified directory.
|
||||
|
||||
## Docker
|
||||
|
||||
```shell
|
||||
# On Linux, you can run the Pake CLI via Docker
|
||||
docker run -it --rm \ # Run interactively, remove container after exit
|
||||
-v YOUR_DIR:/output \ # Files from container's /output will be in YOU_DIR
|
||||
ghcr.io/tw93/pake \
|
||||
<arguments>
|
||||
|
||||
# For example:
|
||||
docker run -it --rm \
|
||||
-v ./packages:/output \
|
||||
ghcr.io/tw93/pake \
|
||||
https://example.com --name myapp --icon ./icon.png
|
||||
|
||||
```
|
||||
|
||||
43
bin/README_CN.md
vendored
43
bin/README_CN.md
vendored
@@ -146,6 +146,14 @@ pake [url] [options]
|
||||
--always-on-top
|
||||
```
|
||||
|
||||
#### [dark-mode]
|
||||
|
||||
强制 Mac 打包应用使用黑暗模式,默认为 `false`。
|
||||
|
||||
```shell
|
||||
--dark-mode
|
||||
```
|
||||
|
||||
#### [disabled-web-shortcuts]
|
||||
|
||||
设置是否禁用原有 Pake 容器里面的网页操作快捷键,默认为 `false`。
|
||||
@@ -212,6 +220,14 @@ Linux,默认为 `all`。
|
||||
--system-tray-icon <path>
|
||||
```
|
||||
|
||||
#### [installer-language]
|
||||
|
||||
设置 Windows 安装包语言。支持 `zh-CN`、`ja-JP`,更多在 [Tauri 文档](https://tauri.app/zh-cn/v1/guides/building/windows/#internationalization)。默认为 `en-US`。
|
||||
|
||||
```shell
|
||||
--installer-language <language>
|
||||
```
|
||||
|
||||
#### [use-local-file]
|
||||
|
||||
当 `url` 为本地文件路径时,如果启用此选项,则会递归地将 `url` 路径文件所在的文件夹及其所有子文件复
|
||||
@@ -234,16 +250,12 @@ Linux,默认为 `all`。
|
||||
--inject ./tools/style.css --inject ./tools/hotkey.js
|
||||
```
|
||||
|
||||
#### [safe-domain]
|
||||
#### [proxy-url]
|
||||
|
||||
这个安全域名是除你当前配置的 `url` 之外可能会出现重定向或跳转到的其他域名,只有在已配置为安全的域名中,
|
||||
|
||||
才能够使用 `tauri` 暴露到浏览器的 `api` ,保证 `pake` 内置增强功能的正确运行。
|
||||
|
||||
PS: 安全域名不需要携带协议。
|
||||
假如你由于某些缘故需要代理请求,你可以通过 `proxy-url` 选项来设置代理地址。
|
||||
|
||||
```shell
|
||||
--safe-domain weread.qq.com,google.com
|
||||
--proxy-url <url>
|
||||
```
|
||||
|
||||
#### [debug]
|
||||
@@ -257,3 +269,20 @@ PS: 安全域名不需要携带协议。
|
||||
## 结语
|
||||
|
||||
完成上述步骤后,您的应用程序应该已经成功打包。请注意,根据您的系统配置和网络状况,打包过程可能需要一些时间。请耐心等待,一旦打包完成,您就可以在指定的目录中找到应用程序安装包。
|
||||
|
||||
## Docker
|
||||
|
||||
```shell
|
||||
# 在Linux上,您可以通过 Docker 运行 Pake CLI。
|
||||
docker run -it --rm \ # Run interactively, remove container after exit
|
||||
-v YOUR_DIR:/output \ # Files from container's /output will be in YOU_DIR
|
||||
ghcr.io/tw93/pake \
|
||||
<arguments>
|
||||
|
||||
# For example:
|
||||
docker run -it --rm \
|
||||
-v ./packages:/output \
|
||||
ghcr.io/tw93/pake \
|
||||
https://example.com --name myapp --icon ./icon.png
|
||||
|
||||
```
|
||||
|
||||
9
bin/cli.ts
vendored
9
bin/cli.ts
vendored
@@ -39,20 +39,19 @@ program
|
||||
new Option('--targets <string>', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT.targets).hideHelp(),
|
||||
)
|
||||
.addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT.alwaysOnTop).hideHelp())
|
||||
.addOption(new Option('--dark-mode', 'Force Mac app to use dark mode').default(DEFAULT.darkMode).hideHelp())
|
||||
.addOption(
|
||||
new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts')
|
||||
.default(DEFAULT.disabledWebShortcuts)
|
||||
.hideHelp(),
|
||||
)
|
||||
.addOption(
|
||||
new Option('--safe-domain [domains...]', 'Domains that Require Security Configuration')
|
||||
.default(DEFAULT.safeDomain)
|
||||
.hideHelp(),
|
||||
)
|
||||
.addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT.showSystemTray).hideHelp())
|
||||
.addOption(
|
||||
new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT.systemTrayIcon).hideHelp(),
|
||||
)
|
||||
.addOption(
|
||||
new Option('--installer-language <string>', 'Installer language').default(DEFAULT.installerLanguage).hideHelp(),
|
||||
)
|
||||
.version(packageJson.version, '-v, --version', 'Output the current version')
|
||||
.action(async (url: string, options: PakeCliOptions) => {
|
||||
await checkUpdateTips();
|
||||
|
||||
9
bin/defaults.ts
vendored
9
bin/defaults.ts
vendored
@@ -8,10 +8,11 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
|
||||
resizable: true,
|
||||
hideTitleBar: false,
|
||||
alwaysOnTop: false,
|
||||
darkMode: false,
|
||||
disabledWebShortcuts: false,
|
||||
activationShortcut: '',
|
||||
userAgent: '',
|
||||
showSystemTray: true,
|
||||
showSystemTray: false,
|
||||
multiArch: false,
|
||||
targets: 'deb',
|
||||
useLocalFile: false,
|
||||
@@ -19,13 +20,13 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
|
||||
proxyUrl: "",
|
||||
debug: false,
|
||||
inject: [],
|
||||
safeDomain: [],
|
||||
installerLanguage: 'en-US',
|
||||
};
|
||||
|
||||
// Just for cli development
|
||||
export const DEFAULT_DEV_PAKE_OPTIONS: PakeCliOptions & { url: string } = {
|
||||
...DEFAULT_PAKE_OPTIONS,
|
||||
url: 'https://www.xiaoyuzhoufm.com/',
|
||||
name: 'XiaoYuZhou',
|
||||
url: 'https://weread.qq.com',
|
||||
name: 'WeRead',
|
||||
hideTitleBar: true,
|
||||
};
|
||||
|
||||
13
bin/helpers/merge.ts
vendored
13
bin/helpers/merge.ts
vendored
@@ -14,6 +14,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
||||
fullscreen,
|
||||
hideTitleBar,
|
||||
alwaysOnTop,
|
||||
darkMode,
|
||||
disabledWebShortcuts,
|
||||
activationShortcut,
|
||||
userAgent,
|
||||
@@ -25,6 +26,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
||||
resizable = true,
|
||||
inject,
|
||||
proxyUrl,
|
||||
installerLanguage,
|
||||
} = options;
|
||||
|
||||
const { platform } = process;
|
||||
@@ -38,12 +40,16 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
||||
hide_title_bar: hideTitleBar,
|
||||
activation_shortcut: activationShortcut,
|
||||
always_on_top: alwaysOnTop,
|
||||
dark_mode: darkMode,
|
||||
disabled_web_shortcuts: disabledWebShortcuts,
|
||||
};
|
||||
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
|
||||
|
||||
tauriConf.productName = name;
|
||||
tauriConf.identifier = identifier;
|
||||
tauriConf.package.productName = name;
|
||||
tauriConf.tauri.bundle.identifier = identifier;
|
||||
if (platform == "win32") {
|
||||
tauriConf.tauri.bundle.windows.wix.language[0] = installerLanguage;
|
||||
}
|
||||
|
||||
//Judge the type of URL, whether it is a file or a website.
|
||||
const pathExists = await fsExtra.pathExists(url);
|
||||
@@ -189,9 +195,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
||||
tauriConf.pake.inject = [];
|
||||
await fsExtra.writeFile(injectFilePath, '');
|
||||
}
|
||||
|
||||
tauriConf.pake.proxy_url = proxyUrl || "";
|
||||
|
||||
// Save config file.
|
||||
const platformConfigPaths: PlatformMap = {
|
||||
win32: 'tauri.windows.conf.json',
|
||||
@@ -212,7 +216,6 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
tauriConf2.bundle = bundleConf.bundle;
|
||||
}
|
||||
console.log('tauriConf', tauriConf2)
|
||||
const configJsonPath = path.join(tauriConfigDirectory, 'tauri.conf.json');
|
||||
await fsExtra.outputJSON(configJsonPath, tauriConf2, { spaces: 4 });
|
||||
}
|
||||
|
||||
10
bin/types.ts
vendored
10
bin/types.ts
vendored
@@ -27,6 +27,10 @@ export interface PakeCliOptions {
|
||||
// Enable windows always on top, default false
|
||||
alwaysOnTop: boolean;
|
||||
|
||||
|
||||
// Force Mac to use dark mode, default false
|
||||
darkMode: boolean;
|
||||
|
||||
// Disable web shortcuts, default false
|
||||
disabledWebShortcuts: boolean;
|
||||
|
||||
@@ -57,11 +61,11 @@ export interface PakeCliOptions {
|
||||
/** 需要注入页面的外部脚本 */
|
||||
inject: string[];
|
||||
|
||||
/* the domain that can use ipc or tauri javascript sdk */
|
||||
safeDomain: string[];
|
||||
|
||||
// Proxy
|
||||
proxyUrl: string;
|
||||
|
||||
// Installer language, valid for Windows users, default is en-US
|
||||
installerLanguage: string;
|
||||
}
|
||||
|
||||
export interface PakeAppOptions extends PakeCliOptions {
|
||||
|
||||
5
script/build_with_pake_cli.js
vendored
5
script/build_with_pake_cli.js
vendored
@@ -17,7 +17,6 @@ console.log('hide-title-bar: ', process.env.HIDE_TITLE_BAR);
|
||||
console.log('resize: ', process.env.RESIZE);
|
||||
console.log('is multi arch? only for Mac: ', process.env.MULTI_ARCH);
|
||||
console.log('targets type? only for Linux: ', process.env.TARGETS);
|
||||
console.log('safe-domain: ', process.env.SAFE_DOMAIN);
|
||||
console.log('===========================\n');
|
||||
|
||||
cd('node_modules/pake-cli');
|
||||
@@ -40,10 +39,6 @@ if (process.env.TARGETS) {
|
||||
params = `${params} --targets ${process.env.TARGETS}`;
|
||||
}
|
||||
|
||||
if (process.env.SAFE_DOMAIN) {
|
||||
params = `${params} --safe-domain ${process.env.SAFE_DOMAIN}`;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||
params = `${params} --show-system-tray`;
|
||||
}
|
||||
|
||||
12
src-tauri/Cargo.lock
generated
12
src-tauri/Cargo.lock
generated
@@ -2451,6 +2451,7 @@ dependencies = [
|
||||
"tauri-plugin-oauth",
|
||||
"tauri-plugin-shell",
|
||||
"tauri-plugin-window-state",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3409,6 +3410,15 @@ version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simd-adler32"
|
||||
version = "0.3.7"
|
||||
@@ -4178,7 +4188,9 @@ dependencies = [
|
||||
"bytes",
|
||||
"libc",
|
||||
"mio",
|
||||
"parking_lot",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.52.0",
|
||||
|
||||
@@ -28,6 +28,7 @@ tauri-plugin-http = "2.0.3"
|
||||
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
|
||||
tauri-plugin-global-shortcut = { version = "2.0.1" }
|
||||
tauri-plugin-shell = "2.0.0"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
|
||||
[dev-dependencies]
|
||||
cargo-bloat = "0.12.1"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"height": 780,
|
||||
"resizable": true,
|
||||
"always_on_top": false,
|
||||
"dark_mode": false,
|
||||
"activation_shortcut": "",
|
||||
"disabled_web_shortcuts": false
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ pub struct WindowConfig {
|
||||
pub resizable: bool,
|
||||
pub url_type: String,
|
||||
pub always_on_top: bool,
|
||||
pub dark_mode: bool,
|
||||
pub disabled_web_shortcuts: bool,
|
||||
pub activation_shortcut: String,
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ use std::fs::{self, File};
|
||||
use std::io::Write;
|
||||
use std::str::FromStr;
|
||||
use tauri::http::Method;
|
||||
use tauri_plugin_http::reqwest::{ClientBuilder, Request};
|
||||
use tauri::{command, AppHandle, Manager, Url, WebviewWindow};
|
||||
use tauri_plugin_http::reqwest::{ClientBuilder, Request};
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
pub struct DownloadFileParams {
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
use tauri::{
|
||||
image::Image,
|
||||
menu::{MenuBuilder, MenuItemBuilder},
|
||||
tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent},
|
||||
tray::TrayIconBuilder,
|
||||
AppHandle, Manager,
|
||||
};
|
||||
use tauri_plugin_window_state::{AppHandleExt, StateFlags};
|
||||
|
||||
use super::config::PakeConfig;
|
||||
|
||||
pub fn set_system_tray(app: &AppHandle, pake_config: &PakeConfig) -> tauri::Result<()> {
|
||||
pub fn set_system_tray(app: &AppHandle) -> tauri::Result<()> {
|
||||
let hide_app = MenuItemBuilder::with_id("hide_app", "Hide").build(app)?;
|
||||
let show_app = MenuItemBuilder::with_id("show_app", "Show").build(app)?;
|
||||
let quit = MenuItemBuilder::with_id("quit", "Quit").build(app)?;
|
||||
@@ -17,32 +14,7 @@ pub fn set_system_tray(app: &AppHandle, pake_config: &PakeConfig) -> tauri::Resu
|
||||
.build()?;
|
||||
app.app_handle().remove_tray_by_id("pake-tray");
|
||||
let tray = TrayIconBuilder::new()
|
||||
.icon(Image::from_path(pake_config.system_tray_path.as_str())?)
|
||||
.menu(&menu)
|
||||
.on_tray_icon_event(move |tray, event| {
|
||||
if let TrayIconEvent::Click {
|
||||
button: MouseButton::Left,
|
||||
button_state: MouseButtonState::Up,
|
||||
..
|
||||
} = event
|
||||
{
|
||||
println!("click");
|
||||
|
||||
let app = tray.app_handle();
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
{
|
||||
if let Some(webview_window) = app.get_webview_window("pake") {
|
||||
let _ = webview_window.show();
|
||||
let _ = webview_window.set_focus();
|
||||
}
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
tauri::AppHandle::show(&app.app_handle()).unwrap();
|
||||
}
|
||||
}
|
||||
})
|
||||
.on_menu_event(move |app, event| match event.id().as_ref() {
|
||||
"hide_app" => {
|
||||
app.get_webview_window("pake").unwrap().minimize().unwrap();
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::{path::PathBuf, str::FromStr};
|
||||
use tauri::{App, Url, WebviewUrl, WebviewWindow, WebviewWindowBuilder};
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
use tauri::TitleBarStyle;
|
||||
use tauri::{Theme, TitleBarStyle};
|
||||
|
||||
pub fn get_window(app: &mut App, config: &PakeConfig, _data_dir: PathBuf) -> WebviewWindow {
|
||||
let window_config = config
|
||||
@@ -31,7 +31,6 @@ pub fn get_window(app: &mut App, config: &PakeConfig, _data_dir: PathBuf) -> Web
|
||||
.resizable(window_config.resizable)
|
||||
.fullscreen(window_config.fullscreen)
|
||||
.inner_size(window_config.width, window_config.height)
|
||||
.disable_drag_drop_handler()
|
||||
.always_on_top(window_config.always_on_top)
|
||||
.initialization_script(&config_script)
|
||||
.initialization_script(include_str!("../inject/component.js"))
|
||||
@@ -41,7 +40,6 @@ pub fn get_window(app: &mut App, config: &PakeConfig, _data_dir: PathBuf) -> Web
|
||||
.initialization_script(include_str!("../inject/custom.js"));
|
||||
|
||||
if config.proxy_url != "" {
|
||||
println!("{}", &config.proxy_url);
|
||||
window_builder =
|
||||
window_builder.proxy_url(Url::from_str(&config.proxy_url.as_str()).unwrap());
|
||||
}
|
||||
@@ -53,12 +51,18 @@ pub fn get_window(app: &mut App, config: &PakeConfig, _data_dir: PathBuf) -> Web
|
||||
} else {
|
||||
TitleBarStyle::Visible
|
||||
};
|
||||
window_builder = window_builder.title_bar_style(title_bar_style)
|
||||
window_builder = window_builder.title_bar_style(title_bar_style);
|
||||
|
||||
if window_config.dark_mode {
|
||||
window_builder = window_builder.theme(Some(Theme::Dark));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
{
|
||||
window_builder = window_builder.data_directory(_data_dir);
|
||||
window_builder = window_builder
|
||||
.data_directory(_data_dir)
|
||||
.title(app.package_info().name.clone());
|
||||
}
|
||||
|
||||
window_builder.build().expect("Failed to build window")
|
||||
|
||||
4
src-tauri/src/inject/style.js
vendored
4
src-tauri/src/inject/style.js
vendored
@@ -342,6 +342,10 @@ window.addEventListener('DOMContentLoaded', _event => {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
#__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.flex-shrink-0.overflow-x-hidden.bg-token-sidebar-surface-primary > div > div > div > div > nav, #__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.relative.flex.h-full.max-w-full.flex-1.flex-col.overflow-hidden > main {
|
||||
padding-top: 6px;
|
||||
}
|
||||
|
||||
#__next > div.AnnouncementWrapper_container__Z51yh > div > aside.SidebarLayout_sidebar__SXeDJ.SidebarLayout_left__k163a > div > div > header{
|
||||
padding-left: 84px;
|
||||
padding-top: 10px;
|
||||
|
||||
@@ -12,6 +12,9 @@ use tauri_plugin_window_state::Builder as windowStatePlugin;
|
||||
use util::{get_data_dir, get_pake_config};
|
||||
use window::get_window;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
use std::time::Duration;
|
||||
|
||||
pub fn run_app() {
|
||||
let (pake_config, tauri_config) = get_pake_config();
|
||||
|
||||
@@ -39,7 +42,7 @@ pub fn run_app() {
|
||||
_window.show().unwrap();
|
||||
|
||||
if show_system_tray {
|
||||
let _ = set_system_tray(&app.app_handle(), &pake_config);
|
||||
let _ = set_system_tray(&app.app_handle());
|
||||
} else {
|
||||
app.app_handle().remove_tray_by_id("pake-tray");
|
||||
}
|
||||
@@ -74,14 +77,24 @@ pub fn run_app() {
|
||||
})
|
||||
.on_window_event(|window, event| {
|
||||
if let tauri::WindowEvent::CloseRequested { api, .. } = event {
|
||||
let window = window.clone();
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
window.minimize().unwrap();
|
||||
window.hide().unwrap();
|
||||
let window_handle = window.clone();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
if window_handle.is_fullscreen().unwrap_or(false) {
|
||||
window_handle.set_fullscreen(false).unwrap();
|
||||
// Give a small delay to ensure the full-screen exit operation is completed.
|
||||
tokio::time::sleep(Duration::from_millis(900)).await;
|
||||
}
|
||||
window_handle.minimize().unwrap();
|
||||
window_handle.hide().unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
event.window().close().unwrap();
|
||||
window.close().unwrap();
|
||||
|
||||
api.prevent_close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user