mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -05:00
Fix missing repeated words bug and incorrect gate
This commit is contained in:
parent
df67b1c2ff
commit
28b3c3d255
1 changed files with 18 additions and 12 deletions
|
@ -904,25 +904,31 @@ export async function restart() {
|
|||
export async function saveas(...args: string[]) {
|
||||
let overwrite = false
|
||||
let cleanup = false
|
||||
const uniqueArgs = new Set(args)
|
||||
|
||||
if (uniqueArgs.has("--overwrite")) {
|
||||
const argParse = (args: string[]): string[] => {
|
||||
if (args[0] === "--overwrite") {
|
||||
overwrite = true
|
||||
uniqueArgs.delete("--overwrite")
|
||||
args.shift()
|
||||
argParse(args)
|
||||
}
|
||||
if (uniqueArgs.has("--cleanup")) {
|
||||
if (args[0] === "--cleanup") {
|
||||
cleanup = true
|
||||
uniqueArgs.delete("--cleanup")
|
||||
args.shift()
|
||||
argParse(args)
|
||||
}
|
||||
return args
|
||||
}
|
||||
|
||||
const requiredNativeMessengerVersion = "0.3.0"
|
||||
if ((overwrite || cleanup) && (await Native.nativegate(requiredNativeMessengerVersion, false))) {
|
||||
const file = argParse(args).join(" ") || undefined
|
||||
|
||||
const requiredNativeMessengerVersion = "0.3.2"
|
||||
if ((overwrite || cleanup) && !(await Native.nativegate(requiredNativeMessengerVersion, false))) {
|
||||
throw new Error(`":saveas --{overwrite, cleanup}" requires native ${requiredNativeMessengerVersion} or later`)
|
||||
}
|
||||
|
||||
if (args.length > 0) {
|
||||
const filename = await Messaging.message("download_background", "downloadUrlAs", window.location.href, [...uniqueArgs].join(" "), overwrite, cleanup)
|
||||
return fillcmdline_tmp(10000, `Download completed: ${filename} stored in ${Array.from(uniqueArgs).join(" ")}`)
|
||||
const filename = await Messaging.message("download_background", "downloadUrlAs", window.location.href, file, overwrite, cleanup)
|
||||
return fillcmdline_tmp(10000, `Download completed: ${filename} stored in ${file}`)
|
||||
} else {
|
||||
return Messaging.message("download_background", "downloadUrl", window.location.href, true)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue