Merge branch 'master' into dev

This commit is contained in:
Tw93
2024-04-28 15:00:36 +08:00
14 changed files with 1499 additions and 847 deletions

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2023 Tw93
Copyright (c) 2024 Tw93
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

208
README.md
View File

@@ -76,7 +76,7 @@
</td>
</tr>
<tr>
<td><img src=https://cdn.fliggy.com/upic/3UREAw.png width=600/></td>
<td><img src=https://raw.githubusercontent.com/tw93/static/master/pic/12.png width=600/></td>
<td><img src=https://gw.alipayobjects.com/zos/k/pn/1.jpg width=600/></td>
</tr>
<tr>
@@ -196,7 +196,7 @@ npm run build
## Advanced Usage
1. You can refer to the [codebase structure](https://github.com/tw93/Pake/wiki/Description-of-Pake's-code-structure) before working on Pake, which will help you much in development.
2. Modify the `url` and `productName` fields in the `pake.json` file under the src-tauri directory, the "domain" field in the `tauri.config.json` file needs to be modified synchronously, as well as the `icon` and `identifier` fields in the `tauri.xxx.conf.json` file. You can select a `icon` from the `icons` directory or download one from [macOSicons](https://macosicons.com/#/) to match your product needs.
2. Modify the `url` and `productName` fields in the `pake.json` file under the src-tauri directory, the "domain" field in the `tauri.config.json` file needs to be modified synchronously, as well as the `icon` and `identifier` fields in the `tauri.xxx.conf.json` file. You can select an `icon` from the `icons` directory or download one from [macOSicons](https://macosicons.com/#/) to match your product needs.
3. For configurations on window properties, you can modify the `pake.json` file to change the value of `width`, `height`, `fullscreen` (or not), `resizable` (or not) of the `windows` property. To adapt to the immersive header on Mac, change `transparent` to `true`, look for the `Header` element, and add the `padding-top` property.
4. For advanced usages such as style rewriting, advertisement removal, JS injection, container message communication, and user-defined shortcut keys, see [Advanced Usage of Pake](https://github.com/tw93/Pake/wiki/Advanced-Usage-of-Pake).
@@ -278,13 +278,6 @@ Pake's development can not be without these Hackers. They contributed a lot of c
<sub><b>Pake Actions</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/QingZ11">
<img src="https://avatars.githubusercontent.com/u/38887077?v=4" width="90;" alt="QingZ11"/>
<br />
<sub><b>Steam</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/exposir">
<img src="https://avatars.githubusercontent.com/u/33340988?v=4" width="90;" alt="exposir"/>
@@ -293,10 +286,117 @@ Pake's development can not be without these Hackers. They contributed a lot of c
</a>
</td>
<td align="center">
<a href="https://github.com/2nthony">
<img src="https://avatars.githubusercontent.com/u/19513289?v=4" width="90;" alt="2nthony"/>
<a href="https://github.com/QingZ11">
<img src="https://avatars.githubusercontent.com/u/38887077?v=4" width="90;" alt="QingZ11"/>
<br />
<sub><b>2nthony</b></sub>
<sub><b>Steam</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/hetz">
<img src="https://avatars.githubusercontent.com/u/820141?v=4" width="90;" alt="hetz"/>
<br />
<sub><b>贺天卓</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/piaoyidage">
<img src="https://avatars.githubusercontent.com/u/5135405?v=4" width="90;" alt="piaoyidage"/>
<br />
<sub><b>Ranger</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/liusishan">
<img src="https://avatars.githubusercontent.com/u/33129823?v=4" width="90;" alt="liusishan"/>
<br />
<sub><b>Liusishan</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/liudonghua123">
<img src="https://avatars.githubusercontent.com/u/2276718?v=4" width="90;" alt="liudonghua123"/>
<br />
<sub><b>Liudonghua</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/lakca">
<img src="https://avatars.githubusercontent.com/u/16255922?v=4" width="90;" alt="lakca"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/houhoz">
<img src="https://avatars.githubusercontent.com/u/19684376?v=4" width="90;" alt="houhoz"/>
<br />
<sub><b>Hyzhao</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/geekvest">
<img src="https://avatars.githubusercontent.com/u/126322776?v=4" width="90;" alt="geekvest"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/princemaple">
<img src="https://avatars.githubusercontent.com/u/1329716?v=4" width="90;" alt="princemaple"/>
<br />
<sub><b>Po Chen</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Milo123459">
<img src="https://avatars.githubusercontent.com/u/50248166?v=4" width="90;" alt="Milo123459"/>
<br />
<sub><b>Milo</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/eltociear">
<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="90;" alt="eltociear"/>
<br />
<sub><b>Ikko Eltociear Ashimine</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Fechin">
<img src="https://avatars.githubusercontent.com/u/2541482?v=4" width="90;" alt="Fechin"/>
<br />
<sub><b>Fechin</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/turkyden">
<img src="https://avatars.githubusercontent.com/u/24560160?v=4" width="90;" alt="turkyden"/>
<br />
<sub><b>Dengju Deng</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/nekomeowww">
<img src="https://avatars.githubusercontent.com/u/11081491?v=4" width="90;" alt="nekomeowww"/>
<br />
<sub><b>Ayaka Neko</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/kidylee">
<img src="https://avatars.githubusercontent.com/u/841310?v=4" width="90;" alt="kidylee"/>
<br />
<sub><b>An Li</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/imabutahersiddik">
<img src="https://avatars.githubusercontent.com/u/138387257?v=4" width="90;" alt="imabutahersiddik"/>
<br />
<sub><b>Abu Taher Siddik</b></sub>
</a>
</td>
<td align="center">
@@ -308,88 +408,10 @@ Pake's development can not be without these Hackers. They contributed a lot of c
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/imabutahersiddik">
<img src="https://avatars.githubusercontent.com/u/138387257?v=4" width="90;" alt="imabutahersiddik"/>
<a href="https://github.com/2nthony">
<img src="https://avatars.githubusercontent.com/u/19513289?v=4" width="90;" alt="2nthony"/>
<br />
<sub><b>Abu Taher Siddik</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/kidylee">
<img src="https://avatars.githubusercontent.com/u/841310?v=4" width="90;" alt="kidylee"/>
<br />
<sub><b>An Li</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/nekomeowww">
<img src="https://avatars.githubusercontent.com/u/11081491?v=4" width="90;" alt="nekomeowww"/>
<br />
<sub><b>Ayaka Neko</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/turkyden">
<img src="https://avatars.githubusercontent.com/u/24560160?v=4" width="90;" alt="turkyden"/>
<br />
<sub><b>Dengju Deng</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Fechin">
<img src="https://avatars.githubusercontent.com/u/2541482?v=4" width="90;" alt="Fechin"/>
<br />
<sub><b>Fechin</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Milo123459">
<img src="https://avatars.githubusercontent.com/u/50248166?v=4" width="90;" alt="Milo123459"/>
<br />
<sub><b>Milo</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/princemaple">
<img src="https://avatars.githubusercontent.com/u/1329716?v=4" width="90;" alt="princemaple"/>
<br />
<sub><b>Po Chen</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/houhoz">
<img src="https://avatars.githubusercontent.com/u/19684376?v=4" width="90;" alt="houhoz"/>
<br />
<sub><b>Hyzhao</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/lakca">
<img src="https://avatars.githubusercontent.com/u/16255922?v=4" width="90;" alt="lakca"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/liusishan">
<img src="https://avatars.githubusercontent.com/u/33129823?v=4" width="90;" alt="liusishan"/>
<br />
<sub><b>Liusishan</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/piaoyidage">
<img src="https://avatars.githubusercontent.com/u/5135405?v=4" width="90;" alt="piaoyidage"/>
<br />
<sub><b>Ranger</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/hetz">
<img src="https://avatars.githubusercontent.com/u/820141?v=4" width="90;" alt="hetz"/>
<br />
<sub><b>贺天卓</b></sub>
<sub><b>2nthony</b></sub>
</a>
</td></tr>
</table>

View File

@@ -75,8 +75,8 @@
</td>
</tr>
<tr>
<td><img src=https://cdn.fliggy.com/upic/3UREAw.png width=600/></td>
<td><img src=https://gw.alipayobjects.com/zos/k/pn/1.jpg width=600/></td>
<td><img src=https://raw.githubusercontent.com/tw93/static/master/pic/12.png width=600 /></td>
<td><img src=https://gw.alipayobjects.com/zos/k/pn/1.jpg width=600 /></td>
</tr>
<tr>
<td>LiZhi

View File

@@ -14,7 +14,7 @@ function resolveAppName(name: string, platform: NodeJS.Platform): string {
function isValidName(name: string, platform: NodeJS.Platform): boolean {
const platformRegexMapping: PlatformMap = {
linux: /^[a-z0-9]+(-[a-z0-9]+)*$/,
default: /^[a-zA-Z0-9]+$/,
default: /^[a-zA-Z0-9]+([-a-zA-Z0-9])*$/,
};
const reg = platformRegexMapping[platform] || platformRegexMapping.default;
return !!name && reg.test(name);
@@ -38,7 +38,7 @@ export default async function handleOptions(
if (!isValidName(name, platform)) {
const LINUX_NAME_ERROR = `✕ name should only include lowercase letters, numbers, and dashes, and must contain at least one lowercase letter. Examples: com-123-xxx, 123pan, pan123, weread, we-read.`;
const DEFAULT_NAME_ERROR = `✕ Name should only include letters and numbers, and must contain at least one letter. Examples: 123pan, 123Pan, Pan123, weread, WeRead, WERead.`;
const DEFAULT_NAME_ERROR = `✕ Name should only include letters and numbers, and dashes (dashes must not at the beginning), and must contain at least one letter. Examples: 123pan, 123Pan, Pan123, weread, WeRead, WERead, we-read.`;
const errorMsg = platform === 'linux' ? LINUX_NAME_ERROR : DEFAULT_NAME_ERROR;
logger.error(errorMsg);
if (isActions) {

6
dist/cli.js vendored
View File

@@ -20,7 +20,7 @@ import psl from 'psl';
import isUrl from 'is-url';
var name = "pake-cli";
var version = "2.3.5";
var version = "2.3.6";
var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
var engines = {
node: ">=16.0.0"
@@ -946,7 +946,7 @@ function resolveAppName(name, platform) {
function isValidName(name, platform) {
const platformRegexMapping = {
linux: /^[a-z0-9]+(-[a-z0-9]+)*$/,
default: /^[a-zA-Z0-9]+$/,
default: /^[a-zA-Z0-9]+([-a-zA-Z0-9])*$/,
};
const reg = platformRegexMapping[platform] || platformRegexMapping.default;
return !!name && reg.test(name);
@@ -964,7 +964,7 @@ async function handleOptions(options, url) {
}
if (!isValidName(name, platform)) {
const LINUX_NAME_ERROR = `✕ name should only include lowercase letters, numbers, and dashes, and must contain at least one lowercase letter. Examples: com-123-xxx, 123pan, pan123, weread, we-read.`;
const DEFAULT_NAME_ERROR = `✕ Name should only include letters and numbers, and must contain at least one letter. Examples: 123pan, 123Pan, Pan123, weread, WeRead, WERead.`;
const DEFAULT_NAME_ERROR = `✕ Name should only include letters and numbers, and dashes (dashes must not at the beginning), and must contain at least one letter. Examples: 123pan, 123Pan, Pan123, weread, WeRead, WERead, we-read.`;
const errorMsg = platform === 'linux' ? LINUX_NAME_ERROR : DEFAULT_NAME_ERROR;
logger.error(errorMsg);
if (isActions) {

View File

@@ -1,6 +1,6 @@
{
"name": "pake-cli",
"version": "2.3.5",
"version": "2.3.6",
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
"engines": {
"node": ">=16.0.0"

2072
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -19,6 +19,7 @@ serde_json = "1.0.108"
serde = { version = "1.0.192", features = ["derive"] }
tauri = { version = "1.5.2", features = ["api-all", "system-tray"] }
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
tauri-plugin-oauth = { git = "https://github.com/FabianLars/tauri-plugin-oauth", branch = "main" }
[dev-dependencies]
cargo-bloat = "0.11.1"

BIN
src-tauri/icons/devv.icns Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -1,9 +1,14 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSCameraUsageDescription</key>
<string>Request camera access</string>
<key>NSMicrophoneUsageDescription</key>
<string>Request microphone access</string>
</dict>
<dict>
<key>NSCameraUsageDescription</key>
<string>Request camera access</string>
<key>NSMicrophoneUsageDescription</key>
<string>Request microphone access</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>

View File

@@ -63,10 +63,13 @@ document.addEventListener('DOMContentLoaded', () => {
const appWindow = tauri.window.appWindow;
const invoke = tauri.tauri.invoke;
const topDom = document.createElement('div');
topDom.id = 'pack-top-dom';
document.body.appendChild(topDom);
const domEl = document.getElementById('pack-top-dom');
if(!document.getElementById('pake-top-dom')){
const topDom = document.createElement('div');
topDom.id = 'pake-top-dom';
document.body.appendChild(topDom);
}
const domEl = document.getElementById('pake-top-dom');
domEl.addEventListener('touchstart', () => {
appWindow.startDragging().then();

View File

@@ -312,7 +312,7 @@ window.addEventListener('DOMContentLoaded', _event => {
}
#__next .overflow-hidden>.overflow-x-hidden .scrollbar-trigger > nav {
padding-top: 30px;
padding-top: 12px;
}
#__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.relative.flex.h-full.max-w-full.flex-1.flex-col.overflow-hidden > main > div.flex.h-full.flex-col > div.flex-1.overflow-hidden > div > div.absolute.left-0.right-0 > div > div.flex.items-center.gap-2 > button{
@@ -320,6 +320,16 @@ window.addEventListener('DOMContentLoaded', _event => {
margin-right: -10px;
}
#__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.dark.flex-shrink-0.overflow-x-hidden.bg-black > div > div > div > div > nav > div.flex.flex-col.pt-2.empty\\:hidden.dark\\:border-white\\/20 > a,
#__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.relative.flex.h-full.max-w-full.flex-1.flex-col.overflow-hidden > main > div.group.fixed.bottom-3.right-3.z-10.hidden.gap-1.lg\\:flex > div,
#__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.flex-shrink-0.overflow-x-hidden.bg-token-sidebar-surface-primary > div > div > div > div > nav > div.flex.flex-col.pt-2.empty\\:hidden.dark\\:border-white\\/20 > a {
display: none;
}
#__next .md\\:px-\\[60px\\].text-token-text-secondary.text-xs.text-center.py-2.px-2.relative{
visibility:hidden;
}
#__next>div>div>.flex.h-screen.w-full.flex-col.items-center {
padding-top: 20px;
}
@@ -373,12 +383,12 @@ window.addEventListener('DOMContentLoaded', _event => {
top: 28px;
}
#pack-top-dom:active {
#pake-top-dom:active {
cursor: grabbing;
cursor: -webkit-grabbing;
}
#pack-top-dom{
#pake-top-dom{
position:fixed;
background:transparent;
top:0;
@@ -388,7 +398,7 @@ window.addEventListener('DOMContentLoaded', _event => {
-webkit-app-region: drag;
user-select: none;
-webkit-user-select: none;
z-index: 90000;
z-index: 99999;
}
@media (max-width:767px){

View File

@@ -41,6 +41,7 @@ pub fn run_app() {
tauri_app
.plugin(windowStatePlugin::default().build())
.plugin(tauri_plugin_oauth::init())
.invoke_handler(tauri::generate_handler![
download_file,
download_file_by_binary