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
|
||||
/rollup.config.js 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('--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
5
bin/defaults.ts
vendored
@@ -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
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;
|
||||
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'))) {
|
||||
|
||||
@@ -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")]
|
||||
{
|
||||
|
||||
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) {
|
||||
#[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");
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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": "",
|
||||
|
||||
Reference in New Issue
Block a user