增加谷歌翻译

This commit is contained in:
Tw93
2022-11-09 16:14:32 +08:00
parent d86206ed19
commit e45b03913d
6 changed files with 160 additions and 67 deletions

View File

@@ -2,7 +2,7 @@
<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="left">很简单的用 Rust 打包网页生成很小的 Mac App底层使用 Tauri支持微信读书、Twitter、Youtube、Reference、RunCode、Witeboard、Flomo、语雀、Vercel、V2EX、工具箱等详细小白开发教程可见底部。</div> <div align="left">很简单的用 Rust 打包网页生成很小的 Mac App底层使用 Tauri支持微信读书、Twitter、Youtube、Reference、RunCode、Google Translate、Witeboard、Flomo、语雀、Vercel、V2EX、工具箱等详细小白开发教程可见底部。</div>
</p> </p>
## 特征 ## 特征
@@ -33,11 +33,11 @@
</tr> </tr>
<tr> <tr>
<td>RunCode <a href="https://github.com/tw93/Pake/releases/latest/download/RunCode.dmg">Download</a></td> <td>RunCode <a href="https://github.com/tw93/Pake/releases/latest/download/RunCode.dmg">Download</a></td>
<td>Witeboard <a href="https://github.com/tw93/Pake/releases/latest/download/Witeboard.dmg">Download</a></td> <td>Google Translate <a href="https://github.com/tw93/Pake/releases/latest/download/GoogleTranslate.dmg">Download</a></td>
</tr> </tr>
<tr> <tr>
<td><img src=https://cdn.fliggy.com/upic/EB1OYP.jpg width=600/></td> <td><img src=https://cdn.fliggy.com/upic/EB1OYP.jpg width=600/></td>
<td><img src=https://cdn.fliggy.com/upic/CW0p3q.jpg width=600/></td> <td><img src=https://cdn.fliggy.com/upic/EmjUGy.png width=600/></td>
</tr> </tr>
<tr> <tr>
<td>Flomo <a href="https://github.com/tw93/Pake/releases/latest/download/Flomo.dmg">Download</a></td> <td>Flomo <a href="https://github.com/tw93/Pake/releases/latest/download/Flomo.dmg">Download</a></td>

View File

@@ -2,7 +2,7 @@
<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="left">A simple way to package a web page with Rust to create Mac App, using Tauri as underlying layer, supporting WeRead、Twitter、Youtube、Reference、Flomo、Witeboard、YuQue、RunCode、Vercel、V2EX、Tools, detailed development tutorial can be seen at the bottom.</div> <div align="left">A simple way to package a web page with Rust to create Mac App, using Tauri as underlying layer, supporting WeRead、Twitter、Youtube、Google Translate、Reference、Flomo、Witeboard、YuQue、RunCode、Vercel、V2EX、Tools, detailed development tutorial can be seen at the bottom.</div>
</p> </p>
## Features ## Features
@@ -33,11 +33,11 @@
</tr> </tr>
<tr> <tr>
<td>RunCode <a href="https://github.com/tw93/Pake/releases/latest/download/RunCode.dmg">Download</a></td> <td>RunCode <a href="https://github.com/tw93/Pake/releases/latest/download/RunCode.dmg">Download</a></td>
<td>Witeboard <a href="https://github.com/tw93/Pake/releases/latest/download/Witeboard.dmg">Download</a></td> <td>Google Translate <a href="https://github.com/tw93/Pake/releases/latest/download/GoogleTranslate.dmg">Download</a></td>
</tr> </tr>
<tr> <tr>
<td><img src=https://cdn.fliggy.com/upic/EB1OYP.jpg width=600/></td> <td><img src=https://cdn.fliggy.com/upic/EB1OYP.jpg width=600/></td>
<td><img src=https://cdn.fliggy.com/upic/CW0p3q.jpg width=600/></td> <td><img src=https://cdn.fliggy.com/upic/EmjUGy.png width=600/></td>
</tr> </tr>
<tr> <tr>
<td>Flomo <a href="https://github.com/tw93/Pake/releases/latest/download/Flomo.dmg">Download</a></td> <td>Flomo <a href="https://github.com/tw93/Pake/releases/latest/download/Flomo.dmg">Download</a></td>

View File

@@ -18,9 +18,9 @@
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@tauri-apps/api": "^1.0.2" "@tauri-apps/api": "^1.2.0"
}, },
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "^1.0.2" "@tauri-apps/cli": "^1.2.0"
} }
} }

185
src-tauri/Cargo.lock generated
View File

@@ -62,7 +62,7 @@ dependencies = [
"tauri", "tauri",
"tauri-build", "tauri-build",
"tauri-utils", "tauri-utils",
"wry", "wry 0.21.1",
] ]
[[package]] [[package]]
@@ -218,12 +218,11 @@ dependencies = [
[[package]] [[package]]
name = "cargo_toml" name = "cargo_toml"
version = "0.11.5" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5809dd3e6444651fd1cdd3dbec71eca438c439a0fcc8081674a14da0afe50185" checksum = "aa0e3586af56b3bfa51fca452bd56e8dbbbd5d8d81cbf0b7e4e35b695b537eb8"
dependencies = [ dependencies = [
"serde", "serde",
"serde_derive",
"toml", "toml",
] ]
@@ -588,6 +587,12 @@ dependencies = [
"dtoa", "dtoa",
] ]
[[package]]
name = "dunce"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c"
[[package]] [[package]]
name = "embed_plist" name = "embed_plist"
version = "1.2.2" version = "1.2.2"
@@ -1240,6 +1245,20 @@ dependencies = [
"walkdir", "walkdir",
] ]
[[package]]
name = "jni"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c"
dependencies = [
"cesu8",
"combine",
"jni-sys",
"log",
"thiserror",
"walkdir",
]
[[package]] [[package]]
name = "jni-sys" name = "jni-sys"
version = "0.3.0" version = "0.3.0"
@@ -1756,9 +1775,9 @@ checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
version = "2.1.0" version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]] [[package]]
name = "pest" name = "pest"
@@ -2301,18 +2320,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.145" version = "1.0.147"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.145" version = "1.0.147"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2321,9 +2340,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.86" version = "1.0.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41feea4228a6f1cd09ec7a3593a682276702cd67b5273544757dae23c096f074" checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
dependencies = [ dependencies = [
"itoa 1.0.2", "itoa 1.0.2",
"ryu", "ryu",
@@ -2612,7 +2631,7 @@ dependencies = [
"gtk", "gtk",
"image", "image",
"instant", "instant",
"jni", "jni 0.19.0",
"lazy_static", "lazy_static",
"libc", "libc",
"log", "log",
@@ -2628,7 +2647,53 @@ dependencies = [
"scopeguard", "scopeguard",
"serde", "serde",
"unicode-segmentation", "unicode-segmentation",
"uuid 1.1.2", "uuid 1.2.1",
"windows 0.39.0",
"windows-implement",
"x11-dl",
]
[[package]]
name = "tao"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3732f018e98c1df9d26c12892750b04b49e044ccdc01f2596a7f887569ad8c31"
dependencies = [
"bitflags",
"cairo-rs",
"cc",
"cocoa",
"core-foundation",
"core-graphics",
"crossbeam-channel",
"dispatch",
"gdk",
"gdk-pixbuf",
"gdk-sys",
"gdkx11-sys",
"gio",
"glib",
"glib-sys",
"gtk",
"image",
"instant",
"jni 0.20.0",
"lazy_static",
"libc",
"log",
"ndk",
"ndk-context",
"ndk-sys",
"objc",
"once_cell",
"parking_lot",
"paste",
"png 0.17.5",
"raw-window-handle",
"scopeguard",
"serde",
"unicode-segmentation",
"uuid 1.2.1",
"windows 0.39.0", "windows 0.39.0",
"windows-implement", "windows-implement",
"x11-dl", "x11-dl",
@@ -2647,9 +2712,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri" name = "tauri"
version = "1.1.1" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efbf22abd61d95ca9b2becd77f9db4c093892f73e8a07d21d8b0b2bf71a7bcea" checksum = "ac135e45c2923bd91edbb95a0d656f8d025389697e34d6d79166952bfa79c61c"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"attohttpc", "attohttpc",
@@ -2692,7 +2757,7 @@ dependencies = [
"thiserror", "thiserror",
"tokio", "tokio",
"url", "url",
"uuid 1.1.2", "uuid 1.2.1",
"webkit2gtk", "webkit2gtk",
"webview2-com", "webview2-com",
"windows 0.39.0", "windows 0.39.0",
@@ -2700,9 +2765,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-build" name = "tauri-build"
version = "1.1.1" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0991fb306849897439dbd4a72e4cbed2413e2eb26cb4b3ba220b94edba8b4b88" checksum = "ef796f49abc98e6de0abe1b655120addc9d82363d8fc2304e71a4177c25e783c"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cargo_toml", "cargo_toml",
@@ -2716,9 +2781,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-codegen" name = "tauri-codegen"
version = "1.1.1" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "356fa253e40ae4d6ff02075011f2f2bb4066f5c9d8c1e16ca6912d7b75903ba6" checksum = "afcb77cf7bfe3d8f886e73a7fa6157587d015c599671180b76595c1aef175ba8"
dependencies = [ dependencies = [
"base64", "base64",
"brotli", "brotli",
@@ -2736,15 +2801,15 @@ dependencies = [
"tauri-utils", "tauri-utils",
"thiserror", "thiserror",
"time", "time",
"uuid 1.1.2", "uuid 1.2.1",
"walkdir", "walkdir",
] ]
[[package]] [[package]]
name = "tauri-macros" name = "tauri-macros"
version = "1.1.1" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6051fd6940ddb22af452340d03c66a3e2f5d72e0788d4081d91e31528ccdc4d" checksum = "f24f481b0b2acfc288ac78755f00ebea53992c7365a165af64cb5ae00806edea"
dependencies = [ dependencies = [
"heck 0.4.0", "heck 0.4.0",
"proc-macro2", "proc-macro2",
@@ -2756,30 +2821,29 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime" name = "tauri-runtime"
version = "0.11.1" version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d49439a5ea47f474572b854972f42eda2e02a470be5ca9609cc83bb66945abe2" checksum = "5fc5d54c476defa5436e70e0d0a06e3cb0f49b6f863895995d5e3769411769cf"
dependencies = [ dependencies = [
"gtk", "gtk",
"http", "http",
"http-range", "http-range",
"infer",
"rand 0.8.5", "rand 0.8.5",
"raw-window-handle", "raw-window-handle",
"serde", "serde",
"serde_json", "serde_json",
"tauri-utils", "tauri-utils",
"thiserror", "thiserror",
"uuid 1.1.2", "uuid 1.2.1",
"webview2-com", "webview2-com",
"windows 0.39.0", "windows 0.39.0",
] ]
[[package]] [[package]]
name = "tauri-runtime-wry" name = "tauri-runtime-wry"
version = "0.11.1" version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28dce920995fd49907aa9bea7249ed1771454f11f7611924c920a1f75fb614d4" checksum = "d78c55091701426c2519c7e9f1dc2dd33e533af4e75eae89cedc6995409351a2"
dependencies = [ dependencies = [
"cocoa", "cocoa",
"gtk", "gtk",
@@ -2788,24 +2852,25 @@ dependencies = [
"raw-window-handle", "raw-window-handle",
"tauri-runtime", "tauri-runtime",
"tauri-utils", "tauri-utils",
"uuid 1.1.2", "uuid 1.2.1",
"webkit2gtk", "webkit2gtk",
"webview2-com", "webview2-com",
"windows 0.39.0", "windows 0.39.0",
"wry", "wry 0.22.0",
] ]
[[package]] [[package]]
name = "tauri-utils" name = "tauri-utils"
version = "1.1.1" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e8fdae6f29cef959809a3c3afef510c5b715a446a597ab8b791497585363f39" checksum = "d64c9a09ba1538b8e67ae8c78c10904f36ce38d364bf7f089ec807032a826b02"
dependencies = [ dependencies = [
"brotli", "brotli",
"ctor", "ctor",
"glob", "glob",
"heck 0.4.0", "heck 0.4.0",
"html5ever", "html5ever",
"infer",
"json-patch", "json-patch",
"kuchiki", "kuchiki",
"memchr", "memchr",
@@ -3036,9 +3101,9 @@ dependencies = [
[[package]] [[package]]
name = "unicode-segmentation" name = "unicode-segmentation"
version = "1.9.0" version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a"
[[package]] [[package]]
name = "url" name = "url"
@@ -3066,9 +3131,9 @@ checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.1.2" version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" checksum = "feb41e78f93363bb2df8b0e86a2ca30eed7806ea16ea0c790d757cf93f79be83"
dependencies = [ dependencies = [
"getrandom 0.2.7", "getrandom 0.2.7",
] ]
@@ -3204,9 +3269,9 @@ dependencies = [
[[package]] [[package]]
name = "webkit2gtk" name = "webkit2gtk"
version = "0.18.0" version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29952969fb5e10fe834a52eb29ad0814ccdfd8387159b0933edf1344a1c9cdcc" checksum = "b8f859735e4a452aeb28c6c56a852967a8a76c8eb1cc32dbf931ad28a13d6370"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cairo-rs", "cairo-rs",
@@ -3562,7 +3627,45 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"sha2", "sha2",
"tao", "tao 0.14.0",
"thiserror",
"url",
"webkit2gtk",
"webkit2gtk-sys",
"webview2-com",
"windows 0.39.0",
"windows-implement",
]
[[package]]
name = "wry"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "923d297b203eae65b095af16c02978b7932be1968012b4da7138390edf34dea5"
dependencies = [
"base64",
"block",
"cocoa",
"core-graphics",
"crossbeam-channel",
"dunce",
"gdk",
"gio",
"glib",
"gtk",
"html5ever",
"http",
"kuchiki",
"libc",
"log",
"objc",
"objc_id",
"once_cell",
"serde",
"serde_json",
"sha2",
"soup2",
"tao 0.15.2",
"thiserror", "thiserror",
"url", "url",
"webkit2gtk", "webkit2gtk",

Binary file not shown.

View File

@@ -1,17 +1,9 @@
/** /**
* @typedef {string} KeyboardKey `event.key` 的代号, * @typedef {string} KeyboardKey `event.key` 的代号,
* 见 <https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values> * 见 <https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values>
*/
/**
* @typedef {() => void} OnKeyDown 使用者按下 ⌘ [KeyboardKey] 时应该执行的行为 * @typedef {() => void} OnKeyDown 使用者按下 ⌘ [KeyboardKey] 时应该执行的行为
*/
/**
* 以 Meta 键 (⌘) 为首的快捷键清单。 * 以 Meta 键 (⌘) 为首的快捷键清单。
*
* 每个写在这里的 shortcuts 都会运行 {@link Event.preventDefault}. * 每个写在这里的 shortcuts 都会运行 {@link Event.preventDefault}.
*
* @type {Record<KeyboardKey, OnKeyDown>} * @type {Record<KeyboardKey, OnKeyDown>}
*/ */
const metaKeyShortcuts = { const metaKeyShortcuts = {
@@ -28,16 +20,6 @@ const metaKeyShortcuts = {
window.addEventListener('DOMContentLoaded', (_event) => { window.addEventListener('DOMContentLoaded', (_event) => {
const style = document.createElement('style'); const style = document.createElement('style');
style.innerHTML = ` style.innerHTML = `
// mini twitter 代码存到 dist 下面,为了防止干扰,需要的时候 copy 过来即可
.panel.give_me .nav_view {
top: 154px !important;
}
.columns .column #header{
padding-top: 30px;
}
#page .main_header, #ReactApp .lark .main-wrapper > div, #ReactApp .lark .sidebar-user-info, .explore-wrapper .yuque-header-wrapper { #page .main_header, #ReactApp .lark .main-wrapper > div, #ReactApp .lark .sidebar-user-info, .explore-wrapper .yuque-header-wrapper {
padding-top: 20px; padding-top: 20px;
} }
@@ -59,6 +41,14 @@ window.addEventListener('DOMContentLoaded', (_event) => {
display: none !important; display: none !important;
} }
.panel.give_me .nav_view {
top: 154px !important;
}
.columns .column #header{
padding-top: 30px;
}
ytd-masthead>#container.style-scope.ytd-masthead { ytd-masthead>#container.style-scope.ytd-masthead {
padding-top: 12px !important; padding-top: 12px !important;
} }