style: fmt rust code

This commit is contained in:
jeasonnow
2023-07-28 17:44:43 +08:00
parent bb5d964586
commit 7e6d302fd0
10 changed files with 17 additions and 17 deletions

1
.gitattributes vendored
View File

@@ -8,3 +8,4 @@ script/* linguist-vendored
/icns2png.py linguist-vendored
/rollup.config.js linguist-vendored
src-tauri/src/inject/* linguist-vendored
src-tauri/src/.pake/* linguist-vendored

4
bin/cli.ts vendored
View File

@@ -38,8 +38,8 @@ program
.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('--targets <string>', 'Only for Linux, option "deb" or "appimage"', DEFAULT.targets)
.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('--inject [injects...]', 'Inject .js or .css for this app', DEFAULT.inject)
.option('--safe-domain [domains...]', 'Please enter the security domains that need to be configured', DEFAULT.safeDomain)
.option('--debug', 'Debug mode', DEFAULT.debug)
.version(packageJson.version, '-v, --version', 'Output the current version')
.action(async (url: string, options: PakeCliOptions) => {

5
bin/defaults.ts vendored
View File

@@ -22,7 +22,6 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
// just for cli development
export const DEFAULT_DEV_PAKE_OPTIONS: PakeCliOptions & {url: string} = {
...DEFAULT_PAKE_OPTIONS,
url: 'https://zbook.lol',
name: 'Zbook',
safeDomain: ['zbook.eu.org']
url: 'https://weread.qq.com',
name: 'Weread',
}

View File

@@ -184,7 +184,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
}
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
if (inject?.length > 0) {
if (!inject.every(item => item.endsWith('.css') || item.endsWith('.js'))) {

View File

@@ -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/event.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")]
{

View File

2
src-tauri/src/inject/custom.js vendored Normal file
View 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

View File

@@ -5,8 +5,8 @@ use tauri::{api, Config, Window};
pub fn get_pake_config() -> (PakeConfig, Config) {
#[cfg(feature = "cli-build")]
let pake_config: PakeConfig =
serde_json::from_str(include_str!("../.pake/pake.json")).expect("Failed to parse pake config");
let pake_config: PakeConfig = serde_json::from_str(include_str!("../.pake/pake.json"))
.expect("Failed to parse pake config");
#[cfg(not(feature = "cli-build"))]
let pake_config: PakeConfig =
serde_json::from_str(include_str!("../pake.json")).expect("Failed to parse pake config");

View File

@@ -1,4 +1,8 @@
{
"package": {
"productName": "WeRead",
"version": "1.0.0"
},
"tauri": {
"security": {
"csp": null,
@@ -29,10 +33,6 @@
}
}
},
"package": {
"productName": "WeRead",
"version": "1.0.0"
},
"build": {
"withGlobalTauri": true,
"devPath": "../dist",

View File

@@ -1,10 +1,8 @@
{
"tauri": {
"bundle": {
"icon": [
"icons/icon.icns"
],
"identifier": "com.pake.5b8ae9",
"icon": ["icons/weread.icns"],
"identifier": "com.pake.weread",
"active": true,
"category": "DeveloperTool",
"copyright": "",