Skip to content

Commit

Permalink
style: fmt rust code
Browse files Browse the repository at this point in the history
  • Loading branch information
jeasonnow committed Jul 31, 2023
1 parent cf8d298 commit c4b802e
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
5 changes: 2 additions & 3 deletions bin/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
2 changes: 1 addition & 1 deletion bin/helpers/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))) {
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/app/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
{
Expand Down
Empty file removed src-tauri/src/inject/_INJECT_.js
Empty file.
2 changes: 2 additions & 0 deletions src-tauri/src/inject/custom.js
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions src-tauri/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
8 changes: 4 additions & 4 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"package": {
"productName": "WeRead",
"version": "1.0.0"
},
"tauri": {
"security": {
"csp": null,
Expand Down Expand Up @@ -29,10 +33,6 @@
}
}
},
"package": {
"productName": "WeRead",
"version": "1.0.0"
},
"build": {
"withGlobalTauri": true,
"devPath": "../dist",
Expand Down
6 changes: 2 additions & 4 deletions src-tauri/tauri.macos.conf.json
Original file line number Diff line number Diff line change
@@ -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": "",
Expand Down

0 comments on commit c4b802e

Please sign in to comment.