Socket
Socket
Sign inDemoInstall

pake-cli

Package Overview
Dependencies
Maintainers
2
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pake-cli - npm Package Compare versions

Comparing version 1.0.0-beta.1 to 1.0.0

src-tauri/assets/main.wxs

156

dist/cli.js

@@ -9,2 +9,3 @@ import * as Commander from 'commander';

import fs from 'fs/promises';
import chalk from 'chalk';
import crypto from 'crypto';

@@ -14,3 +15,2 @@ import axios from 'axios';

import { dir } from 'tmp-promise';
import chalk from 'chalk';
import ora from 'ora';

@@ -1598,2 +1598,20 @@ import shelljs from 'shelljs';

const logger = {
info(...msg) {
log.info(...msg.map((m) => chalk.blue.bold(m)));
},
debug(...msg) {
log.debug(...msg);
},
error(...msg) {
log.error(...msg.map((m) => chalk.red.bold(m)));
},
warn(...msg) {
log.info(...msg.map((m) => chalk.yellow.bold(m)));
},
success(...msg) {
log.info(...msg.map((m) => chalk.green.bold(m)));
}
};
function promptText(message, initial) {

@@ -1623,14 +1641,39 @@ return __awaiter(this, void 0, void 0, function* () {

tauriConf.tauri.bundle.identifier = identifier;
tauriConf.tauri.bundle.icon = [options.icon];
if (process.platform === "win32") {
const ico_path = path.join(npmDirectory, 'src-tauri/png/weread_32.ico');
yield fs.copyFile(options.icon, ico_path);
const exists = yield fs.stat(options.icon)
.then(() => true)
.catch(() => false);
if (exists) {
let updateIconPath = true;
let customIconExt = path.extname(options.icon).toLowerCase();
if (process.platform === "win32") {
if (customIconExt === ".ico") {
const ico_path = path.join(npmDirectory, `src-tauri/png/${name.toLowerCase()}_32.ico`);
tauriConf.tauri.bundle.resources = [`png/${name.toLowerCase()}_32.ico`];
yield fs.copyFile(options.icon, ico_path);
}
else {
updateIconPath = false;
logger.warn(`icon file in Windows must be 256 * 256 pix with .ico type, but you give ${customIconExt}`);
}
}
if (process.platform === "linux") {
delete tauriConf.tauri.bundle.deb.files;
if (customIconExt != ".png") {
updateIconPath = false;
logger.warn(`icon file in Linux must be 512 * 512 pix with .png type, but you give ${customIconExt}`);
}
}
if (process.platform === "darwin" && customIconExt !== ".icns") {
updateIconPath = false;
logger.warn(`icon file in MacOS must be .icns type, but you give ${customIconExt}`);
}
if (updateIconPath) {
tauriConf.tauri.bundle.icon = [options.icon];
}
else {
logger.warn(`icon file will not change with default.`);
}
}
if (process.platform === "linux") {
const installSrc = `/usr/share/applications/${name}.desktop`;
const assertSrc = `src-tauri/assets/${name}.desktop`;
const assertPath = path.join(npmDirectory, assertSrc);
tauriConf.tauri.bundle.deb.files = {
[installSrc]: assertPath
};
else {
logger.warn("the custom icon path may not exists. we will use default icon to replace it");
}

@@ -1666,19 +1709,5 @@ let configPath = "";

const logger = {
info(...msg) {
log.info(...msg.map((m) => chalk.blue.bold(m)));
},
debug(...msg) {
log.debug(...msg);
},
error(...msg) {
log.error(...msg.map((m) => chalk.red.bold(m)));
},
warn(...msg) {
log.info(...msg.map((m) => chalk.yellow.bold(m)));
},
success(...msg) {
log.info(...msg.map((m) => chalk.green.bold(m)));
}
};
const IS_MAC = process.platform === 'darwin';
const IS_WIN = process.platform === 'win32';
const IS_LINUX = process.platform === 'linux';

@@ -1696,11 +1725,17 @@ function handleIcon(options, url) {

if (!options.icon) {
return inferIcon(options.name);
return getDefaultIcon();
}
});
}
function inferIcon(name, url) {
function getDefaultIcon() {
return __awaiter(this, void 0, void 0, function* () {
logger.info('You have not provided an app icon, use the default icon.(use --icon option to assign an icon)');
const npmDirectory = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
return path.join(npmDirectory, 'pake-default.icns');
let iconPath = 'src-tauri/icons/icon.icns';
if (IS_WIN) {
iconPath = 'src-tauri/png/icon_256.ico';
}
else if (IS_LINUX) {
iconPath = 'src-tauri/png/icon_512.png';
}
return path.join(npmDirectory, iconPath);
});

@@ -1781,6 +1816,2 @@ }

const IS_MAC = process.platform === 'darwin';
const IS_WIN = process.platform === 'win32';
const IS_LINUX = process.platform === 'linux';
function shellExec(command) {

@@ -1826,3 +1857,3 @@ return new Promise((resolve, reject) => {

width: 1200,
height: 728,
height: 780,
resizable: true

@@ -1880,3 +1911,4 @@ }

"en-US"
]
],
template: "assets/main.wxs"
}

@@ -1954,3 +1986,4 @@ }

targets: [
"deb"
"deb",
"appimage"
]

@@ -2008,3 +2041,3 @@ }

yield mergeTauriConfig(url, options, tauriConf);
yield shellExec(`cd ${npmDirectory} && npm install && npm run build:release`);
yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
let arch = "x64";

@@ -2059,3 +2092,3 @@ if (process.arch === "arm64") {

yield mergeTauriConfig(url, options, tauriConf);
yield shellExec(`cd ${npmDirectory} && npm install && npm run build:release`);
yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
const language = tauriConf.tauri.bundle.windows.wix.language[0];

@@ -2105,18 +2138,3 @@ const arch = process.arch;

yield mergeTauriConfig(url, options, tauriConf);
// write desktop
const assertSrc = `src-tauri/assets/${name}.desktop`;
const assertPath = path.join(npmDirectory, assertSrc);
const desktopStr = `
[Desktop Entry]
Encoding=UTF-8
Categories=Office
Exec=${name}
Icon=${name}
Name=${name}
StartupNotify=true
Terminal=false
Type=Application
`;
yield fs.writeFile(assertPath, desktopStr);
yield shellExec(`cd ${npmDirectory} && npm install && npm run build:release`);
yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
let arch = "";

@@ -2130,12 +2148,18 @@ if (process.arch === "x64") {

const debName = `${name}_${tauriConf.package.version}_${arch}.deb`;
const appPath = this.getBuildedAppPath(npmDirectory, debName);
const appPath = this.getBuildedAppPath(npmDirectory, "deb", debName);
const distPath = path.resolve(`${name}.deb`);
yield fs.copyFile(appPath, distPath);
yield fs.unlink(appPath);
const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`;
const appImagePath = this.getBuildedAppPath(npmDirectory, "appimage", appImageName);
const distAppPath = path.resolve(`${name}.AppImage`);
yield fs.copyFile(appImagePath, distAppPath);
yield fs.unlink(appImagePath);
logger.success('Build success!');
logger.success('You can find the app installer in', distPath);
logger.success('You can find the deb app installer in', distPath);
logger.success('You can find the Appimage app installer in', distAppPath);
});
}
getBuildedAppPath(npmDirectory, dmgName) {
return path.join(npmDirectory, 'src-tauri/target/release/bundle/deb', dmgName);
getBuildedAppPath(npmDirectory, packageType, packageName) {
return path.join(npmDirectory, 'src-tauri/target/release/bundle/', packageType, packageName);
}

@@ -2146,3 +2170,2 @@ }

static create() {
console.log("now platform is ", process.platform);
if (IS_MAC) {

@@ -2162,3 +2185,3 @@ return new MacBuilder();

var name = "pake-cli";
var version = "1.0.0-beta.1";
var version = "0.1.2";
var description = "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.";

@@ -2179,4 +2202,3 @@ var bin = {

"src-tauri",
"cli.js",
"pake-default.icns"
"cli.js"
];

@@ -2187,3 +2209,3 @@ var scripts = {

"dev:debug": "npm run tauri dev -- --features devtools",
"build:release": "npm run tauri build --release",
build: "npm run tauri build --release",
"build:all-unix": "chmod +x ./script/build.sh && ./script/build.sh",

@@ -2190,0 +2212,0 @@ "build:all-windows": ".\\script\\build.bat",

{
"name": "pake-cli",
"version": "1.0.0-beta.1",
"version": "1.0.0",
"description": "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.",
"engines": {
"node": "^14.13 || >=16.0.0"
},
"bin": {

@@ -16,7 +19,14 @@ "pake": "./cli.js"

},
"keywords": [
"pake",
"pake-cli",
"rust",
"tauri",
"no-electron",
"productivity"
],
"files": [
"dist",
"src-tauri",
"cli.js",
"pake-default.icns"
"cli.js"
],

@@ -27,3 +37,4 @@ "scripts": {

"dev:debug": "npm run tauri dev -- --features devtools",
"build:release": "npm run tauri build --release",
"build": "npm run tauri build --release",
"build:mac": "npm run tauri build -- --target universal-apple-darwin",
"build:all-unix": "chmod +x ./script/build.sh && ./script/build.sh",

@@ -41,3 +52,3 @@ "build:all-windows": ".\\script\\build.bat",

"@tauri-apps/api": "^1.2.0",
"@tauri-apps/cli": "^1.2.1",
"@tauri-apps/cli": "^1.2.2",
"axios": "^1.1.3",

@@ -44,0 +55,0 @@ "chalk": "^5.1.2",

<p align="left"><strong>中文</strong> | <a href="https://github.com/tw93/Pake/blob/master/README_EN.md">English</a></p>
<p align="center">
<img src=https://gw.alipayobjects.com/zos/k/fa/logo-modified.png width=138/>
</p>
<h1 align="center">Pake</h1>

@@ -17,13 +18,12 @@ <div align="center">

</div>
<div align="left">很简单的用 Rust 打包网页生成很小的桌面 App,支持 Mac / Windows / Linux 系统,常用包下载、<a href="#命令行打包">命令行一键打包</a>、<a href="#开发">定制开发</a> 可见下面文档,也欢迎去 <a href=https://github.com/tw93/Pake/discussions>讨论区</a> 交流。</div>
</p>
<div align="left">很简单的用 Rust 打包网页生成很小的桌面 App,支持 Mac / Windows / Linux 系统,常用包下载、<a href="#命令行一键打包">命令行一键打包</a>、<a href="#定制开发">定制开发</a> 可见下面文档,也欢迎去 <a href=https://github.com/tw93/Pake/discussions>讨论区</a> 交流。</div>
## 特征
🏂 **小**:相比传统的 Electron 套壳打包,要小将近 40 倍,不到 3M
😂 **快**:Pake 的底层使用的 Rust Tauri 框架,性能体验较 JS 框架要轻快不少,内存小很多
🩴 **特**:不是单纯打包,实现了快捷键的透传、沉浸式的窗口、拖动、样式改写、去广告、产品的极简风格定制
🐶 **玩**:只是一个很简单的小玩具,用 Rust 替代之前套壳网页打包的老思路,其实 PWA 也很好
🏂 **小**:相比传统的 Electron 套壳打包,要小将近 40 倍,不到 3M。
😂 **快**:Pake 的底层使用的 Rust Tauri 框架,性能体验较 JS 框架要轻快不少,内存小很多。
🩴 **特**:不是单纯打包,实现了快捷键的透传、沉浸式的窗口、拖动、样式改写、去广告、产品的极简风格定制。
🐶 **玩**:只是一个很简单的小玩具,用 Rust 替代之前套壳网页打包的老思路,其实 PWA 也很好。
## 下载
## 常用包下载

@@ -34,9 +34,9 @@ <table>

<a href="https://github.com/tw93/Pake/releases/latest/download/WeRead.dmg">Mac</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/WeRead_x64.msi">Windows</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/WeRead_amd64.deb">Linux</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/WeRead_x64.msi">Windows</a>
</td>
<td>Twitter
<a href="https://github.com/tw93/Pake/releases/latest/download/Twitter.dmg">Mac</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Twitter_x64.msi">Windows</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Twitter_amd64.deb">Linux</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Twitter_x64.msi">Windows</a>
</td>

@@ -49,16 +49,16 @@ </tr>

<tr>
<td>YouTube
<td>LiZhi
<a href="https://github.com/tw93/Pake/releases/latest/download/LiZhi.dmg">Mac</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/LiZhi_x64.msi">Windows</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/LiZhi_amd64.deb">Linux</a>
</td>
<td>YouTube
<a href="https://github.com/tw93/Pake/releases/latest/download/YouTube.dmg">Mac</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/YouTube_x64.msi">Windows</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/YouTube_amd64.deb">Linux</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/YouTube_x64.msi">Windows</a>
</td>
<td>Reference
<a href="https://github.com/tw93/Pake/releases/latest/download/Reference.dmg">Mac</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Reference_amd64.deb">Linux</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Reference_x64.msi">Windows</a>
</td>
</tr>
<tr>
<td><img src=https://cdn.fliggy.com/upic/DX3dfG.png width=600/></td>
<td><img src=https://cdn.fliggy.com/upic/Ea5ZRw.png width=600/></td>
<td><img src=https://cdn.fliggy.com/upic/KFsZIY.png width=600/></td>
</tr>

@@ -68,9 +68,9 @@ <tr>

<a href="https://github.com/tw93/Pake/releases/latest/download/Code.dmg">Mac</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Code_x64.msi">Windows</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Code_amd64.deb">Linux</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Code_x64.msi">Windows</a>
</td>
<td>Qwerty
<a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty.dmg">Mac</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty_amd64.deb">Linux</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty_x64.msi">Windows</a>
<td>Reference
<a href="https://github.com/tw93/Pake/releases/latest/download/Reference.dmg">Mac</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Reference_x64.msi">Windows</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Reference_amd64.deb">Linux</a>
</td>

@@ -80,30 +80,55 @@ </tr>

<td><img src=https://cdn.fliggy.com/upic/EB1OYP.jpg width=600/></td>
<td><img src=https://cdn.fliggy.com/upic/FGdQec.png width=600/></td>
<td><img src=https://cdn.fliggy.com/upic/KFsZIY.png width=600/></td>
</tr>
<tr>
<td>Flomo
<a href="https://github.com/tw93/Pake/releases/latest/download/Flomo.dmg">Mac</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Flomo_amd64.deb">Linux</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Flomo_x64.msi">Windows</a>
<tr>
<td>Qwerty
<a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty.dmg">Mac</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty_x64.msi">Windows</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty_amd64.deb">Linux</a>
</td>
<td>YuQue
<a href="https://github.com/tw93/Pake/releases/latest/download/YuQue.dmg">Mac</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/YuQue_amd64.deb">Linux</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/YuQue_x64.msi">Windows</a>
<td>ChatGPT
<a href="https://github.com/tw93/Pake/releases/latest/download/ChatGPT.dmg">Mac</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/ChatGPT_x64.msi">Windows</a>
<a href="https://github.com/tw93/Pake/releases/latest/download/ChatGPT_amd64.deb">Linux</a>
</td>
</tr>
<tr>
<td><img src=https://cdn.fliggy.com/upic/jg9Eeu.jpg width=600/></td>
<td><img src=https://cdn.fliggy.com/upic/02SZQl.png width=600/></td>
<td><img src=https://cdn.fliggy.com/upic/CJjagn.jpg width=600/></td>
<td><img src=https://cdn.fliggy.com/upic/sfnTXf.png width=600/></td>
</tr>
</table>
注意:Windows 下不能安装到 `C:\Program File`,会直接闪退,建议安装到其他非管理员权限目录,比如 `D:\Program Files (x86)` 。
<details>
对于轻度使用用户,使用 **GitHub Actions 在线编译多系统版本** 也是一个不错的选择,可查看[文档](/docs/README.md)。
<summary>🏂 更多应用如 Flomo / 语雀可去 <a href="https://github.com/tw93/Pake/releases">Release</a>下载,<b>此外点击可展开快捷键说明</b></summary>
## 命令行打包
<br/>
| 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>r</kbd> | <kbd>Ctrl</kbd> + <kbd>r</kbd> | 刷新页面 |
| <kbd>⌘</kbd> + <kbd>w</kbd> | <kbd>Ctrl</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>=</kbd> | <kbd>Ctrl</kbd> + <kbd>=</kbd> | 放大页面 |
| <kbd>⌘</kbd> + <kbd>0</kbd> | <kbd>Ctrl</kbd> + <kbd>0</kbd> | 重置页面缩放 |
此外还支持双击头部进行全屏切换,拖拽头部进行移动窗口,Mac 用户支持手势方式返回和去下一页,还有其他需求,欢迎提过来。
</details>
## 开始之前
1. **小白用户**:使用 「常用包下载」 方式来把玩 Pake 的能力,可去 [讨论群](https://github.com/tw93/Pake/discussions) 寻求帮助,也可试试 [Action](https://github.com/tw93/Pake/wiki/GitHub-Actions-%E5%9C%A8%E7%BA%BF%E7%BC%96%E8%AF%91%E5%A4%9A%E7%B3%BB%E7%BB%9F%E7%89%88%E6%9C%AC) 方式。
2. **开发用户**:使用 「命令行一键打包」,对 Mac 比较友好,Windows / Linux 需折腾下 [环境配置](https://tauri.app/v1/guides/getting-started/prerequisites)。
3. **折腾用户**:假如你前端和 Rust 都会,那可试试下面的 「[定制开发](#定制开发)」,可深度二次开发定制你的功能。
## 命令行一键打包
<kbd>
<img src="https://cdn.fliggy.com/upic/cOC1lF.gif" width="100%">
<img src="https://gw.alipayobjects.com/zos/k/zd/pake.gif" width="100%">
</kbd>

@@ -125,23 +150,8 @@ <br/><br/>

## 快捷键
假如你不太会使用命令行,或许使用 **GitHub Actions 在线编译多系统版本** 是一个不错的选择,可查看 [文档](https://github.com/tw93/Pake/wiki/GitHub-Actions-%E5%9C%A8%E7%BA%BF%E7%BC%96%E8%AF%91%E5%A4%9A%E7%B3%BB%E7%BB%9F%E7%89%88%E6%9C%AC)。
| 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>r</kbd> | <kbd>Ctrl</kbd> + <kbd>r</kbd> | 刷新页面 |
| <kbd>⌘</kbd> + <kbd>w</kbd> | <kbd>Ctrl</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>=</kbd> | <kbd>Ctrl</kbd> + <kbd>=</kbd> | 放大页面 |
| <kbd>⌘</kbd> + <kbd>0</kbd> | <kbd>Ctrl</kbd> + <kbd>0</kbd> | 重置页面缩放 |
## 定制开发
此外还支持双击头部进行全屏切换,拖拽头部进行移动窗口,还有其他需求,欢迎提过来。
开始前请确保电脑已经安装了 Rust 和 Node 的环境,此外需参考 [Tauri 文档](https://tauri.app/v1/guides/getting-started/prerequisites) 快速配置好环境才可以开始使用,假如你太不懂,使用上面的命令行打包会更加合适。
## 开发
开始前参考 [Tauri](https://tauri.app/v1/guides/getting-started/prerequisites) 快速配置好环境。
```sh

@@ -151,31 +161,20 @@ // 安装依赖

// 调试
// 本地开发
npm run dev
// 本地调试
npm run dev:debug
// 打包应用
npm run build:release
npm run build
```
## 打新包
## 高级使用
1. 修改 `src-tauri` 目录下的 `tauri.conf.json` 中的 `url、productName、icon、identifier` 这 4 个字段,其中 icon 可以从 icons 目录选择一个,也可以去 [macOSicons](https://macosicons.com/#/) 下载符合产品名称的
2. 关于窗口属性设置,可以在 `tauri.conf.json` 修改 `windows` 属性对应的 `width/height`,是否全屏 `fullscreen`,是否可以调整大小 `resizable`,假如想适配 Mac 沉浸式头部,可以将 `transparent` 设置成 `true`,找到 Header 元素加一个 `padding-top` 样式即可,不想适配改成 `false` 也行
3. `npm run dev` 本地调试看看效果,此外可以使用 `npm run dev:debug` 进行容器调试
4. `npm run build` 运行即可打生产包
1. 代码结构可参考 [文档](https://github.com/tw93/Pake/wiki/Pake-%E7%9A%84%E4%BB%A3%E7%A0%81%E7%BB%93%E6%9E%84%E8%AF%B4%E6%98%8E),便于你在开发前了解更多。
2. 修改 src-tauri 目录下的 `tauri.conf.json`以及 `tauri.xxx.conf.json` 中的 url、productName、icon、identifier 这 4 个字段,其中 icon 可以从 icons 目录选择一个,也可以去 [macOSicons](https://macosicons.com/#/) 下载符合效果的。
3. 关于窗口属性设置,可以在 `tauri.conf.json` 修改 windows 属性对应的 `width/height`,fullscreen 是否全屏,resizable 是否可以调整大小,假如想适配 Mac 沉浸式头部,可以将 transparent 设置成 `true`,找到 Header 元素加一个 padding-top 样式即可,不想适配改成 `false` 也行。
4. 此外样式改写、屏蔽广告、逻辑代码注入、容器消息通信、自定义快捷键可见 [高级用法](https://github.com/tw93/Pake/wiki/Pake-%E7%9A%84%E9%AB%98%E7%BA%A7%E7%94%A8%E6%B3%95)。
## 高级用法
#### 1. 如何改写样式,如去掉原站广告、不想要的模块、甚至重新设计?
首先需要使用 `npm run dev:debug` 打开 devtools 调试模式,找到你需要修改的样式名称,先在 devtools 里面验证效果;找到 `pake.js` 中样式位置 `style.innerHTML` ,将需要覆盖的样式加上即可,有一些案例你可以模仿。
#### 2. 如何注入 JS 的逻辑,比如实现事件监听,比如说键盘快捷键?
参考 `pake.js` 中事件监听 `document.addEventListener`,直接编写即可,这里更多是基础前端的技术。
#### 3. 如何进行容器内的事件和 Pake 通信,比如说 Web 的拖拽、滚动、特殊点击传递啥的?
参考 `pake.js` 中通信代码 `postMessage`,写好事件监听,然后用 `window.ipc.postMessage` 将事件以及参数传递出来,然后参考容器接收事件 `window.drag_window`,自己处理即可,更多可以参考 tauri 以及 wry 的官方文档。
## 开发者

@@ -217,13 +216,13 @@

<td align="center">
<a href="https://github.com/essesoul">
<img src="https://avatars.githubusercontent.com/u/58624474?v=4" width="90;" alt="essesoul"/>
<a href="https://github.com/liby">
<img src="https://avatars.githubusercontent.com/u/38807139?v=4" width="90;" alt="liby"/>
<br />
<sub><b>Essesoul</b></sub>
<sub><b>Bryan Lee</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/liby">
<img src="https://avatars.githubusercontent.com/u/38807139?v=4" width="90;" alt="liby"/>
<a href="https://github.com/essesoul">
<img src="https://avatars.githubusercontent.com/u/58624474?v=4" width="90;" alt="essesoul"/>
<br />
<sub><b>Bryan Lee</b></sub>
<sub><b>Essesoul</b></sub>
</a>

@@ -240,2 +239,9 @@ </td>

<td align="center">
<a href="https://github.com/AielloChan">
<img src="https://avatars.githubusercontent.com/u/7900765?v=4" width="90;" alt="AielloChan"/>
<br />
<sub><b>Aiello</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/QingZ11">

@@ -255,9 +261,23 @@ <img src="https://avatars.githubusercontent.com/u/38887077?v=4" width="90;" alt="QingZ11"/>

<td align="center">
<a href="https://github.com/AielloChan">
<img src="https://avatars.githubusercontent.com/u/7900765?v=4" width="90;" alt="AielloChan"/>
<a href="https://github.com/nekomeowww">
<img src="https://avatars.githubusercontent.com/u/11081491?v=4" width="90;" alt="nekomeowww"/>
<br />
<sub><b>Aiello</b></sub>
<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/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/houhoz">

@@ -268,3 +288,4 @@ <img src="https://avatars.githubusercontent.com/u/19684376?v=4" width="90;" alt="houhoz"/>

</a>
</td>
</td></tr>
<tr>
<td align="center">

@@ -289,9 +310,5 @@ <a href="https://github.com/liusishan">

- 我有两只猫,一只叫汤圆,一只叫可乐,假如觉得 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~) 给你志同道合的朋友使用。
- 可以关注我的 [Twitter](https://twitter.com/HiTw93) 获取到最新的 Pake 更新消息,也欢迎加入 [Telegram](https://t.me/miaoyan) 聊天群。
## 最后
1. 希望大伙玩的过程中有一种学习新技术的喜悦感,如果有新点子欢迎告诉我
2. 假如你发现有很适合做成桌面 App 的网页也很欢迎告诉我,我给加到里面来
1. 我有两只猫,一只叫汤圆,一只叫可乐,假如觉得 Pake 让你生活更美好,可以给汤圆可乐 <a href="https://miaoyan.app/cats.html?name=Pake" target="_blank">喂罐头 🥩🍤</a>。
2. 如果你喜欢 Pake,可以在 Github Star,更欢迎 [推荐](https://twitter.com/intent/tweet?url=https://github.com/tw93/Pake&text=%23Pake%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~) 给你志同道合的朋友使用。
3. 可以关注我的 [Twitter](https://twitter.com/HiTw93) 获取到最新的 Pake 更新消息,也欢迎加入 [Telegram](https://t.me/miaoyan) 聊天群。
4. 希望大伙玩的过程中有一种学习新技术的喜悦感,假如你发现有很适合做成桌面 App 的网页也很欢迎告诉我。

@@ -58,2 +58,14 @@ /**

#__next .overflow-hidden .flex.flex-1.flex-col {
padding-left: 0;
}
#__next .overflow-hidden>.hidden.bg-gray-900 {
display: none;
}
#__next .overflow-hidden main .absolute .text-xs{
visibility: hidden;
}
.lark > .dashboard-sidebar, .lark > .dashboard-sidebar > .sidebar-user-info , .lark > .dashboard-sidebar .index-module_wrapper_F-Wbq{

@@ -204,6 +216,4 @@ padding-top:15px;

#react-root [data-testid="SideNav_NewTweet_Button"] {
position: fixed !important;
right: 16px !important;
bottom: 24px !important;
#react-root [data-testid="SideNav_NewTweet_Button"], #react-root [aria-label="Twitter Blue"]{
display: none;
}

@@ -311,12 +321,12 @@ }

if (origin && origin.href) {
const target = origin.target
origin.target = "_self";
const hrefUrl = new URL(origin.href)
//额外处理下 twitter 的外跳,对于其他需要外跳的可以改这里成对应域名
const href = origin.href;
if (
location.host === "twitter.com" &&
href.indexOf("twitter.com") === -1
window.location.host !== hrefUrl.host && // 如果 a 标签内链接的域名和当前页面的域名不一致 且
target === '_blank' // a 标签内链接的 target 属性为 _blank 时
) {
e.preventDefault();
window.ipc.postMessage(`open_browser:${href}`);
window.ipc.postMessage(`open_browser:${origin.href}`);
}

@@ -323,0 +333,0 @@ }

@@ -13,3 +13,3 @@ {

"width": 1200,
"height": 728,
"height": 780,
"resizable": true

@@ -16,0 +16,0 @@ }

@@ -21,3 +21,5 @@ {

"libayatana-appindicator3-dev",
"librsvg2-dev"
"librsvg2-dev",
"gnome-video-effects",
"gnome-video-effects-extra"
],

@@ -32,5 +34,5 @@ "files": {

"shortDescription": "",
"targets": ["deb"]
"targets": ["deb", "appimage"]
}
}
}

@@ -22,3 +22,4 @@ {

"wix": {
"language": ["en-US"]
"language": ["en-US"],
"template": "assets/main.wxs"
}

@@ -25,0 +26,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc