Fix #5015: add magic none proxy as override for autocontain
Some checks failed
e2e / test (firefox, ubuntu) (push) Has been cancelled
e2e / test (firefox, windows) (push) Has been cancelled
e2e / test (firefoxesr, ubuntu) (push) Has been cancelled
lint / lint (lint) (push) Has been cancelled
lint / lint (mozilla) (push) Has been cancelled
lint / lint (unit) (push) Has been cancelled
Website / build (push) Has been cancelled
Website / deploy (push) Has been cancelled

This commit is contained in:
Oliver Blanthorn 2024-06-30 19:03:52 +02:00
parent 507ea9d8be
commit de5a1a414f
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
2 changed files with 5 additions and 2 deletions

View file

@ -4701,7 +4701,7 @@ export function autocmd(event: string, url: string, ...excmd: string[]) {
* Pass an optional space-separated list of proxy names to assign a proxy (followed by failover proxies) to a URL and open in a specified container.
* For example: `autocontain [-{u,s}] pattern container proxy1 proxy2`
*
* To assign a proxy and open in no container, use "firefox-default" or "none" as a container name.
* To assign a proxy and open in no container, use "firefox-default" or "none" as a container name. To override [[proxy]] and use no proxy, use the special proxy 'none' e.g. `autocontain -s whatismyipaddress\.com none none`
* See also:
* - [[proxyadd]]
* - [[proxyremove]]

View file

@ -98,7 +98,7 @@ export const proxyFromUrl = (proxyUrl: string): ProxyInfo => {
export function exists(names: string[]) {
const currProxies = Object.keys(config.get("proxies"))
const missingProxies = names.filter(name => !currProxies.includes(name))
const missingProxies = names.filter(name => !currProxies.includes(name) && name !== "none")
if (missingProxies.length) {
throw new Error(
`${
@ -121,6 +121,9 @@ const getProxies = (): { [key: string]: ProxyInfo } => {
const getProxiesForUrl = async (url: string): Promise<ProxyInfo[]> => {
const aucon = new AutoContain()
const [, containerProxies] = await aucon.getAuconAndProxiesForUrl(url)
if (containerProxies[0] === "none") {
return []
}
const proxies = getProxies()
const filteredProxies = Object.entries(proxies)
.filter(([name, ]) => containerProxies.includes(name))