mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 17:41:40 -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[]) {
|
export async function saveas(...args: string[]) {
|
||||||
let overwrite = false
|
let overwrite = false
|
||||||
let cleanup = false
|
let cleanup = false
|
||||||
const uniqueArgs = new Set(args)
|
|
||||||
|
|
||||||
if (uniqueArgs.has("--overwrite")) {
|
const argParse = (args: string[]): string[] => {
|
||||||
|
if (args[0] === "--overwrite") {
|
||||||
overwrite = true
|
overwrite = true
|
||||||
uniqueArgs.delete("--overwrite")
|
args.shift()
|
||||||
|
argParse(args)
|
||||||
}
|
}
|
||||||
if (uniqueArgs.has("--cleanup")) {
|
if (args[0] === "--cleanup") {
|
||||||
cleanup = true
|
cleanup = true
|
||||||
uniqueArgs.delete("--cleanup")
|
args.shift()
|
||||||
|
argParse(args)
|
||||||
|
}
|
||||||
|
return args
|
||||||
}
|
}
|
||||||
|
|
||||||
const requiredNativeMessengerVersion = "0.3.0"
|
const file = argParse(args).join(" ") || undefined
|
||||||
if ((overwrite || cleanup) && (await Native.nativegate(requiredNativeMessengerVersion, false))) {
|
|
||||||
|
const requiredNativeMessengerVersion = "0.3.2"
|
||||||
|
if ((overwrite || cleanup) && !(await Native.nativegate(requiredNativeMessengerVersion, false))) {
|
||||||
throw new Error(`":saveas --{overwrite, cleanup}" requires native ${requiredNativeMessengerVersion} or later`)
|
throw new Error(`":saveas --{overwrite, cleanup}" requires native ${requiredNativeMessengerVersion} or later`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
const filename = await Messaging.message("download_background", "downloadUrlAs", window.location.href, [...uniqueArgs].join(" "), overwrite, cleanup)
|
const filename = await Messaging.message("download_background", "downloadUrlAs", window.location.href, file, overwrite, cleanup)
|
||||||
return fillcmdline_tmp(10000, `Download completed: ${filename} stored in ${Array.from(uniqueArgs).join(" ")}`)
|
return fillcmdline_tmp(10000, `Download completed: ${filename} stored in ${file}`)
|
||||||
} else {
|
} else {
|
||||||
return Messaging.message("download_background", "downloadUrl", window.location.href, true)
|
return Messaging.message("download_background", "downloadUrl", window.location.href, true)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue