Merge pull request #94 from tw93/refactor/codebase-improve
This commit is contained in:
3
.ecrc.json
Normal file
3
.ecrc.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"Exclude": ["Cargo\\.lock$"]
|
||||||
|
}
|
||||||
24
.editorconfig
Normal file
24
.editorconfig
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# http://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
# Use 4 spaces for Python, Rust and Bash files
|
||||||
|
[*.{py,rs,sh,md}]
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
# Makefiles always use tabs for indentation
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[*.bat]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
4
.github/FUNDING.yml
vendored
4
.github/FUNDING.yml
vendored
@@ -1,2 +1,2 @@
|
|||||||
github: ['tw93']
|
github: ["tw93"]
|
||||||
custom: ['https://miaoyan.app/cats.html?name=Pake']
|
custom: ["https://miaoyan.app/cats.html?name=Pake"]
|
||||||
|
|||||||
14
.github/ISSUE_TEMPLATE/bug.md
vendored
14
.github/ISSUE_TEMPLATE/bug.md
vendored
@@ -1,11 +1,13 @@
|
|||||||
---
|
---
|
||||||
name: Bug
|
name: Bug
|
||||||
about: 讨论建议咨询请去讨论区 / Please go to discussion for suggestions.
|
about: 讨论建议咨询请去讨论区 / Please go to discussion for suggestions.
|
||||||
title: ''
|
title: ""
|
||||||
labels: ''
|
labels: ""
|
||||||
assignees: ''
|
assignees: ""
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
🙊辛苦提 bug 前,去找一下 [历史的](https://github.com/tw93/Pake/issues?q=) 是否有提。辛苦提供系统版本、录屏或者截图、复现路径,期待解决的点这几个说明帮助我更好的解决问题,此外假如是讨论建议辛苦去 <a href=https://github.com/tw93/Pake/discussions>Discussions</a> 看看。提交前请删除这些文字。<br>
|
<!--
|
||||||
🙊Look for [issue](https://github.com/tw93/Pake/issues?q=) before you mention bugs Whether it is mentioned. Need to provide the version number, screen capture or screenshot, reproduction path, and look forward to the points to be solved. These instructions help me better solve the problem. Please delete these words before submitting.
|
🙊 辛苦提 bug 前,去找一下 [历史](https://github.com/tw93/Pake/issues?q=) 是否有提。辛苦提供系统版本、录屏或者截图、复现路径,期待解决的点——这几个说明能帮助我更好的解决问题,此外假如是讨论,建议辛苦去 [Discussions](https://github.com/tw93/Pake/discussions) 看看。
|
||||||
|
|
||||||
|
🙊 Check out [Issues](https://github.com/tw93/Pake/issues?q=) before reporting. Please provide your system version, screencasts, screenshots, way to reproduce, and the expected result – helpful for me to understand and fix up this issue! Besides, for suggestions or something else, head to [Pake's Discussions Platform](https://github.com/tw93/Pake/discussions).
|
||||||
|
-->
|
||||||
|
|||||||
23
.github/workflows/editorconfig-check.yml
vendored
Normal file
23
.github/workflows/editorconfig-check.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
name: Check if the codebase matches the EditorConfig rules
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
editorconfig-check:
|
||||||
|
name: Run EditorConfig Check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: editorconfig-checker/action-editorconfig-checker@main
|
||||||
|
- run: editorconfig-checker -config .ecrc.json
|
||||||
28
.github/workflows/main.yml
vendored
28
.github/workflows/main.yml
vendored
@@ -1,17 +1,17 @@
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
contrib-readme-job:
|
contrib-readme-job:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: A job to automate contrib in readme
|
name: A job to automate contrib in readme
|
||||||
steps:
|
steps:
|
||||||
- name: Contribute List
|
- name: Contribute List
|
||||||
uses: akhilmhdh/contributors-readme-action@v2.3.6
|
uses: akhilmhdh/contributors-readme-action@v2.3.6
|
||||||
with:
|
with:
|
||||||
image_size: 90
|
image_size: 90
|
||||||
columns_per_row: 7
|
columns_per_row: 7
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
||||||
|
|||||||
89
.github/workflows/rust-code-quality-check.yml
vendored
Normal file
89
.github/workflows/rust-code-quality-check.yml
vendored
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
name: Check, test and format the Rust part of codebase
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
actions: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
working-directory: src-tauri
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cargo-test:
|
||||||
|
name: Test codebase on ${{ matrix.os }} (cargo test)
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- windows-latest
|
||||||
|
- ubuntu-latest
|
||||||
|
- macos-latest
|
||||||
|
fail-fast: false
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
- uses: rui314/setup-mold@v1
|
||||||
|
- uses: taiki-e/install-action@v1
|
||||||
|
with:
|
||||||
|
tool: cargo-hack,nextest
|
||||||
|
- name: Install dependencies for Ubuntu
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
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
|
||||||
|
version: 1.0
|
||||||
|
- name: Run unit & integration tests with nextest
|
||||||
|
run: cargo hack --feature-powerset nextest run
|
||||||
|
# - name: Run documentation tests with cargo test
|
||||||
|
# run: cargo hack --feature-powerset test --doc
|
||||||
|
|
||||||
|
cargo-clippy:
|
||||||
|
name: Check codebase quality (cargo clippy)
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- windows-latest
|
||||||
|
- ubuntu-latest
|
||||||
|
- macos-latest
|
||||||
|
fail-fast: false
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
components: clippy
|
||||||
|
- uses: taiki-e/install-action@cargo-hack
|
||||||
|
- name: Install dependencies for Ubuntu
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
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
|
||||||
|
version: 1.0
|
||||||
|
- name: Run all-features code quality checks
|
||||||
|
run: cargo hack --feature-powerset --no-dev-deps clippy
|
||||||
|
- name: Run normal code quality check
|
||||||
|
run: cargo clippy
|
||||||
|
|
||||||
|
cargo-fmt:
|
||||||
|
name: Enforce codebase style (cargo fmt)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
components: rustfmt
|
||||||
|
- run: cargo fmt --all -- --color=always --check
|
||||||
4
.prettierignore
Normal file
4
.prettierignore
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
target
|
||||||
|
node_modules
|
||||||
|
dist/**/*
|
||||||
|
!dist/twitter.css
|
||||||
@@ -17,24 +17,24 @@ diverse, inclusive, and healthy community.
|
|||||||
Examples of behavior that contributes to a positive environment for our
|
Examples of behavior that contributes to a positive environment for our
|
||||||
community include:
|
community include:
|
||||||
|
|
||||||
* Demonstrating empathy and kindness toward other people
|
- Demonstrating empathy and kindness toward other people
|
||||||
* Being respectful of differing opinions, viewpoints, and experiences
|
- Being respectful of differing opinions, viewpoints, and experiences
|
||||||
* Giving and gracefully accepting constructive feedback
|
- Giving and gracefully accepting constructive feedback
|
||||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
- Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
and learning from the experience
|
and learning from the experience
|
||||||
* Focusing on what is best not just for us as individuals, but for the
|
- Focusing on what is best not just for us as individuals, but for the
|
||||||
overall community
|
overall community
|
||||||
|
|
||||||
Examples of unacceptable behavior include:
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
* The use of sexualized language or imagery, and sexual attention or
|
- The use of sexualized language or imagery, and sexual attention or
|
||||||
advances of any kind
|
advances of any kind
|
||||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
* Public or private harassment
|
- Public or private harassment
|
||||||
* Publishing others' private information, such as a physical or email
|
- Publishing others' private information, such as a physical or email
|
||||||
address, without their explicit permission
|
address, without their explicit permission
|
||||||
* Other conduct which could reasonably be considered inappropriate in a
|
- Other conduct which could reasonably be considered inappropriate in a
|
||||||
professional setting
|
professional setting
|
||||||
|
|
||||||
## Enforcement Responsibilities
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
|
|||||||
### 4. Permanent Ban
|
### 4. Permanent Ban
|
||||||
|
|
||||||
**Community Impact**: Demonstrating a pattern of violation of community
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
standards, including sustained inappropriate behavior, harassment of an
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
individual, or aggression toward or disparagement of classes of individuals.
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
**Consequence**: A permanent ban from any sort of public interaction within
|
**Consequence**: A permanent ban from any sort of public interaction within
|
||||||
|
|||||||
@@ -4,18 +4,18 @@
|
|||||||
|
|
||||||
## Branch Management
|
## Branch Management
|
||||||
|
|
||||||
```txt
|
```mermaid
|
||||||
master
|
graph LR
|
||||||
↑
|
b_dev(dev) --> b_master(master);
|
||||||
dev <--- Develop/PR
|
contributions([Develop / Pull requests]) -.-> b_dev;
|
||||||
```
|
```
|
||||||
|
|
||||||
- `dev` branch
|
- `dev` branch
|
||||||
- `dev` is the developing branch.
|
- `dev` is the developing branch.
|
||||||
- It's **RECOMMENDED** to commit feature PR to `dev`.
|
- It's **RECOMMENDED** to commit feature PR to `dev`.
|
||||||
- `master` branch
|
- `master` branch
|
||||||
- `master` is the release branch, we will make tag and publish version on this branch.
|
- `master` is the release branch, we will make tag and publish version on this branch.
|
||||||
- If it is a document modification, it can be submitted to this branch.
|
- If it is a document modification, it can be submitted to this branch.
|
||||||
|
|
||||||
## Commit Log
|
## Commit Log
|
||||||
|
|
||||||
|
|||||||
56
README.md
56
README.md
@@ -1,20 +1,20 @@
|
|||||||
<p align="left"><strong>中文</strong> | <a href="https://github.com/tw93/Pake/blob/master/README_EN.md">English</a></p>
|
<p align="left"><strong>中文</strong> | <a href="https://github.com/tw93/Pake/blob/master/README_EN.md">English</a></p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src=https://gw.alipayobjects.com/zos/k/fa/logo-modified.png width=138/>
|
<img src=https://gw.alipayobjects.com/zos/k/fa/logo-modified.png width=138/>
|
||||||
<h1 align="center">Pake</h1>
|
<h1 align="center">Pake</h1>
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<a href="https://twitter.com/HiTw93" target="_blank">
|
<a href="https://twitter.com/HiTw93" target="_blank">
|
||||||
<img alt="twitter" src="https://img.shields.io/twitter/follow/Hitw93?color=%231D9BF0&label=Pake%20%F0%9F%93%A2%20&logo=Twitter&style=flat-square"></a>
|
<img alt="twitter" src="https://img.shields.io/twitter/follow/Hitw93?color=%231D9BF0&label=Pake%20%F0%9F%93%A2%20&logo=Twitter&style=flat-square"></a>
|
||||||
<a href="https://t.me/miaoyan" target="_blank">
|
<a href="https://t.me/miaoyan" target="_blank">
|
||||||
<img alt="telegram" src="https://img.shields.io/badge/chat-telegram-blueviolet?style=flat-square&logo=Telegram"></a>
|
<img alt="telegram" src="https://img.shields.io/badge/chat-telegram-blueviolet?style=flat-square&logo=Telegram"></a>
|
||||||
<a href="https://github.com/tw93/Pake/releases" target="_blank">
|
<a href="https://github.com/tw93/Pake/releases" target="_blank">
|
||||||
<img alt="GitHub downloads" src="https://img.shields.io/github/downloads/tw93/Pake/total.svg?style=flat-square"></a>
|
<img alt="GitHub downloads" src="https://img.shields.io/github/downloads/tw93/Pake/total.svg?style=flat-square"></a>
|
||||||
<a href="https://github.com/tw93/Pake/commits" target="_blank">
|
<a href="https://github.com/tw93/Pake/commits" target="_blank">
|
||||||
<img alt="GitHub commit" src="https://img.shields.io/github/commit-activity/m/tw93/Pake?style=flat-square"></a>
|
<img alt="GitHub commit" src="https://img.shields.io/github/commit-activity/m/tw93/Pake?style=flat-square"></a>
|
||||||
<a href="https://github.com/tw93/Pake/issues?q=is%3Aissue+is%3Aclosed" target="_blank">
|
<a href="https://github.com/tw93/Pake/issues?q=is%3Aissue+is%3Aclosed" target="_blank">
|
||||||
<img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed/tw93/Pake.svg?style=flat-square"></a>
|
<img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed/tw93/Pake.svg?style=flat-square"></a>
|
||||||
</div>
|
</div>
|
||||||
<div align="left">很简单用 Rust 打包网页生成很小的桌面 App,支持 Mac/Windows/Linux 应用,当前已打包微信读书、Twitter、Youtube、Flomo、Reference、RunCode、Google Translate、语雀、Witeboard、Vercel、V2EX、开发工具箱等,欢迎去 <a href=https://github.com/tw93/Pake/discussions>讨论区</a> 交流分享。</div>
|
<div align="left">很简单用 Rust 打包网页生成很小的桌面 App,支持 Mac/Windows/Linux 应用,当前已打包微信读书、Twitter、Youtube、Flomo、Reference、RunCode、Google Translate、语雀、Witeboard、Vercel、V2EX、开发工具箱等,欢迎去 <a href=https://github.com/tw93/Pake/discussions>讨论区</a> 交流分享。</div>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## 特征
|
## 特征
|
||||||
@@ -65,25 +65,25 @@
|
|||||||
|
|
||||||
## 快捷键
|
## 快捷键
|
||||||
|
|
||||||
|Mac|Windows/Linux|功能|
|
| Mac | Windows/Linux | 功能 |
|
||||||
| ---- | ----- | ---- |
|
| --------------------------- | ------------------------------ | ------------------ |
|
||||||
|<kbd>⌘</kbd> + <kbd>[</kbd>|<kbd>Ctrl</kbd> + <kbd>←</kbd>|返回上一个页面|
|
| <kbd>⌘</kbd> + <kbd>[</kbd> | <kbd>Ctrl</kbd> + <kbd>←</kbd> | 返回上一个页面 |
|
||||||
|<kbd>⌘</kbd> + <kbd>]</kbd>|<kbd>Ctrl</kbd> + <kbd>→</kbd>|去下一个页面|
|
| <kbd>⌘</kbd> + <kbd>]</kbd> | <kbd>Ctrl</kbd> + <kbd>→</kbd> | 去下一个页面 |
|
||||||
|<kbd>⌘</kbd> + <kbd>↑</kbd>|<kbd>Ctrl</kbd> + <kbd>↑</kbd>|自动滚动到页面顶部|
|
| <kbd>⌘</kbd> + <kbd>↑</kbd> | <kbd>Ctrl</kbd> + <kbd>↑</kbd> | 自动滚动到页面顶部 |
|
||||||
|<kbd>⌘</kbd> + <kbd>↓</kbd>|<kbd>Ctrl</kbd> + <kbd>↓</kbd>|自动滚动到页面底部|
|
| <kbd>⌘</kbd> + <kbd>↓</kbd> | <kbd>Ctrl</kbd> + <kbd>↓</kbd> | 自动滚动到页面底部 |
|
||||||
|<kbd>⌘</kbd> + <kbd>r</kbd>|<kbd>Ctrl</kbd> + <kbd>r</kbd>|刷新页面|
|
| <kbd>⌘</kbd> + <kbd>r</kbd> | <kbd>Ctrl</kbd> + <kbd>r</kbd> | 刷新页面 |
|
||||||
|<kbd>⌘</kbd> + <kbd>w</kbd>||隐藏窗口,非退出|
|
| <kbd>⌘</kbd> + <kbd>w</kbd> | | 隐藏窗口,非退出 |
|
||||||
|<kbd>⌘</kbd> + <kbd>-</kbd>|<kbd>Ctrl</kbd> + <kbd>-</kbd>|缩小页面|
|
| <kbd>⌘</kbd> + <kbd>-</kbd> | <kbd>Ctrl</kbd> + <kbd>-</kbd> | 缩小页面 |
|
||||||
|<kbd>⌘</kbd> + <kbd>w</kbd>|<kbd>Ctrl</kbd> + <kbd>+</kbd>|放大页面|
|
| <kbd>⌘</kbd> + <kbd>w</kbd> | <kbd>Ctrl</kbd> + <kbd>+</kbd> | 放大页面 |
|
||||||
|<kbd>⌘</kbd> + <kbd>=</kbd>|<kbd>Ctrl</kbd> + <kbd>=</kbd>|放大页面|
|
| <kbd>⌘</kbd> + <kbd>=</kbd> | <kbd>Ctrl</kbd> + <kbd>=</kbd> | 放大页面 |
|
||||||
|<kbd>⌘</kbd> + <kbd>0</kbd>|<kbd>Ctrl</kbd> + <kbd>0</kbd>|重置页面缩放|
|
| <kbd>⌘</kbd> + <kbd>0</kbd> | <kbd>Ctrl</kbd> + <kbd>0</kbd> | 重置页面缩放 |
|
||||||
|
|
||||||
此外还支持双击头部进行全屏切换,拖拽头部进行移动窗口,还有其他需求,欢迎提过来。
|
此外还支持双击头部进行全屏切换,拖拽头部进行移动窗口,还有其他需求,欢迎提过来。
|
||||||
|
|
||||||
## 注意点
|
## 注意点
|
||||||
|
|
||||||
- Windows 下不能安装到 C:\Program File,会直接闪退。建议安装到其他目录,比如 D:\Program Files。
|
- Windows 下不能安装到 C:\Program File,会直接闪退。建议安装到其他目录,比如 D:\Program Files。
|
||||||
- Linux 下暂时不能存 cookie,即应用关闭后数据清空,账号自动推出。
|
- Linux 下暂时不能存 cookie,即应用关闭后数据清空,账号自动推出。
|
||||||
|
|
||||||
## 开发
|
## 开发
|
||||||
|
|
||||||
@@ -221,9 +221,9 @@ chmod +x ./script/build.sh && ./script/build.sh
|
|||||||
|
|
||||||
## 支持
|
## 支持
|
||||||
|
|
||||||
- 我有两只猫,一只叫汤圆,一只叫可乐,假如觉得 Pake 让你生活更美好,可以给汤圆可乐 <a href="https://miaoyan.app/cats.html?name=Pake" target="_blank">喂罐头 🥩🍤</a>。
|
- 我有两只猫,一只叫汤圆,一只叫可乐,假如觉得 Pake 让你生活更美好,可以给汤圆可乐 <a href="https://miaoyan.app/cats.html?name=Pake" target="_blank">喂罐头 🥩🍤</a>。
|
||||||
- 如果你喜欢 Pake,可以在 Github Star,更欢迎 [推荐](https://twitter.com/intent/tweet?url=https://github.com/tw93/Pake&text=Pake%20%E4%B8%80%E4%B8%AA%E5%BE%88%E7%AE%80%E5%8D%95%E7%9A%84%E7%94%A8%20Rust%20%E6%89%93%E5%8C%85%E7%BD%91%E9%A1%B5%E7%94%9F%E6%88%90%20Mac%20App%20%E7%9A%84%E5%B7%A5%E5%85%B7%EF%BC%8C%E7%9B%B8%E6%AF%94%E4%BC%A0%E7%BB%9F%E7%9A%84%20Electron%20%E5%A5%97%E5%A3%B3%E6%89%93%E5%8C%85%EF%BC%8C%E5%A4%A7%E5%B0%8F%E8%A6%81%E5%B0%8F%E5%B0%86%E8%BF%91%2040%20%E5%80%8D%EF%BC%8C%E4%B8%80%E8%88%AC%202M%20%E5%B7%A6%E5%8F%B3%EF%BC%8C%E5%BA%95%E5%B1%82%E4%BD%BF%E7%94%A8Tauri%20%EF%BC%8C%E6%80%A7%E8%83%BD%E4%BD%93%E9%AA%8C%E8%BE%83%20JS%20%E6%A1%86%E6%9E%B6%E8%A6%81%E8%BD%BB%E5%BF%AB%E4%B8%8D%E5%B0%91%EF%BC%8C%E5%86%85%E5%AD%98%E5%B0%8F%E5%BE%88%E5%A4%9A%EF%BC%8C%E6%94%AF%E6%8C%81%E5%BE%AE%E4%BF%A1%E8%AF%BB%E4%B9%A6%E3%80%81Twitter%E3%80%81Youtube%E3%80%81RunCode%E3%80%81Flomo%E3%80%81%E8%AF%AD%E9%9B%80%E7%AD%89%EF%BC%8C%E5%8F%AF%E4%BB%A5%E5%BE%88%E6%96%B9%E4%BE%BF%E4%BA%8C%E6%AC%A1%E5%BC%80%E5%8F%91~) 给你志同道合的朋友使用。
|
- 如果你喜欢 Pake,可以在 Github Star,更欢迎 [推荐](https://twitter.com/intent/tweet?url=https://github.com/tw93/Pake&text=Pake%20%E4%B8%80%E4%B8%AA%E5%BE%88%E7%AE%80%E5%8D%95%E7%9A%84%E7%94%A8%20Rust%20%E6%89%93%E5%8C%85%E7%BD%91%E9%A1%B5%E7%94%9F%E6%88%90%20Mac%20App%20%E7%9A%84%E5%B7%A5%E5%85%B7%EF%BC%8C%E7%9B%B8%E6%AF%94%E4%BC%A0%E7%BB%9F%E7%9A%84%20Electron%20%E5%A5%97%E5%A3%B3%E6%89%93%E5%8C%85%EF%BC%8C%E5%A4%A7%E5%B0%8F%E8%A6%81%E5%B0%8F%E5%B0%86%E8%BF%91%2040%20%E5%80%8D%EF%BC%8C%E4%B8%80%E8%88%AC%202M%20%E5%B7%A6%E5%8F%B3%EF%BC%8C%E5%BA%95%E5%B1%82%E4%BD%BF%E7%94%A8Tauri%20%EF%BC%8C%E6%80%A7%E8%83%BD%E4%BD%93%E9%AA%8C%E8%BE%83%20JS%20%E6%A1%86%E6%9E%B6%E8%A6%81%E8%BD%BB%E5%BF%AB%E4%B8%8D%E5%B0%91%EF%BC%8C%E5%86%85%E5%AD%98%E5%B0%8F%E5%BE%88%E5%A4%9A%EF%BC%8C%E6%94%AF%E6%8C%81%E5%BE%AE%E4%BF%A1%E8%AF%BB%E4%B9%A6%E3%80%81Twitter%E3%80%81Youtube%E3%80%81RunCode%E3%80%81Flomo%E3%80%81%E8%AF%AD%E9%9B%80%E7%AD%89%EF%BC%8C%E5%8F%AF%E4%BB%A5%E5%BE%88%E6%96%B9%E4%BE%BF%E4%BA%8C%E6%AC%A1%E5%BC%80%E5%8F%91~) 给你志同道合的朋友使用。
|
||||||
- 可以关注我的 [Twitter](https://twitter.com/HiTw93) 获取到最新的 Pake 更新消息,也欢迎加入 [Telegram](https://t.me/miaoyan) 聊天群。
|
- 可以关注我的 [Twitter](https://twitter.com/HiTw93) 获取到最新的 Pake 更新消息,也欢迎加入 [Telegram](https://t.me/miaoyan) 聊天群。
|
||||||
|
|
||||||
## 最后
|
## 最后
|
||||||
|
|
||||||
|
|||||||
57
README_EN.md
57
README_EN.md
@@ -1,20 +1,20 @@
|
|||||||
<p align="left"><a href="https://github.com/tw93/Pake">中文</a> | <strong>English</strong></p>
|
<p align="left"><a href="https://github.com/tw93/Pake">中文</a> | <strong>English</strong></p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src=https://gw.alipayobjects.com/zos/k/fa/logo-modified.png width=138/>
|
<img src=https://gw.alipayobjects.com/zos/k/fa/logo-modified.png width=138/>
|
||||||
<h1 align="center">Pake</h1>
|
<h1 align="center">Pake</h1>
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<a href="https://twitter.com/HiTw93" target="_blank">
|
<a href="https://twitter.com/HiTw93" target="_blank">
|
||||||
<img alt="twitter" src="https://img.shields.io/twitter/follow/Hitw93?color=%231D9BF0&label=Pake%20%F0%9F%93%A2%20&logo=Twitter&style=flat-square"></a>
|
<img alt="twitter" src="https://img.shields.io/twitter/follow/Hitw93?color=%231D9BF0&label=Pake%20%F0%9F%93%A2%20&logo=Twitter&style=flat-square"></a>
|
||||||
<a href="https://t.me/miaoyan" target="_blank">
|
<a href="https://t.me/miaoyan" target="_blank">
|
||||||
<img alt="telegram" src="https://img.shields.io/badge/chat-telegram-blueviolet?style=flat-square&logo=Telegram"></a>
|
<img alt="telegram" src="https://img.shields.io/badge/chat-telegram-blueviolet?style=flat-square&logo=Telegram"></a>
|
||||||
<a href="https://github.com/tw93/Pake/releases" target="_blank">
|
<a href="https://github.com/tw93/Pake/releases" target="_blank">
|
||||||
<img alt="GitHub downloads" src="https://img.shields.io/github/downloads/tw93/Pake/total.svg?style=flat-square"></a>
|
<img alt="GitHub downloads" src="https://img.shields.io/github/downloads/tw93/Pake/total.svg?style=flat-square"></a>
|
||||||
<a href="https://github.com/tw93/Pake/commits" target="_blank">
|
<a href="https://github.com/tw93/Pake/commits" target="_blank">
|
||||||
<img alt="GitHub commit" src="https://img.shields.io/github/commit-activity/m/tw93/Pake?style=flat-square"></a>
|
<img alt="GitHub commit" src="https://img.shields.io/github/commit-activity/m/tw93/Pake?style=flat-square"></a>
|
||||||
<a href="https://github.com/tw93/Pake/issues?q=is%3Aissue+is%3Aclosed" target="_blank">
|
<a href="https://github.com/tw93/Pake/issues?q=is%3Aissue+is%3Aclosed" target="_blank">
|
||||||
<img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed/tw93/Pake.svg?style=flat-square"></a>
|
<img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed/tw93/Pake.svg?style=flat-square"></a>
|
||||||
</div>
|
</div>
|
||||||
<div align="left">A simple way to package a web page to desktop application, supporting Mac/Windows/Linux, now has packaging WeRead、Twitter、Youtube、Reference、Flomo、YuQue、Google Translate、Witeboard、RunCode、Vercel、V2EX、DevTools, welcome to <a href=https://github.com/tw93/Pake/discussions>Discussions</a> to see if there have anything you interesting.</div>
|
<div align="left">A simple way to package a web page to desktop application, supporting Mac/Windows/Linux, now has packaging WeRead、Twitter、Youtube、Reference、Flomo、YuQue、Google Translate、Witeboard、RunCode、Vercel、V2EX、DevTools, welcome to <a href=https://github.com/tw93/Pake/discussions>Discussions</a> to see if there have anything you interesting.</div>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
@@ -65,26 +65,25 @@ More common apps can be downloaded from [Releases](https://github.com/tw93/Pake/
|
|||||||
|
|
||||||
## Shortcuts
|
## Shortcuts
|
||||||
|
|
||||||
|Mac|Windows/Linux|Function|
|
| Mac | Windows/Linux | Function |
|
||||||
| ---- | ----- | ---- |
|
| --------------------------- | ------------------------------ | ----------------------------- |
|
||||||
|<kbd>⌘</kbd> + <kbd>[</kbd>|<kbd>Ctrl</kbd> + <kbd>←</kbd>|Return to the previous page|
|
| <kbd>⌘</kbd> + <kbd>[</kbd> | <kbd>Ctrl</kbd> + <kbd>←</kbd> | Return to the previous page |
|
||||||
|<kbd>⌘</kbd> + <kbd>]</kbd>|<kbd>Ctrl</kbd> + <kbd>→</kbd>|Go to the next page|
|
| <kbd>⌘</kbd> + <kbd>]</kbd> | <kbd>Ctrl</kbd> + <kbd>→</kbd> | Go to the next page |
|
||||||
|<kbd>⌘</kbd> + <kbd>↑</kbd>|<kbd>Ctrl</kbd> + <kbd>↑</kbd>|Auto scroll to top of page|
|
| <kbd>⌘</kbd> + <kbd>↑</kbd> | <kbd>Ctrl</kbd> + <kbd>↑</kbd> | Auto scroll to top of page |
|
||||||
|<kbd>⌘</kbd> + <kbd>↓</kbd>|<kbd>Ctrl</kbd> + <kbd>↓</kbd>|Auto scroll to bottom of page|
|
| <kbd>⌘</kbd> + <kbd>↓</kbd> | <kbd>Ctrl</kbd> + <kbd>↓</kbd> | Auto scroll to bottom of page |
|
||||||
|<kbd>⌘</kbd> + <kbd>r</kbd>|<kbd>Ctrl</kbd> + <kbd>r</kbd>|Refresh Page|
|
| <kbd>⌘</kbd> + <kbd>r</kbd> | <kbd>Ctrl</kbd> + <kbd>r</kbd> | Refresh Page |
|
||||||
|<kbd>⌘</kbd> + <kbd>w</kbd>||Hide window, not quite|
|
| <kbd>⌘</kbd> + <kbd>w</kbd> | | Hide window, not quite |
|
||||||
|<kbd>⌘</kbd> + <kbd>-</kbd>|<kbd>Ctrl</kbd> + <kbd>-</kbd>|Zoom out the page|
|
| <kbd>⌘</kbd> + <kbd>-</kbd> | <kbd>Ctrl</kbd> + <kbd>-</kbd> | Zoom out the page |
|
||||||
|<kbd>⌘</kbd> + <kbd>+</kbd>|<kbd>Ctrl</kbd> + <kbd>+</kbd>|Zoom in the page|
|
| <kbd>⌘</kbd> + <kbd>+</kbd> | <kbd>Ctrl</kbd> + <kbd>+</kbd> | Zoom in the page |
|
||||||
|<kbd>⌘</kbd> + <kbd>=</kbd>|<kbd>Ctrl</kbd> + <kbd>=</kbd>|Zoom in the Page|
|
| <kbd>⌘</kbd> + <kbd>=</kbd> | <kbd>Ctrl</kbd> + <kbd>=</kbd> | Zoom in the Page |
|
||||||
|<kbd>⌘</kbd> + <kbd>0</kbd>|<kbd>Ctrl</kbd> + <kbd>0</kbd>|Reset the page zoom|
|
| <kbd>⌘</kbd> + <kbd>0</kbd> | <kbd>Ctrl</kbd> + <kbd>0</kbd> | Reset the page zoom |
|
||||||
|
|
||||||
|
|
||||||
In addition, it supports double clicking the head to switch to full screen, and dragging the head to move the window
|
In addition, it supports double clicking the head to switch to full screen, and dragging the head to move the window
|
||||||
|
|
||||||
## Precautions
|
## Precautions
|
||||||
|
|
||||||
- It cannot be installed to C:\Program File under Windows, and it will crash directly. It is recommended to install to another directory, such as D:\Program Files.
|
- It cannot be installed to C:\Program File under Windows, and it will crash directly. It is recommended to install to another directory, such as D:\Program Files.
|
||||||
- Under Linux, cookies cannot be stored temporarily, that is, the data will be cleared after the application is closed, and the account will be automatically released.
|
- Under Linux, cookies cannot be stored temporarily, that is, the data will be cleared after the application is closed, and the account will be automatically released.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
@@ -139,9 +138,9 @@ Refer to the communication code in `pake.js` with `postMessage`, write the event
|
|||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
- I have two cats, one is called TangYuan, and one is called Coke, If you think Pake makes your life better, you can give my cats <a href="https://miaoyan.app/cats.html?name=Pake" target="_blank">feed canned food 🥩🍤</a>.
|
- I have two cats, one is called TangYuan, and one is called Coke, If you think Pake makes your life better, you can give my cats <a href="https://miaoyan.app/cats.html?name=Pake" target="_blank">feed canned food 🥩🍤</a>.
|
||||||
- If you like Pake, you can star it in Github. We are more welcome to [recommend Pake](https://twitter.com/intent/tweet?url=https://github.com/tw93/Pake&text=Pake%20-%20A%20simple%20Rust%20packaged%20web%20pages%20to%20generate%20Mac%20App%20tool,%20compared%20to%20traditional%20Electron%20package,%20the%20size%20of%20nearly%2040%20times%20smaller,%20generally%20about%202M,%20the%20underlying%20use%20of%20Tauri,%20performance%20experience%20than%20the%20JS%20framework%20is%20much%20lighter~) to your like-minded friends.
|
- If you like Pake, you can star it in Github. We are more welcome to [recommend Pake](https://twitter.com/intent/tweet?url=https://github.com/tw93/Pake&text=Pake%20-%20A%20simple%20Rust%20packaged%20web%20pages%20to%20generate%20Mac%20App%20tool,%20compared%20to%20traditional%20Electron%20package,%20the%20size%20of%20nearly%2040%20times%20smaller,%20generally%20about%202M,%20the%20underlying%20use%20of%20Tauri,%20performance%20experience%20than%20the%20JS%20framework%20is%20much%20lighter~) to your like-minded friends.
|
||||||
- You can follow my [Twitter](https://twitter.com/HiTw93) to get the latest news of Pake, or join [Telegram](https://t.me/miaoyan) chat group.
|
- You can follow my [Twitter](https://twitter.com/HiTw93) to get the latest news of Pake, or join [Telegram](https://t.me/miaoyan) chat group.
|
||||||
|
|
||||||
## Finally
|
## Finally
|
||||||
|
|
||||||
|
|||||||
74
dist/twitter.css
vendored
74
dist/twitter.css
vendored
@@ -1,22 +1,22 @@
|
|||||||
[data-testid='placementTracking'] article,
|
[data-testid="placementTracking"] article,
|
||||||
a[href*='quick_promote_web'],
|
a[href*="quick_promote_web"],
|
||||||
[data-testid='AppTabBar_Explore_Link'],
|
[data-testid="AppTabBar_Explore_Link"],
|
||||||
a[href*='/lists'][role='link'][aria-label],
|
a[href*="/lists"][role="link"][aria-label],
|
||||||
a[href='/i/bookmarks'] {
|
a[href="/i/bookmarks"] {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hide Messages Drawer */
|
/* Hide Messages Drawer */
|
||||||
[data-testid='DMDrawer'] {
|
[data-testid="DMDrawer"] {
|
||||||
visibility: hidden !important;
|
visibility: hidden !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-testid='primaryColumn'] > div > div {
|
[data-testid="primaryColumn"] > div > div {
|
||||||
position: relative !important;
|
position: relative !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hide sidebar */
|
/* Hide sidebar */
|
||||||
[data-testid='sidebarColumn'] {
|
[data-testid="sidebarColumn"] {
|
||||||
visibility: hidden !important;
|
visibility: hidden !important;
|
||||||
width: 0 !important;
|
width: 0 !important;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
@@ -29,76 +29,76 @@ a[href='/i/bookmarks'] {
|
|||||||
@media only screen and (min-width: 1000px) {
|
@media only screen and (min-width: 1000px) {
|
||||||
/* Center the Timeline */
|
/* Center the Timeline */
|
||||||
/* Prevent horizontal scroll */
|
/* Prevent horizontal scroll */
|
||||||
main[role='main'] {
|
main[role="main"] {
|
||||||
align-items: center !important;
|
align-items: center !important;
|
||||||
overflow-x: clip !important;
|
overflow-x: clip !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Match widths for feed */
|
/* Match widths for feed */
|
||||||
[data-testid='primaryColumn'] {
|
[data-testid="primaryColumn"] {
|
||||||
width: 700px !important;
|
width: 700px !important;
|
||||||
max-width: 700px !important;
|
max-width: 700px !important;
|
||||||
margin: 0 auto !important;
|
margin: 0 auto !important;
|
||||||
}
|
}
|
||||||
[data-testid='primaryColumn'] > div > div:last-child,
|
[data-testid="primaryColumn"] > div > div:last-child,
|
||||||
[data-testid='primaryColumn'] > div > div:last-child div {
|
[data-testid="primaryColumn"] > div > div:last-child div {
|
||||||
max-width: unset !important;
|
max-width: unset !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Nudge engagement row 81px right */
|
/* Nudge engagement row 81px right */
|
||||||
/* In default feed: 506px - 425px */
|
/* In default feed: 506px - 425px */
|
||||||
div[aria-label][role='group'][id^='id__'] {
|
div[aria-label][role="group"][id^="id__"] {
|
||||||
margin-right: 81px !important;
|
margin-right: 81px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fix navigation to left */
|
/* Fix navigation to left */
|
||||||
header[role='banner'] {
|
header[role="banner"] {
|
||||||
position: fixed !important;
|
position: fixed !important;
|
||||||
left: 0 !important;
|
left: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
header[role='banner'] > div > div > div {
|
header[role="banner"] > div > div > div {
|
||||||
justify-content: center !important;
|
justify-content: center !important;
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
form[role='search'] > div:nth-child(1) > div {
|
form[role="search"] > div:nth-child(1) > div {
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Align Twitter navigation icon with search */
|
/* Align Twitter navigation icon with search */
|
||||||
h1[role='heading'] {
|
h1[role="heading"] {
|
||||||
padding-top: 4px !important;
|
padding-top: 4px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Navigation buttons labels and Account button label on hover */
|
/* Navigation buttons labels and Account button label on hover */
|
||||||
header[role='banner']
|
header[role="banner"]
|
||||||
nav[role='navigation']
|
nav[role="navigation"]
|
||||||
*
|
*
|
||||||
div[dir='auto']:not([aria-label])
|
div[dir="auto"]:not([aria-label])
|
||||||
> span,
|
> span,
|
||||||
[data-testid='SideNav_AccountSwitcher_Button'] > div:not(:first-child) {
|
[data-testid="SideNav_AccountSwitcher_Button"] > div:not(:first-child) {
|
||||||
display: inline-block !important;
|
display: inline-block !important;
|
||||||
opacity: 0 !important;
|
opacity: 0 !important;
|
||||||
transition: 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
|
transition: 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
|
||||||
}
|
}
|
||||||
header[role='banner']
|
header[role="banner"]
|
||||||
nav[role='navigation']:hover
|
nav[role="navigation"]:hover
|
||||||
*
|
*
|
||||||
div[dir='auto']:not([aria-label])
|
div[dir="auto"]:not([aria-label])
|
||||||
> span,
|
> span,
|
||||||
[data-testid='SideNav_AccountSwitcher_Button']:hover > div:not(:first-child) {
|
[data-testid="SideNav_AccountSwitcher_Button"]:hover > div:not(:first-child) {
|
||||||
opacity: 1 !important;
|
opacity: 1 !important;
|
||||||
}
|
}
|
||||||
header[role='banner'] nav[role='navigation']:hover > * > div {
|
header[role="banner"] nav[role="navigation"]:hover > * > div {
|
||||||
backdrop-filter: blur(12px) !important;
|
backdrop-filter: blur(12px) !important;
|
||||||
}
|
}
|
||||||
header[role='banner'] nav[role='navigation'] > a {
|
header[role="banner"] nav[role="navigation"] > a {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
header[role='banner'] nav[role='navigation'] > a::before {
|
header[role="banner"] nav[role="navigation"] > a::before {
|
||||||
content: '';
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
right: -40px;
|
right: -40px;
|
||||||
@@ -106,13 +106,13 @@ a[href='/i/bookmarks'] {
|
|||||||
left: 0px;
|
left: 0px;
|
||||||
}
|
}
|
||||||
/* Align account button with floating tweet button */
|
/* Align account button with floating tweet button */
|
||||||
[data-testid='SideNav_AccountSwitcher_Button'] {
|
[data-testid="SideNav_AccountSwitcher_Button"] {
|
||||||
bottom: 18px !important;
|
bottom: 18px !important;
|
||||||
left: 1px !important;
|
left: 1px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Floating Tweet Button */
|
/* Floating Tweet Button */
|
||||||
[data-testid='SideNav_NewTweet_Button'] {
|
[data-testid="SideNav_NewTweet_Button"] {
|
||||||
position: fixed !important;
|
position: fixed !important;
|
||||||
right: 16px !important;
|
right: 16px !important;
|
||||||
bottom: 24px !important;
|
bottom: 24px !important;
|
||||||
@@ -129,7 +129,7 @@ a[href='/i/bookmarks'] {
|
|||||||
/* Reveal searchbar and search filters at desktop breakpoint */
|
/* Reveal searchbar and search filters at desktop breakpoint */
|
||||||
@media only screen and (min-width: 1265px) {
|
@media only screen and (min-width: 1265px) {
|
||||||
/* Reveal searchbar */
|
/* Reveal searchbar */
|
||||||
[data-testid='sidebarColumn'] form[role='search'] {
|
[data-testid="sidebarColumn"] form[role="search"] {
|
||||||
visibility: visible !important;
|
visibility: visible !important;
|
||||||
position: fixed !important;
|
position: fixed !important;
|
||||||
top: 12px !important;
|
top: 12px !important;
|
||||||
@@ -137,27 +137,27 @@ a[href='/i/bookmarks'] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Match size of input the placeholder content */
|
/* Match size of input the placeholder content */
|
||||||
[data-testid='sidebarColumn'] input[placeholder='Search Twitter'] {
|
[data-testid="sidebarColumn"] input[placeholder="Search Twitter"] {
|
||||||
width: 150px;
|
width: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Match size of focused search container to its dropdown */
|
/* Match size of focused search container to its dropdown */
|
||||||
/* Add blur filter to search container for overlap */
|
/* Add blur filter to search container for overlap */
|
||||||
[data-testid='sidebarColumn'] form[role='search']:focus-within {
|
[data-testid="sidebarColumn"] form[role="search"]:focus-within {
|
||||||
width: 374px !important;
|
width: 374px !important;
|
||||||
backdrop-filter: blur(12px) !important;
|
backdrop-filter: blur(12px) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Match size of focused search input to its dropdown */
|
/* Match size of focused search input to its dropdown */
|
||||||
[data-testid='sidebarColumn'] input[placeholder='Search Twitter']:focus {
|
[data-testid="sidebarColumn"] input[placeholder="Search Twitter"]:focus {
|
||||||
width: 328px !important;
|
width: 328px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset width and left positioning to align search dropdown */
|
/* Reset width and left positioning to align search dropdown */
|
||||||
div[style*='left: -12px'] {
|
div[style*="left: -12px"] {
|
||||||
left: unset !important;
|
left: unset !important;
|
||||||
}
|
}
|
||||||
div[style='left: -8px; width: 306px;'] {
|
div[style="left: -8px; width: 306px;"] {
|
||||||
left: unset !important;
|
left: unset !important;
|
||||||
width: 374px !important;
|
width: 374px !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ if not exist output\windows (
|
|||||||
mkdir output\windows
|
mkdir output\windows
|
||||||
)
|
)
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo =======================
|
echo =======================
|
||||||
echo "build for windows"
|
echo "build for windows"
|
||||||
echo =======================
|
echo =======================
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
:: total package number
|
:: total package number
|
||||||
set /A index=1
|
set /A index=1
|
||||||
|
|||||||
144
script/build.sh
144
script/build.sh
@@ -10,21 +10,22 @@ if [ ! -d "output" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||||
if [ ! -d "output/linux" ]; then
|
if [ ! -d "output/linux" ]; then
|
||||||
mkdir output/linux
|
mkdir output/linux
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||||
if [ ! -d "output/macos" ]; then
|
if [ ! -d "output/macos" ]; then
|
||||||
mkdir output/macos
|
mkdir output/macos
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
|
|
||||||
|
SHELL_FOLDER=$(cd "$(dirname "$0")" || exit 1; pwd)
|
||||||
# total app number, ignore first line
|
# total app number, ignore first line
|
||||||
export total=`sed -n '$=' app.csv`
|
total=$(sed -n '$=' app.csv)
|
||||||
total=$(($total-1))
|
export total=$((total-1))
|
||||||
export index=1
|
export index=1
|
||||||
|
|
||||||
old_name="weread"
|
old_name="weread"
|
||||||
@@ -34,89 +35,88 @@ old_url="https://weread.qq.com/"
|
|||||||
package_prefix="com-tw93"
|
package_prefix="com-tw93"
|
||||||
|
|
||||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||||
echo "==============="
|
echo "==============="
|
||||||
echo "Build for Linux"
|
echo "Build for Linux"
|
||||||
echo "==============="
|
echo "==============="
|
||||||
export sd=${SHELL_FOLDER}/sd-linux-x64
|
export sd=${SHELL_FOLDER}/sd-linux-x64
|
||||||
chmod +x $sd
|
chmod +x "$sd"
|
||||||
# for linux, package name may be com.xxx.xxx
|
# for linux, package name may be com.xxx.xxx
|
||||||
echo "rename package name"
|
echo "rename package name"
|
||||||
export desktop_file="src-tauri/assets/${package_prefix}.weread.desktop"
|
export desktop_file="src-tauri/assets/${package_prefix}.weread.desktop"
|
||||||
# sed -i "s/\"productName\": \"weread\"/\"productName\": \"${package_prefix}-weread\"/g" src-tauri/tauri.conf.json
|
# sed -i "s/\"productName\": \"weread\"/\"productName\": \"${package_prefix}-weread\"/g" src-tauri/tauri.conf.json
|
||||||
$sd "\"productName\": \"weread\"" "\"productName\": \"${package_prefix}-weread\"" src-tauri/tauri.conf.json
|
$sd "\"productName\": \"weread\"" "\"productName\": \"${package_prefix}-weread\"" src-tauri/tauri.conf.json
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||||
echo "==============="
|
echo "==============="
|
||||||
echo "Build for MacOS"
|
echo "Build for MacOS"
|
||||||
echo "==============="
|
echo "==============="
|
||||||
|
|
||||||
export sd=${SHELL_FOLDER}/sd-apple-x64
|
export sd=${SHELL_FOLDER}/sd-apple-x64
|
||||||
chmod +x $sd
|
chmod +x "$sd"
|
||||||
echo "rename package name"
|
echo "rename package name"
|
||||||
$sd "\"productName\": \"weread\"" "\"productName\": \"WeRead\"" src-tauri/tauri.conf.json
|
$sd "\"productName\": \"weread\"" "\"productName\": \"WeRead\"" src-tauri/tauri.conf.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tail -n +2 app.csv | while IFS=, read -r -a arr;
|
tail -n +2 app.csv | while IFS=, read -r -a arr;
|
||||||
do
|
do
|
||||||
package_name=${arr[0]}
|
package_name=${arr[0]}
|
||||||
package_title=${arr[1]}
|
package_title=${arr[1]}
|
||||||
package_zh_name=${arr[2]}
|
package_zh_name=${arr[2]}
|
||||||
url=${arr[3]}
|
url=${arr[3]}
|
||||||
echo "update package name and url"
|
echo "update package name and url"
|
||||||
# replace package info
|
# replace package info
|
||||||
$sd ${old_url} ${url} src-tauri/tauri.conf.json
|
$sd "${old_url}" "${url}" src-tauri/tauri.conf.json
|
||||||
$sd ${old_name} ${package_name} src-tauri/tauri.conf.json
|
$sd "${old_name}" "${package_name}" src-tauri/tauri.conf.json
|
||||||
echo "update ico with 32x32 pictue"
|
echo "update ico with 32x32 pictue"
|
||||||
$sd ${old_name} ${package_name} src-tauri/src/main.rs
|
$sd "${old_name}" "${package_name}" src-tauri/src/main.rs
|
||||||
|
|
||||||
# for apple, need replace title
|
# for apple, need replace title
|
||||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||||
$sd ${old_title} ${package_title} src-tauri/tauri.conf.json
|
$sd "${old_title}" "${package_title}" src-tauri/tauri.conf.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# echo "update ico with 32x32 pictue"
|
# echo "update ico with 32x32 pictue"
|
||||||
# cp "src-tauri/png/${package_name}_32.ico" "src-tauri/icons/icon.ico"
|
# cp "src-tauri/png/${package_name}_32.ico" "src-tauri/icons/icon.ico"
|
||||||
|
|
||||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||||
echo "update desktop"
|
echo "update desktop"
|
||||||
old_desktop="src-tauri/assets/${package_prefix}-${old_name}.desktop"
|
old_desktop="src-tauri/assets/${package_prefix}-${old_name}.desktop"
|
||||||
new_desktop="src-tauri/assets/${package_prefix}-${package_name}.desktop"
|
new_desktop="src-tauri/assets/${package_prefix}-${package_name}.desktop"
|
||||||
mv ${old_desktop} ${new_desktop}
|
mv "${old_desktop}" "${new_desktop}"
|
||||||
$sd ${old_zh_name} ${package_zh_name} ${new_desktop}
|
$sd "${old_zh_name}" "${package_zh_name}" "${new_desktop}"
|
||||||
$sd ${old_name} ${package_name} ${new_desktop}
|
$sd "${old_name}" "${package_name}" "${new_desktop}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# update package info
|
# update package info
|
||||||
old_name=${package_name}
|
old_name=${package_name}
|
||||||
old_title=${package_title}
|
old_title=${package_title}
|
||||||
old_zh_name=${package_zh_name}
|
old_zh_name=${package_zh_name}
|
||||||
old_url=${url}
|
old_url=${url}
|
||||||
|
|
||||||
echo "building package ${index}/${total}"
|
echo "building package ${index}/${total}"
|
||||||
echo "package name is ${package_name} (${package_zh_name})"
|
echo "package name is ${package_name} (${package_zh_name})"
|
||||||
npm run tauri build
|
npm run tauri build
|
||||||
echo "package build success!"
|
echo "package build success!"
|
||||||
index=$(($index+1))
|
index=$((index+1))
|
||||||
|
|
||||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||||
mv src-tauri/target/release/bundle/deb/*.deb output/linux
|
mv src-tauri/target/release/bundle/deb/*.deb output/linux
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||||
mv src-tauri/target/release/bundle/dmg/*.dmg output/macos
|
mv src-tauri/target/release/bundle/dmg/*.dmg output/macos
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "build all package success!"
|
echo "build all package success!"
|
||||||
if [[ "$OSTYPE" =~ ^linux ]]; then
|
if [[ "$OSTYPE" =~ ^linux ]]; then
|
||||||
echo "result file in output/linux"
|
echo "result file in output/linux"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||||
# replace again
|
# replace again
|
||||||
$sd "\"productName\": \"WeRead\"" "\"productName\": \"weread\"" src-tauri/tauri.conf.json
|
$sd "\"productName\": \"WeRead\"" "\"productName\": \"weread\"" src-tauri/tauri.conf.json
|
||||||
echo "result file in output/macos"
|
echo "result file in output/macos"
|
||||||
fi
|
fi
|
||||||
4
src-tauri/Cargo.lock
generated
4
src-tauri/Cargo.lock
generated
@@ -2504,9 +2504,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.87"
|
version = "1.0.88"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
|
checksum = "8e8b3801309262e8184d9687fb697586833e939767aea0dda89f5a8e650e8bd7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa 1.0.2",
|
"itoa 1.0.2",
|
||||||
"ryu",
|
"ryu",
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ tauri-build = { version = "1.2.0", features = [] }
|
|||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde_json = "1.0.86"
|
serde_json = "1.0.88"
|
||||||
serde = { version = "1.0.145", features = ["derive"] }
|
serde = { version = "1.0.147", features = ["derive"] }
|
||||||
tauri = { version = "1.2.0", features = ["api-all"] }
|
tauri = { version = "1.2.0", features = ["api-all"] }
|
||||||
image = "0.24.5"
|
image = "0.24.5"
|
||||||
tauri-utils = "1.2.0"
|
tauri-utils = "1.2.0"
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
tauri_build::build()
|
tauri_build::build()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use tauri_utils::config::{Config, WindowConfig};
|
|||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use wry::application::platform::macos::WindowBuilderExtMacOS;
|
use wry::application::platform::macos::WindowBuilderExtMacOS;
|
||||||
|
|
||||||
#[cfg(target_os="macos")]
|
#[cfg(target_os = "macos")]
|
||||||
use wry::{
|
use wry::{
|
||||||
application::{
|
application::{
|
||||||
accelerator::{Accelerator, SysMods},
|
accelerator::{Accelerator, SysMods},
|
||||||
@@ -18,33 +18,29 @@ use wry::{
|
|||||||
webview::WebViewBuilder,
|
webview::WebViewBuilder,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
#[cfg(target_os="windows")]
|
|
||||||
use wry::{
|
use wry::{
|
||||||
application::{
|
application::{
|
||||||
event::{Event, StartCause, WindowEvent},
|
event::{Event, StartCause, WindowEvent},
|
||||||
event_loop::{ControlFlow, EventLoop},
|
event_loop::{ControlFlow, EventLoop},
|
||||||
menu::{MenuType},
|
menu::MenuType,
|
||||||
window::{Fullscreen, Window, WindowBuilder, Icon},
|
window::{Fullscreen, Icon, Window, WindowBuilder},
|
||||||
},
|
},
|
||||||
webview::WebViewBuilder,
|
webview::WebViewBuilder,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
#[cfg(target_os="linux")]
|
|
||||||
use wry::{
|
use wry::{
|
||||||
application::{
|
application::{
|
||||||
event::{Event, StartCause, WindowEvent},
|
event::{Event, StartCause, WindowEvent},
|
||||||
event_loop::{ControlFlow, EventLoop},
|
event_loop::{ControlFlow, EventLoop},
|
||||||
menu::{MenuType},
|
menu::MenuType,
|
||||||
window::{Fullscreen, Window, WindowBuilder},
|
window::{Fullscreen, Window, WindowBuilder},
|
||||||
},
|
},
|
||||||
webview::WebViewBuilder,
|
webview::WebViewBuilder,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
fn main() -> wry::Result<()> {
|
fn main() -> wry::Result<()> {
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let mut menu_bar_menu = Menu::new();
|
let mut menu_bar_menu = Menu::new();
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
@@ -91,7 +87,7 @@ fn main() -> wry::Result<()> {
|
|||||||
resizable,
|
resizable,
|
||||||
fullscreen,
|
fullscreen,
|
||||||
..
|
..
|
||||||
} = get_windows_config().unwrap_or(WindowConfig::default());
|
} = get_windows_config().unwrap_or_default();
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let WindowConfig {
|
let WindowConfig {
|
||||||
url,
|
url,
|
||||||
@@ -100,7 +96,7 @@ fn main() -> wry::Result<()> {
|
|||||||
resizable,
|
resizable,
|
||||||
fullscreen,
|
fullscreen,
|
||||||
..
|
..
|
||||||
} = get_windows_config().unwrap_or(WindowConfig::default());
|
} = get_windows_config().unwrap_or_default();
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let WindowConfig {
|
let WindowConfig {
|
||||||
url,
|
url,
|
||||||
@@ -110,7 +106,7 @@ fn main() -> wry::Result<()> {
|
|||||||
transparent,
|
transparent,
|
||||||
fullscreen,
|
fullscreen,
|
||||||
..
|
..
|
||||||
} = get_windows_config().unwrap_or(WindowConfig::default());
|
} = get_windows_config().unwrap_or_default();
|
||||||
let event_loop = EventLoop::new();
|
let event_loop = EventLoop::new();
|
||||||
|
|
||||||
let common_window = WindowBuilder::new()
|
let common_window = WindowBuilder::new()
|
||||||
@@ -126,7 +122,6 @@ fn main() -> wry::Result<()> {
|
|||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let icon = load_icon(std::path::Path::new(icon_path));
|
let icon = load_icon(std::path::Path::new(icon_path));
|
||||||
|
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let window = common_window
|
let window = common_window
|
||||||
.with_decorations(true)
|
.with_decorations(true)
|
||||||
@@ -136,10 +131,7 @@ fn main() -> wry::Result<()> {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
let window = common_window
|
let window = common_window.with_title("").build(&event_loop).unwrap();
|
||||||
.with_title("")
|
|
||||||
.build(&event_loop)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let window = common_window
|
let window = common_window
|
||||||
@@ -160,9 +152,9 @@ fn main() -> wry::Result<()> {
|
|||||||
} else {
|
} else {
|
||||||
window.set_fullscreen(Some(Fullscreen::Borderless(None)));
|
window.set_fullscreen(Some(Fullscreen::Borderless(None)));
|
||||||
}
|
}
|
||||||
} else if req.starts_with("open_browser"){
|
} else if req.starts_with("open_browser") {
|
||||||
let href = req.replace("open_browser:", "");
|
let href = req.replace("open_browser:", "");
|
||||||
webbrowser::open(&href).expect("no browser");
|
webbrowser::open(&href).expect("no browser");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -174,8 +166,8 @@ fn main() -> wry::Result<()> {
|
|||||||
.with_back_forward_navigation_gestures(true)
|
.with_back_forward_navigation_gestures(true)
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
|
#[cfg(feature = "devtools")]
|
||||||
#[cfg(feature = "devtools")] {
|
{
|
||||||
webview.open_devtools();
|
webview.open_devtools();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,19 +201,19 @@ fn get_windows_config() -> Option<WindowConfig> {
|
|||||||
let config_file = include_str!("../tauri.conf.json");
|
let config_file = include_str!("../tauri.conf.json");
|
||||||
let config: Config = serde_json::from_str(config_file).expect("failed to parse windows config");
|
let config: Config = serde_json::from_str(config_file).expect("failed to parse windows config");
|
||||||
|
|
||||||
config.tauri.windows.iter().next().cloned()
|
config.tauri.windows.first().cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
fn load_icon(path: &std::path::Path) -> Icon {
|
fn load_icon(path: &std::path::Path) -> Icon {
|
||||||
let (icon_rgba, icon_width, icon_height) = {
|
let (icon_rgba, icon_width, icon_height) = {
|
||||||
// alternatively, you can embed the icon in the binary through `include_bytes!` macro and use `image::load_from_memory`
|
// alternatively, you can embed the icon in the binary through `include_bytes!` macro and use `image::load_from_memory`
|
||||||
let image = image::open(path)
|
let image = image::open(path)
|
||||||
.expect("Failed to open icon path")
|
.expect("Failed to open icon path")
|
||||||
.into_rgba8();
|
.into_rgba8();
|
||||||
let (width, height) = image.dimensions();
|
let (width, height) = image.dimensions();
|
||||||
let rgba = image.into_raw();
|
let rgba = image.into_raw();
|
||||||
(rgba, width, height)
|
(rgba, width, height)
|
||||||
};
|
};
|
||||||
Icon::from_rgba(icon_rgba, icon_width, icon_height).expect("Failed to open icon")
|
Icon::from_rgba(icon_rgba, icon_width, icon_height).expect("Failed to open icon")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,33 +7,32 @@
|
|||||||
* @type {Record<KeyboardKey, OnKeyDown>}
|
* @type {Record<KeyboardKey, OnKeyDown>}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const metaKeyShortcuts = {
|
const metaKeyShortcuts = {
|
||||||
'ArrowUp': () => scrollTo(0, 0),
|
ArrowUp: () => scrollTo(0, 0),
|
||||||
'ArrowDown': () => scrollTo(0, document.body.scrollHeight),
|
ArrowDown: () => scrollTo(0, document.body.scrollHeight),
|
||||||
'[': () => window.history.back(),
|
"[": () => window.history.back(),
|
||||||
']': () => window.history.forward(),
|
"]": () => window.history.forward(),
|
||||||
'r': () => window.location.reload(),
|
r: () => window.location.reload(),
|
||||||
'-': () => zoomOut(),
|
"-": () => zoomOut(),
|
||||||
'=': () => zoomIn(),
|
"=": () => zoomIn(),
|
||||||
'+': () => zoomIn(),
|
"+": () => zoomIn(),
|
||||||
'0': () => zoomCommon(() => '100%'),
|
0: () => zoomCommon(() => "100%"),
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
const ctrlKeyShortcuts = {
|
const ctrlKeyShortcuts = {
|
||||||
'ArrowUp': () => scrollTo(0, 0),
|
ArrowUp: () => scrollTo(0, 0),
|
||||||
'ArrowDown': () => scrollTo(0, document.body.scrollHeight),
|
ArrowDown: () => scrollTo(0, document.body.scrollHeight),
|
||||||
'ArrowLeft': () => window.history.back(),
|
ArrowLeft: () => window.history.back(),
|
||||||
'ArrowRight': () => window.history.forward(),
|
ArrowRight: () => window.history.forward(),
|
||||||
'r': () => window.location.reload(),
|
r: () => window.location.reload(),
|
||||||
'-': () => zoomOut(),
|
"-": () => zoomOut(),
|
||||||
'=': () => zoomIn(),
|
"=": () => zoomIn(),
|
||||||
'+': () => zoomIn(),
|
"+": () => zoomIn(),
|
||||||
'0': () => zoomCommon(() => '100%'),
|
0: () => zoomCommon(() => "100%"),
|
||||||
}
|
};
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', (_event) => {
|
window.addEventListener("DOMContentLoaded", (_event) => {
|
||||||
const style = document.createElement('style');
|
const style = document.createElement("style");
|
||||||
style.innerHTML = `
|
style.innerHTML = `
|
||||||
#page #footer-wrapper,
|
#page #footer-wrapper,
|
||||||
.drawing-board .toolbar .toolbar-action,
|
.drawing-board .toolbar .toolbar-action,
|
||||||
@@ -110,27 +109,27 @@ window.addEventListener('DOMContentLoaded', (_event) => {
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
document.head.append(style);
|
document.head.append(style);
|
||||||
const topDom = document.createElement('div');
|
const topDom = document.createElement("div");
|
||||||
topDom.id = 'pack-top-dom';
|
topDom.id = "pack-top-dom";
|
||||||
document.body.appendChild(topDom);
|
document.body.appendChild(topDom);
|
||||||
|
|
||||||
const domEl = document.getElementById('pack-top-dom');
|
const domEl = document.getElementById("pack-top-dom");
|
||||||
|
|
||||||
domEl.addEventListener('mousedown', (e) => {
|
domEl.addEventListener("mousedown", (e) => {
|
||||||
if (e.buttons === 1 && e.detail !== 2) {
|
if (e.buttons === 1 && e.detail !== 2) {
|
||||||
window.ipc.postMessage('drag_window');
|
window.ipc.postMessage("drag_window");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
domEl.addEventListener('touchstart', () => {
|
domEl.addEventListener("touchstart", () => {
|
||||||
window.ipc.postMessage('drag_window');
|
window.ipc.postMessage("drag_window");
|
||||||
});
|
});
|
||||||
|
|
||||||
domEl.addEventListener('dblclick', () => {
|
domEl.addEventListener("dblclick", () => {
|
||||||
window.ipc.postMessage('fullscreen');
|
window.ipc.postMessage("fullscreen");
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('keyup', function (event) {
|
document.addEventListener("keyup", function (event) {
|
||||||
const preventDefault = (f) => {
|
const preventDefault = (f) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
f();
|
f();
|
||||||
@@ -147,14 +146,17 @@ window.addEventListener('DOMContentLoaded', (_event) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('click', (e) => {
|
document.addEventListener("click", (e) => {
|
||||||
const origin = e.target.closest('a');
|
const origin = e.target.closest("a");
|
||||||
if (origin && origin.href) {
|
if (origin && origin.href) {
|
||||||
origin.target = '_self';
|
origin.target = "_self";
|
||||||
|
|
||||||
//额外处理下 twitter 的外跳,对于其他需要外跳的可以改这里成对应域名
|
//额外处理下 twitter 的外跳,对于其他需要外跳的可以改这里成对应域名
|
||||||
const href = origin.href;
|
const href = origin.href;
|
||||||
if(location.host === "twitter.com" && href.indexOf("twitter.com")===-1){
|
if (
|
||||||
|
location.host === "twitter.com" &&
|
||||||
|
href.indexOf("twitter.com") === -1
|
||||||
|
) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
window.ipc.postMessage(`open_browser:${href}`);
|
window.ipc.postMessage(`open_browser:${href}`);
|
||||||
}
|
}
|
||||||
@@ -165,9 +167,9 @@ window.addEventListener('DOMContentLoaded', (_event) => {
|
|||||||
setDefaultZoom();
|
setDefaultZoom();
|
||||||
|
|
||||||
function setDefaultZoom() {
|
function setDefaultZoom() {
|
||||||
const htmlZoom = window.localStorage.getItem('htmlZoom');
|
const htmlZoom = window.localStorage.getItem("htmlZoom");
|
||||||
if (htmlZoom) {
|
if (htmlZoom) {
|
||||||
document.getElementsByTagName('html')[0].style.zoom = htmlZoom;
|
document.getElementsByTagName("html")[0].style.zoom = htmlZoom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,21 +177,17 @@ function setDefaultZoom() {
|
|||||||
* @param {(htmlZoom: string) => string} [zoomRule]
|
* @param {(htmlZoom: string) => string} [zoomRule]
|
||||||
*/
|
*/
|
||||||
function zoomCommon(zoomRule) {
|
function zoomCommon(zoomRule) {
|
||||||
const htmlZoom = window.localStorage.getItem('htmlZoom') || '100%';
|
const htmlZoom = window.localStorage.getItem("htmlZoom") || "100%";
|
||||||
const html = document.getElementsByTagName('html')[0];
|
const html = document.getElementsByTagName("html")[0];
|
||||||
const zoom = zoomRule(htmlZoom);
|
const zoom = zoomRule(htmlZoom);
|
||||||
html.style.zoom = zoom;
|
html.style.zoom = zoom;
|
||||||
window.localStorage.setItem('htmlZoom', zoom);
|
window.localStorage.setItem("htmlZoom", zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
function zoomIn() {
|
function zoomIn() {
|
||||||
zoomCommon((htmlZoom) =>
|
zoomCommon((htmlZoom) => `${Math.min(parseInt(htmlZoom) + 10, 200)}%`);
|
||||||
`${Math.min(parseInt(htmlZoom) + 10, 200)}%`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function zoomOut() {
|
function zoomOut() {
|
||||||
zoomCommon((htmlZoom) =>
|
zoomCommon((htmlZoom) => `${Math.max(parseInt(htmlZoom) - 10, 30)}%`);
|
||||||
`${Math.max(parseInt(htmlZoom) - 10, 30)}%`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
},
|
},
|
||||||
"resources": [],
|
"resources": [],
|
||||||
"shortDescription": "",
|
"shortDescription": "",
|
||||||
"targets": ["deb", "msi", "dmg"],
|
"targets": ["deb", "msi", "dmg"],
|
||||||
"windows": {
|
"windows": {
|
||||||
"certificateThumbprint": null,
|
"certificateThumbprint": null,
|
||||||
"digestAlgorithm": "sha256",
|
"digestAlgorithm": "sha256",
|
||||||
|
|||||||
Reference in New Issue
Block a user