From b66f0e4da7386382cc65c29ad4f13f46806c891a Mon Sep 17 00:00:00 2001 From: pan93412 Date: Sun, 20 Nov 2022 14:00:21 +0800 Subject: [PATCH] style: Run Prettier and fix up EditorConfig issues --- .github/FUNDING.yml | 4 +- .github/ISSUE_TEMPLATE/bug.md | 9 +-- .github/workflows/main.yml | 28 +++---- CODE_OF_CONDUCT.md | 32 ++++---- CONTRIBUTING.md | 12 +-- README.md | 62 +++++++-------- README_EN.md | 63 ++++++++------- dist/twitter.css | 74 +++++++++--------- script/build.bat | 20 ++--- script/build.sh | 140 +++++++++++++++++----------------- src-tauri/src/pake.js | 96 ++++++++++++----------- src-tauri/tauri.conf.json | 2 +- 12 files changed, 269 insertions(+), 273 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 959808e..e7dad43 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,2 @@ -github: ['tw93'] -custom: ['https://miaoyan.app/cats.html?name=Pake'] +github: ["tw93"] +custom: ["https://miaoyan.app/cats.html?name=Pake"] diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md index d1d0db0..f6ac4d2 100644 --- a/.github/ISSUE_TEMPLATE/bug.md +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -1,11 +1,10 @@ --- name: Bug about: 讨论建议咨询请去讨论区 / Please go to discussion for suggestions. -title: '' -labels: '' -assignees: '' - +title: "" +labels: "" +assignees: "" --- -🙊辛苦提 bug 前,去找一下 [历史的](https://github.com/tw93/Pake/issues?q=) 是否有提。辛苦提供系统版本、录屏或者截图、复现路径,期待解决的点这几个说明帮助我更好的解决问题,此外假如是讨论建议辛苦去 Discussions 看看。提交前请删除这些文字。
+🙊 辛苦提 bug 前,去找一下 [历史的](https://github.com/tw93/Pake/issues?q=) 是否有提。辛苦提供系统版本、录屏或者截图、复现路径,期待解决的点这几个说明帮助我更好的解决问题,此外假如是讨论建议辛苦去 Discussions 看看。提交前请删除这些文字。
🙊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. diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2dd6691..7693d6f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,17 +1,17 @@ on: - push: - branches: - - master + push: + branches: + - master jobs: - contrib-readme-job: - runs-on: ubuntu-latest - name: A job to automate contrib in readme - steps: - - name: Contribute List - uses: akhilmhdh/contributors-readme-action@v2.3.6 - with: - image_size: 90 - columns_per_row: 7 - env: - GITHUB_TOKEN: ${{ secrets.TOKEN }} + contrib-readme-job: + runs-on: ubuntu-latest + name: A job to automate contrib in readme + steps: + - name: Contribute List + uses: akhilmhdh/contributors-readme-action@v2.3.6 + with: + image_size: 90 + columns_per_row: 7 + env: + GITHUB_TOKEN: ${{ secrets.TOKEN }} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 629a446..7468d2e 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -17,24 +17,24 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -* Focusing on what is best not just for us as individuals, but for the - overall community +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the + overall community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or - advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email - address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting +- The use of sexualized language or imagery, and sexual attention or + advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email + address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting ## Enforcement Responsibilities @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **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. **Consequence**: A permanent ban from any sort of public interaction within diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index edd8441..6b6f610 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,12 +10,12 @@ master dev <--- Develop/PR ``` -- `dev` branch - - `dev` is the developing branch. - - It's **RECOMMENDED** to commit feature PR to `dev`. -- `master` 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. +- `dev` branch + - `dev` is the developing branch. + - It's **RECOMMENDED** to commit feature PR to `dev`. +- `master` 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. ## Commit Log diff --git a/README.md b/README.md index 851b328..99e1b74 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,27 @@

中文 | English

- -

Pake

-
+ +

Pake

+
- twitter + twitter - telegram - - GitHub downloads + telegram + + GitHub downloads - GitHub commit + GitHub commit - GitHub closed issues -
-
很简单用 Rust 打包网页生成很小的桌面 App,支持 Mac/Windows/Linux 应用,当前已打包微信读书、Twitter、Youtube、Flomo、Reference、RunCode、Google Translate、语雀、Witeboard、Vercel、V2EX、开发工具箱等,欢迎去 讨论区 交流分享。
+ GitHub closed issues +
+
很简单用 Rust 打包网页生成很小的桌面 App,支持 Mac/Windows/Linux 应用,当前已打包微信读书、Twitter、Youtube、Flomo、Reference、RunCode、Google Translate、语雀、Witeboard、Vercel、V2EX、开发工具箱等,欢迎去 讨论区 交流分享。

## 特征 -🏂 **小**:相比传统的 Electron 套壳打包,要小将近 40 倍,不到 3M -😂 **快**:Pake 的底层使用的 Rust Tauri 框架,性能体验较 JS 框架要轻快不少,内存小很多 -🩴 **特**:不是单纯打包,实现了快捷键的透传、沉浸式的窗口、拖动、样式改写、去广告、产品的极简风格定制 +🏂 **小**:相比传统的 Electron 套壳打包,要小将近 40 倍,不到 3M +😂 **快**:Pake 的底层使用的 Rust Tauri 框架,性能体验较 JS 框架要轻快不少,内存小很多 +🩴 **特**:不是单纯打包,实现了快捷键的透传、沉浸式的窗口、拖动、样式改写、去广告、产品的极简风格定制 🐶 **玩**:只是一个很简单的小玩具,用 Rust 替代之前套壳网页打包的老思路,其实 PWA 也很好 ## 下载 @@ -65,25 +65,25 @@ ## 快捷键 -|Mac|Windows/Linux|功能| -| ---- | ----- | ---- | -| + [|Ctrl + |返回上一个页面| -| + ]|Ctrl + |去下一个页面| -| + |Ctrl + |自动滚动到页面顶部| -| + |Ctrl + |自动滚动到页面底部| -| + r|Ctrl + r|刷新页面| -| + w||隐藏窗口,非退出| -| + -|Ctrl + -|缩小页面| -| + w|Ctrl + +|放大页面| -| + =|Ctrl + =|放大页面| -| + 0|Ctrl + 0|重置页面缩放| +| Mac | Windows/Linux | 功能 | +| --------------------------- | ------------------------------ | ------------------ | +| + [ | Ctrl + | 返回上一个页面 | +| + ] | Ctrl + | 去下一个页面 | +| + | Ctrl + | 自动滚动到页面顶部 | +| + | Ctrl + | 自动滚动到页面底部 | +| + r | Ctrl + r | 刷新页面 | +| + w | | 隐藏窗口,非退出 | +| + - | Ctrl + - | 缩小页面 | +| + w | Ctrl + + | 放大页面 | +| + = | Ctrl + = | 放大页面 | +| + 0 | Ctrl + 0 | 重置页面缩放 | 此外还支持双击头部进行全屏切换,拖拽头部进行移动窗口,还有其他需求,欢迎提过来。 ## 注意点 -- Windows 下不能安装到 C:\Program File,会直接闪退。建议安装到其他目录,比如 D:\Program Files。 -- Linux 下暂时不能存 cookie,即应用关闭后数据清空,账号自动推出。 +- Windows 下不能安装到 C:\Program File,会直接闪退。建议安装到其他目录,比如 D:\Program Files。 +- Linux 下暂时不能存 cookie,即应用关闭后数据清空,账号自动推出。 ## 开发 @@ -221,9 +221,9 @@ chmod +x ./script/build.sh && ./script/build.sh ## 支持 -- 我有两只猫,一只叫汤圆,一只叫可乐,假如觉得 Pake 让你生活更美好,可以给汤圆可乐 喂罐头 🥩🍤。 -- 如果你喜欢 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) 聊天群。 +- 我有两只猫,一只叫汤圆,一只叫可乐,假如觉得 Pake 让你生活更美好,可以给汤圆可乐 喂罐头 🥩🍤。 +- 如果你喜欢 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) 聊天群。 ## 最后 diff --git a/README_EN.md b/README_EN.md index b866e5c..c214402 100644 --- a/README_EN.md +++ b/README_EN.md @@ -1,27 +1,27 @@

中文 | English

- -

Pake

-
+ +

Pake

+
- twitter + twitter - telegram - - GitHub downloads + telegram + + GitHub downloads - GitHub commit + GitHub commit - GitHub closed issues -
-
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 Discussions to see if there have anything you interesting.
+ GitHub closed issues +
+
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 Discussions to see if there have anything you interesting.

## Features -🏂 **Small**:Nearly 40 times smaller than Electron package, less than 3M. -😂 **Fast**:Using the Rust Tauri, the performance experience is much lighter and faster than JS, memory is much smaller. -🩴 **Special**:Not just packaged, with shortcut pass-through, immersive windows, minimalist customization of products. +🏂 **Small**:Nearly 40 times smaller than Electron package, less than 3M. +😂 **Fast**:Using the Rust Tauri, the performance experience is much lighter and faster than JS, memory is much smaller. +🩴 **Special**:Not just packaged, with shortcut pass-through, immersive windows, minimalist customization of products. 🐶 **Toy**:Just a very simple little toy, a way to play with Rust instead of the old idea of shelling the web. ## Download @@ -65,26 +65,25 @@ More common apps can be downloaded from [Releases](https://github.com/tw93/Pake/ ## Shortcuts -|Mac|Windows/Linux|Function| -| ---- | ----- | ---- | -| + [|Ctrl + |Return to the previous page| -| + ]|Ctrl + |Go to the next page| -| + |Ctrl + |Auto scroll to top of page| -| + |Ctrl + |Auto scroll to bottom of page| -| + r|Ctrl + r|Refresh Page| -| + w||Hide window, not quite| -| + -|Ctrl + -|Zoom out the page| -| + +|Ctrl + +|Zoom in the page| -| + =|Ctrl + =|Zoom in the Page| -| + 0|Ctrl + 0|Reset the page zoom| - +| Mac | Windows/Linux | Function | +| --------------------------- | ------------------------------ | ----------------------------- | +| + [ | Ctrl + | Return to the previous page | +| + ] | Ctrl + | Go to the next page | +| + | Ctrl + | Auto scroll to top of page | +| + | Ctrl + | Auto scroll to bottom of page | +| + r | Ctrl + r | Refresh Page | +| + w | | Hide window, not quite | +| + - | Ctrl + - | Zoom out the page | +| + + | Ctrl + + | Zoom in the page | +| + = | Ctrl + = | Zoom in the Page | +| + 0 | Ctrl + 0 | 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 ## 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. -- 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. +- 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. ## Development @@ -139,9 +138,9 @@ Refer to the communication code in `pake.js` with `postMessage`, write the event ## 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 feed canned food 🥩🍤. -- 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. +- 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 feed canned food 🥩🍤. +- 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. ## Finally diff --git a/dist/twitter.css b/dist/twitter.css index 5677b6d..5ecf727 100644 --- a/dist/twitter.css +++ b/dist/twitter.css @@ -1,22 +1,22 @@ -[data-testid='placementTracking'] article, -a[href*='quick_promote_web'], -[data-testid='AppTabBar_Explore_Link'], -a[href*='/lists'][role='link'][aria-label], -a[href='/i/bookmarks'] { +[data-testid="placementTracking"] article, +a[href*="quick_promote_web"], +[data-testid="AppTabBar_Explore_Link"], +a[href*="/lists"][role="link"][aria-label], +a[href="/i/bookmarks"] { display: none !important; } /* Hide Messages Drawer */ -[data-testid='DMDrawer'] { +[data-testid="DMDrawer"] { visibility: hidden !important; } -[data-testid='primaryColumn'] > div > div { +[data-testid="primaryColumn"] > div > div { position: relative !important; } /* Hide sidebar */ -[data-testid='sidebarColumn'] { +[data-testid="sidebarColumn"] { visibility: hidden !important; width: 0 !important; margin: 0 !important; @@ -29,76 +29,76 @@ a[href='/i/bookmarks'] { @media only screen and (min-width: 1000px) { /* Center the Timeline */ /* Prevent horizontal scroll */ - main[role='main'] { + main[role="main"] { align-items: center !important; overflow-x: clip !important; } /* Match widths for feed */ - [data-testid='primaryColumn'] { + [data-testid="primaryColumn"] { width: 700px !important; max-width: 700px !important; margin: 0 auto !important; } - [data-testid='primaryColumn'] > div > div:last-child, - [data-testid='primaryColumn'] > div > div:last-child div { + [data-testid="primaryColumn"] > div > div:last-child, + [data-testid="primaryColumn"] > div > div:last-child div { max-width: unset !important; } /* Nudge engagement row 81px right */ /* In default feed: 506px - 425px */ - div[aria-label][role='group'][id^='id__'] { + div[aria-label][role="group"][id^="id__"] { margin-right: 81px !important; } /* Fix navigation to left */ - header[role='banner'] { + header[role="banner"] { position: fixed !important; left: 0 !important; } - header[role='banner'] > div > div > div { + header[role="banner"] > div > div > div { justify-content: center !important; padding-top: 0; } - form[role='search'] > div:nth-child(1) > div { + form[role="search"] > div:nth-child(1) > div { background-color: transparent !important; } /* Align Twitter navigation icon with search */ - h1[role='heading'] { + h1[role="heading"] { padding-top: 4px !important; } /* Navigation buttons labels and Account button label on hover */ - header[role='banner'] - nav[role='navigation'] + header[role="banner"] + nav[role="navigation"] * - div[dir='auto']:not([aria-label]) + div[dir="auto"]:not([aria-label]) > span, - [data-testid='SideNav_AccountSwitcher_Button'] > div:not(:first-child) { + [data-testid="SideNav_AccountSwitcher_Button"] > div:not(:first-child) { display: inline-block !important; opacity: 0 !important; transition: 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); } - header[role='banner'] - nav[role='navigation']:hover + header[role="banner"] + nav[role="navigation"]:hover * - div[dir='auto']:not([aria-label]) + div[dir="auto"]:not([aria-label]) > span, - [data-testid='SideNav_AccountSwitcher_Button']:hover > div:not(:first-child) { + [data-testid="SideNav_AccountSwitcher_Button"]:hover > div:not(:first-child) { opacity: 1 !important; } - header[role='banner'] nav[role='navigation']:hover > * > div { + header[role="banner"] nav[role="navigation"]:hover > * > div { backdrop-filter: blur(12px) !important; } - header[role='banner'] nav[role='navigation'] > a { + header[role="banner"] nav[role="navigation"] > a { position: relative; } - header[role='banner'] nav[role='navigation'] > a::before { - content: ''; + header[role="banner"] nav[role="navigation"] > a::before { + content: ""; position: absolute; top: 0px; right: -40px; @@ -106,13 +106,13 @@ a[href='/i/bookmarks'] { left: 0px; } /* Align account button with floating tweet button */ - [data-testid='SideNav_AccountSwitcher_Button'] { + [data-testid="SideNav_AccountSwitcher_Button"] { bottom: 18px !important; left: 1px !important; } /* Floating Tweet Button */ - [data-testid='SideNav_NewTweet_Button'] { + [data-testid="SideNav_NewTweet_Button"] { position: fixed !important; right: 16px !important; bottom: 24px !important; @@ -129,7 +129,7 @@ a[href='/i/bookmarks'] { /* Reveal searchbar and search filters at desktop breakpoint */ @media only screen and (min-width: 1265px) { /* Reveal searchbar */ - [data-testid='sidebarColumn'] form[role='search'] { + [data-testid="sidebarColumn"] form[role="search"] { visibility: visible !important; position: fixed !important; top: 12px !important; @@ -137,27 +137,27 @@ a[href='/i/bookmarks'] { } /* Match size of input the placeholder content */ - [data-testid='sidebarColumn'] input[placeholder='Search Twitter'] { + [data-testid="sidebarColumn"] input[placeholder="Search Twitter"] { width: 150px; } /* Match size of focused search container to its dropdown */ /* 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; backdrop-filter: blur(12px) !important; } /* 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; } /* Reset width and left positioning to align search dropdown */ - div[style*='left: -12px'] { + div[style*="left: -12px"] { left: unset !important; } - div[style='left: -8px; width: 306px;'] { + div[style="left: -8px; width: 306px;"] { left: unset !important; width: 374px !important; } diff --git a/script/build.bat b/script/build.bat index 4ba375e..20a340d 100644 --- a/script/build.bat +++ b/script/build.bat @@ -3,22 +3,22 @@ chcp 65001 if not exist node_modules ( call npm i -) +) if not exist output ( mkdir output -) +) if not exist output\windows ( mkdir output\windows -) +) - echo. - echo ======================= - echo "build for windows" - echo ======================= - echo. +echo. +echo ======================= +echo "build for windows" +echo ======================= +echo. :: total package number set /A index=1 @@ -61,7 +61,7 @@ for /f "skip=1 tokens=1-4 delims=," %%i in (app.csv) do ( echo building package !index!/!total! echo package name is !name! !name_zh! echo npm run build:windows - @echo off + @echo off call npm run tauri build -- --target x86_64-pc-windows-msvc move src-tauri\target\x86_64-pc-windows-msvc\release\bundle\msi\*.msi output\windows @@ -71,7 +71,7 @@ for /f "skip=1 tokens=1-4 delims=," %%i in (app.csv) do ( echo. set /A index=index+1 - @echo off + @echo off ) diff --git a/script/build.sh b/script/build.sh index c8e9f4c..2eb3e1a 100755 --- a/script/build.sh +++ b/script/build.sh @@ -10,16 +10,16 @@ if [ ! -d "output" ]; then fi if [[ "$OSTYPE" =~ ^linux ]]; then - if [ ! -d "output/linux" ]; then - mkdir output/linux - fi + if [ ! -d "output/linux" ]; then + mkdir output/linux + fi fi if [[ "$OSTYPE" =~ ^darwin ]]; then - if [ ! -d "output/macos" ]; then - mkdir output/macos - fi + if [ ! -d "output/macos" ]; then + mkdir output/macos + fi fi SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) # total app number, ignore first line @@ -34,89 +34,89 @@ old_url="https://weread.qq.com/" package_prefix="com-tw93" if [[ "$OSTYPE" =~ ^linux ]]; then - echo "===============" - echo "Build for Linux" - echo "===============" - export sd=${SHELL_FOLDER}/sd-linux-x64 - chmod +x $sd - # for linux, package name may be com.xxx.xxx - echo "rename package name" - 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 - $sd "\"productName\": \"weread\"" "\"productName\": \"${package_prefix}-weread\"" src-tauri/tauri.conf.json + echo "===============" + echo "Build for Linux" + echo "===============" + export sd=${SHELL_FOLDER}/sd-linux-x64 + chmod +x $sd + # for linux, package name may be com.xxx.xxx + echo "rename package name" + 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 + $sd "\"productName\": \"weread\"" "\"productName\": \"${package_prefix}-weread\"" src-tauri/tauri.conf.json fi if [[ "$OSTYPE" =~ ^darwin ]]; then - echo "===============" - echo "Build for MacOS" - echo "===============" + echo "===============" + echo "Build for MacOS" + echo "===============" - export sd=${SHELL_FOLDER}/sd-apple-x64 - chmod +x $sd - echo "rename package name" - $sd "\"productName\": \"weread\"" "\"productName\": \"WeRead\"" src-tauri/tauri.conf.json + export sd=${SHELL_FOLDER}/sd-apple-x64 + chmod +x $sd + echo "rename package name" + $sd "\"productName\": \"weread\"" "\"productName\": \"WeRead\"" src-tauri/tauri.conf.json fi tail -n +2 app.csv | while IFS=, read -r -a arr; do - package_name=${arr[0]} - package_title=${arr[1]} - package_zh_name=${arr[2]} - url=${arr[3]} - echo "update package name and url" - # replace package info - $sd ${old_url} ${url} src-tauri/tauri.conf.json - $sd ${old_name} ${package_name} src-tauri/tauri.conf.json - echo "update ico with 32x32 pictue" - $sd ${old_name} ${package_name} src-tauri/src/main.rs + package_name=${arr[0]} + package_title=${arr[1]} + package_zh_name=${arr[2]} + url=${arr[3]} + echo "update package name and url" + # replace package info + $sd ${old_url} ${url} src-tauri/tauri.conf.json + $sd ${old_name} ${package_name} src-tauri/tauri.conf.json + echo "update ico with 32x32 pictue" + $sd ${old_name} ${package_name} src-tauri/src/main.rs - # for apple, need replace title - if [[ "$OSTYPE" =~ ^darwin ]]; then - $sd ${old_title} ${package_title} src-tauri/tauri.conf.json - fi - - # echo "update ico with 32x32 pictue" - # cp "src-tauri/png/${package_name}_32.ico" "src-tauri/icons/icon.ico" + # for apple, need replace title + if [[ "$OSTYPE" =~ ^darwin ]]; then + $sd ${old_title} ${package_title} src-tauri/tauri.conf.json + fi - if [[ "$OSTYPE" =~ ^linux ]]; then - echo "update desktop" - old_desktop="src-tauri/assets/${package_prefix}-${old_name}.desktop" - new_desktop="src-tauri/assets/${package_prefix}-${package_name}.desktop" - mv ${old_desktop} ${new_desktop} - $sd ${old_zh_name} ${package_zh_name} ${new_desktop} - $sd ${old_name} ${package_name} ${new_desktop} - fi + # echo "update ico with 32x32 pictue" + # cp "src-tauri/png/${package_name}_32.ico" "src-tauri/icons/icon.ico" - # update package info - old_name=${package_name} - old_title=${package_title} - old_zh_name=${package_zh_name} - old_url=${url} + if [[ "$OSTYPE" =~ ^linux ]]; then + echo "update desktop" + old_desktop="src-tauri/assets/${package_prefix}-${old_name}.desktop" + new_desktop="src-tauri/assets/${package_prefix}-${package_name}.desktop" + mv ${old_desktop} ${new_desktop} + $sd ${old_zh_name} ${package_zh_name} ${new_desktop} + $sd ${old_name} ${package_name} ${new_desktop} + fi - echo "building package ${index}/${total}" - echo "package name is ${package_name} (${package_zh_name})" - npm run tauri build - echo "package build success!" - index=$(($index+1)) + # update package info + old_name=${package_name} + old_title=${package_title} + old_zh_name=${package_zh_name} + old_url=${url} - if [[ "$OSTYPE" =~ ^linux ]]; then - mv src-tauri/target/release/bundle/deb/*.deb output/linux - fi + echo "building package ${index}/${total}" + echo "package name is ${package_name} (${package_zh_name})" + npm run tauri build + echo "package build success!" + index=$(($index+1)) - if [[ "$OSTYPE" =~ ^darwin ]]; then - mv src-tauri/target/release/bundle/dmg/*.dmg output/macos - echo "" - fi + if [[ "$OSTYPE" =~ ^linux ]]; then + mv src-tauri/target/release/bundle/deb/*.deb output/linux + fi + + if [[ "$OSTYPE" =~ ^darwin ]]; then + mv src-tauri/target/release/bundle/dmg/*.dmg output/macos + echo "" + fi done echo "build all package success!" if [[ "$OSTYPE" =~ ^linux ]]; then - echo "result file in output/linux" + echo "result file in output/linux" fi if [[ "$OSTYPE" =~ ^darwin ]]; then - # replace again - $sd "\"productName\": \"WeRead\"" "\"productName\": \"weread\"" src-tauri/tauri.conf.json - echo "result file in output/macos" -fi \ No newline at end of file + # replace again + $sd "\"productName\": \"WeRead\"" "\"productName\": \"weread\"" src-tauri/tauri.conf.json + echo "result file in output/macos" +fi diff --git a/src-tauri/src/pake.js b/src-tauri/src/pake.js index b37ee6a..f6dcdae 100644 --- a/src-tauri/src/pake.js +++ b/src-tauri/src/pake.js @@ -7,33 +7,32 @@ * @type {Record} */ - const metaKeyShortcuts = { - 'ArrowUp': () => scrollTo(0, 0), - 'ArrowDown': () => scrollTo(0, document.body.scrollHeight), - '[': () => window.history.back(), - ']': () => window.history.forward(), - 'r': () => window.location.reload(), - '-': () => zoomOut(), - '=': () => zoomIn(), - '+': () => zoomIn(), - '0': () => zoomCommon(() => '100%'), -} - +const metaKeyShortcuts = { + ArrowUp: () => scrollTo(0, 0), + ArrowDown: () => scrollTo(0, document.body.scrollHeight), + "[": () => window.history.back(), + "]": () => window.history.forward(), + r: () => window.location.reload(), + "-": () => zoomOut(), + "=": () => zoomIn(), + "+": () => zoomIn(), + 0: () => zoomCommon(() => "100%"), +}; const ctrlKeyShortcuts = { - 'ArrowUp': () => scrollTo(0, 0), - 'ArrowDown': () => scrollTo(0, document.body.scrollHeight), - 'ArrowLeft': () => window.history.back(), - 'ArrowRight': () => window.history.forward(), - 'r': () => window.location.reload(), - '-': () => zoomOut(), - '=': () => zoomIn(), - '+': () => zoomIn(), - '0': () => zoomCommon(() => '100%'), -} + ArrowUp: () => scrollTo(0, 0), + ArrowDown: () => scrollTo(0, document.body.scrollHeight), + ArrowLeft: () => window.history.back(), + ArrowRight: () => window.history.forward(), + r: () => window.location.reload(), + "-": () => zoomOut(), + "=": () => zoomIn(), + "+": () => zoomIn(), + 0: () => zoomCommon(() => "100%"), +}; -window.addEventListener('DOMContentLoaded', (_event) => { - const style = document.createElement('style'); +window.addEventListener("DOMContentLoaded", (_event) => { + const style = document.createElement("style"); style.innerHTML = ` #page #footer-wrapper, .drawing-board .toolbar .toolbar-action, @@ -110,27 +109,27 @@ window.addEventListener('DOMContentLoaded', (_event) => { } `; document.head.append(style); - const topDom = document.createElement('div'); - topDom.id = 'pack-top-dom'; + const topDom = document.createElement("div"); + topDom.id = "pack-top-dom"; 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) { - window.ipc.postMessage('drag_window'); + window.ipc.postMessage("drag_window"); } }); - domEl.addEventListener('touchstart', () => { - window.ipc.postMessage('drag_window'); + domEl.addEventListener("touchstart", () => { + window.ipc.postMessage("drag_window"); }); - domEl.addEventListener('dblclick', () => { - window.ipc.postMessage('fullscreen'); + domEl.addEventListener("dblclick", () => { + window.ipc.postMessage("fullscreen"); }); - document.addEventListener('keyup', function (event) { + document.addEventListener("keyup", function (event) { const preventDefault = (f) => { event.preventDefault(); f(); @@ -147,14 +146,17 @@ window.addEventListener('DOMContentLoaded', (_event) => { } }); - document.addEventListener('click', (e) => { - const origin = e.target.closest('a'); + document.addEventListener("click", (e) => { + const origin = e.target.closest("a"); if (origin && origin.href) { - origin.target = '_self'; + origin.target = "_self"; //额外处理下 twitter 的外跳,对于其他需要外跳的可以改这里成对应域名 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(); window.ipc.postMessage(`open_browser:${href}`); } @@ -165,9 +167,9 @@ window.addEventListener('DOMContentLoaded', (_event) => { setDefaultZoom(); function setDefaultZoom() { - const htmlZoom = window.localStorage.getItem('htmlZoom'); + const htmlZoom = window.localStorage.getItem("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] */ function zoomCommon(zoomRule) { - const htmlZoom = window.localStorage.getItem('htmlZoom') || '100%'; - const html = document.getElementsByTagName('html')[0]; + const htmlZoom = window.localStorage.getItem("htmlZoom") || "100%"; + const html = document.getElementsByTagName("html")[0]; const zoom = zoomRule(htmlZoom); html.style.zoom = zoom; - window.localStorage.setItem('htmlZoom', zoom); + window.localStorage.setItem("htmlZoom", zoom); } function zoomIn() { - zoomCommon((htmlZoom) => - `${Math.min(parseInt(htmlZoom) + 10, 200)}%` - ); + zoomCommon((htmlZoom) => `${Math.min(parseInt(htmlZoom) + 10, 200)}%`); } function zoomOut() { - zoomCommon((htmlZoom) => - `${Math.max(parseInt(htmlZoom) - 10, 30)}%` - ); + zoomCommon((htmlZoom) => `${Math.max(parseInt(htmlZoom) - 10, 30)}%`); } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 733d5cf..2f28d0d 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -54,7 +54,7 @@ }, "resources": [], "shortDescription": "", - "targets": ["deb", "msi", "dmg"], + "targets": ["deb", "msi", "dmg"], "windows": { "certificateThumbprint": null, "digestAlgorithm": "sha256",