style: fmt rust code
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -8,3 +8,4 @@ script/* linguist-vendored
|
|||||||
/icns2png.py linguist-vendored
|
/icns2png.py linguist-vendored
|
||||||
/rollup.config.js linguist-vendored
|
/rollup.config.js linguist-vendored
|
||||||
src-tauri/src/inject/* linguist-vendored
|
src-tauri/src/inject/* linguist-vendored
|
||||||
|
src-tauri/src/.pake/* linguist-vendored
|
||||||
4
bin/cli.ts
vendored
4
bin/cli.ts
vendored
@@ -38,8 +38,8 @@ program
|
|||||||
.option('--iter-copy-file', 'Copy files when URL is a local file', DEFAULT.iterCopyFile)
|
.option('--iter-copy-file', 'Copy files when URL is a local file', DEFAULT.iterCopyFile)
|
||||||
.option('--multi-arch', 'Only for Mac, supports both Intel and M1', DEFAULT.multiArch)
|
.option('--multi-arch', 'Only for Mac, supports both Intel and M1', DEFAULT.multiArch)
|
||||||
.option('--targets <string>', 'Only for Linux, option "deb" or "appimage"', DEFAULT.targets)
|
.option('--targets <string>', 'Only for Linux, option "deb" or "appimage"', DEFAULT.targets)
|
||||||
.option('--inject [injects...]', 'inject .js or .css for this app', DEFAULT.inject)
|
.option('--inject [injects...]', 'Inject .js or .css for this app', DEFAULT.inject)
|
||||||
.option('--safe-domain [domains...]', 'domains that can call window.__TAURI__ and use ipc', DEFAULT.safeDomain)
|
.option('--safe-domain [domains...]', 'Please enter the security domains that need to be configured', DEFAULT.safeDomain)
|
||||||
.option('--debug', 'Debug mode', DEFAULT.debug)
|
.option('--debug', 'Debug mode', DEFAULT.debug)
|
||||||
.version(packageJson.version, '-v, --version', 'Output the current version')
|
.version(packageJson.version, '-v, --version', 'Output the current version')
|
||||||
.action(async (url: string, options: PakeCliOptions) => {
|
.action(async (url: string, options: PakeCliOptions) => {
|
||||||
|
|||||||
5
bin/defaults.ts
vendored
5
bin/defaults.ts
vendored
@@ -22,7 +22,6 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
|
|||||||
// just for cli development
|
// just for cli development
|
||||||
export const DEFAULT_DEV_PAKE_OPTIONS: PakeCliOptions & {url: string} = {
|
export const DEFAULT_DEV_PAKE_OPTIONS: PakeCliOptions & {url: string} = {
|
||||||
...DEFAULT_PAKE_OPTIONS,
|
...DEFAULT_PAKE_OPTIONS,
|
||||||
url: 'https://zbook.lol',
|
url: 'https://weread.qq.com',
|
||||||
name: 'Zbook',
|
name: 'Weread',
|
||||||
safeDomain: ['zbook.eu.org']
|
|
||||||
}
|
}
|
||||||
2
bin/helpers/merge.ts
vendored
2
bin/helpers/merge.ts
vendored
@@ -184,7 +184,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
tauriConf.tauri.systemTray.iconPath = trayIconPath;
|
tauriConf.tauri.systemTray.iconPath = trayIconPath;
|
||||||
const injectFilePath = path.join(npmDirectory, `src-tauri/src/inject/_INJECT_.js`);
|
const injectFilePath = path.join(npmDirectory, `src-tauri/src/inject/custom.js`);
|
||||||
// inject js or css files
|
// inject js or css files
|
||||||
if (inject?.length > 0) {
|
if (inject?.length > 0) {
|
||||||
if (!inject.every(item => item.endsWith('.css') || item.endsWith('.js'))) {
|
if (!inject.every(item => item.endsWith('.css') || item.endsWith('.js'))) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Wind
|
|||||||
.initialization_script(include_str!("../inject/component.js"))
|
.initialization_script(include_str!("../inject/component.js"))
|
||||||
.initialization_script(include_str!("../inject/event.js"))
|
.initialization_script(include_str!("../inject/event.js"))
|
||||||
.initialization_script(include_str!("../inject/style.js"))
|
.initialization_script(include_str!("../inject/style.js"))
|
||||||
.initialization_script(include_str!("../inject/_INJECT_.js")); //Very annoying, otherwise dragging files to the window will not work.
|
.initialization_script(include_str!("../inject/custom.js")); //Very annoying, otherwise dragging files to the window will not work.
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
{
|
{
|
||||||
|
|||||||
0
src-tauri/src/inject/_INJECT_.js
vendored
0
src-tauri/src/inject/_INJECT_.js
vendored
2
src-tauri/src/inject/custom.js
vendored
Normal file
2
src-tauri/src/inject/custom.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// This file is used to merge the injected external js and css files
|
||||||
|
// and you can also directly add script files that you want to attach to the application in this fil
|
||||||
@@ -5,8 +5,8 @@ use tauri::{api, Config, Window};
|
|||||||
|
|
||||||
pub fn get_pake_config() -> (PakeConfig, Config) {
|
pub fn get_pake_config() -> (PakeConfig, Config) {
|
||||||
#[cfg(feature = "cli-build")]
|
#[cfg(feature = "cli-build")]
|
||||||
let pake_config: PakeConfig =
|
let pake_config: PakeConfig = serde_json::from_str(include_str!("../.pake/pake.json"))
|
||||||
serde_json::from_str(include_str!("../.pake/pake.json")).expect("Failed to parse pake config");
|
.expect("Failed to parse pake config");
|
||||||
#[cfg(not(feature = "cli-build"))]
|
#[cfg(not(feature = "cli-build"))]
|
||||||
let pake_config: PakeConfig =
|
let pake_config: PakeConfig =
|
||||||
serde_json::from_str(include_str!("../pake.json")).expect("Failed to parse pake config");
|
serde_json::from_str(include_str!("../pake.json")).expect("Failed to parse pake config");
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"package": {
|
||||||
|
"productName": "WeRead",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"security": {
|
"security": {
|
||||||
"csp": null,
|
"csp": null,
|
||||||
@@ -29,10 +33,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"package": {
|
|
||||||
"productName": "WeRead",
|
|
||||||
"version": "1.0.0"
|
|
||||||
},
|
|
||||||
"build": {
|
"build": {
|
||||||
"withGlobalTauri": true,
|
"withGlobalTauri": true,
|
||||||
"devPath": "../dist",
|
"devPath": "../dist",
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
{
|
{
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"icon": [
|
"icon": ["icons/weread.icns"],
|
||||||
"icons/icon.icns"
|
"identifier": "com.pake.weread",
|
||||||
],
|
|
||||||
"identifier": "com.pake.5b8ae9",
|
|
||||||
"active": true,
|
"active": true,
|
||||||
"category": "DeveloperTool",
|
"category": "DeveloperTool",
|
||||||
"copyright": "",
|
"copyright": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user