mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -05:00
Fix #474: ability to open a handful of about:* pages without native
This commit is contained in:
parent
577cc6a707
commit
78cec3dd41
1 changed files with 8 additions and 3 deletions
|
@ -522,6 +522,11 @@ export async function reloadhard(n = 1) {
|
||||||
reload(n, true)
|
reload(n, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// I went through the whole list https://developer.mozilla.org/en-US/Firefox/The_about_protocol
|
||||||
|
// about:blank is even more special
|
||||||
|
/** @hidden */
|
||||||
|
export const ABOUT_WHITELIST = ["about:home", "about:license", "about:logo", "about:rights"]
|
||||||
|
|
||||||
/** Open a new page in the current tab.
|
/** Open a new page in the current tab.
|
||||||
|
|
||||||
@param urlarr
|
@param urlarr
|
||||||
|
@ -543,7 +548,7 @@ export async function open(...urlarr: string[]) {
|
||||||
url = url || undefined
|
url = url || undefined
|
||||||
browserBg.tabs.update(await activeTabId(), { url })
|
browserBg.tabs.update(await activeTabId(), { url })
|
||||||
// Open URLs that firefox won't let us by running `firefox <URL>` on the command line
|
// Open URLs that firefox won't let us by running `firefox <URL>` on the command line
|
||||||
} else if (url.match(/^(about|file):.*/)) {
|
} else if (!ABOUT_WHITELIST.includes(url) && url.match(/^(about|file):.*/)) {
|
||||||
Messaging.message("commandline_background", "recvExStr", ["nativeopen " + url])
|
Messaging.message("commandline_background", "recvExStr", ["nativeopen " + url])
|
||||||
} else if (url !== "") {
|
} else if (url !== "") {
|
||||||
window.location.href = forceURI(url)
|
window.location.href = forceURI(url)
|
||||||
|
@ -1151,7 +1156,7 @@ export async function tabopen(...addressarr: string[]) {
|
||||||
let url: string
|
let url: string
|
||||||
let address = addressarr.join(" ")
|
let address = addressarr.join(" ")
|
||||||
|
|
||||||
if (address.match(/^(about|file):.*/)) {
|
if (!ABOUT_WHITELIST.includes(address) && address.match(/^(about|file):.*/)) {
|
||||||
nativeopen(address)
|
nativeopen(address)
|
||||||
return
|
return
|
||||||
} else if (address != "") url = forceURI(address)
|
} else if (address != "") url = forceURI(address)
|
||||||
|
@ -1378,7 +1383,7 @@ export async function winopen(...args: string[]) {
|
||||||
firefoxArgs = "--private-window"
|
firefoxArgs = "--private-window"
|
||||||
} else address = args.join(" ")
|
} else address = args.join(" ")
|
||||||
createData["url"] = address != "" ? forceURI(address) : forceURI(config.get("newtab"))
|
createData["url"] = address != "" ? forceURI(address) : forceURI(config.get("newtab"))
|
||||||
if (address.match(/^(about|file):.*/)) {
|
if (!ABOUT_WHITELIST.includes(address) && address.match(/^(about|file):.*/)) {
|
||||||
nativeopen(address, firefoxArgs)
|
nativeopen(address, firefoxArgs)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue