refactor: support proxy option
This commit is contained in:
1
bin/cli.ts
vendored
1
bin/cli.ts
vendored
@@ -33,6 +33,7 @@ program
|
||||
.option('--multi-arch', 'Only for Mac, supports both Intel and M1', DEFAULT.multiArch)
|
||||
.option('--inject [injects...]', 'Injection of .js or .css Files', DEFAULT.inject)
|
||||
.option('--debug', 'Debug build and more output', DEFAULT.debug)
|
||||
.option('--proxy-url', "Proxy URL", DEFAULT.proxyUrl)
|
||||
.addOption(new Option('--user-agent <string>', 'Custom user agent').default(DEFAULT.userAgent).hideHelp())
|
||||
.addOption(
|
||||
new Option('--targets <string>', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT.targets).hideHelp(),
|
||||
|
||||
1
bin/defaults.ts
vendored
1
bin/defaults.ts
vendored
@@ -16,6 +16,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
|
||||
targets: 'deb',
|
||||
useLocalFile: false,
|
||||
systemTrayIcon: '',
|
||||
proxyUrl: "",
|
||||
debug: false,
|
||||
inject: [],
|
||||
safeDomain: [],
|
||||
|
||||
3
bin/helpers/merge.ts
vendored
3
bin/helpers/merge.ts
vendored
@@ -24,6 +24,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
||||
name,
|
||||
resizable = true,
|
||||
inject,
|
||||
proxyUrl,
|
||||
} = options;
|
||||
|
||||
const { platform } = process;
|
||||
@@ -189,6 +190,8 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
||||
await fsExtra.writeFile(injectFilePath, '');
|
||||
}
|
||||
|
||||
tauriConf.pake.proxy_url = proxyUrl || "";
|
||||
|
||||
// Save config file.
|
||||
const platformConfigPaths: PlatformMap = {
|
||||
win32: 'tauri.windows.conf.json',
|
||||
|
||||
3
bin/types.ts
vendored
3
bin/types.ts
vendored
@@ -59,6 +59,9 @@ export interface PakeCliOptions {
|
||||
|
||||
/* the domain that can use ipc or tauri javascript sdk */
|
||||
safeDomain: string[];
|
||||
|
||||
// Proxy
|
||||
proxyUrl: string;
|
||||
}
|
||||
|
||||
export interface PakeAppOptions extends PakeCliOptions {
|
||||
|
||||
Reference in New Issue
Block a user