mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
Add setting to set a default proxy for all URLs
This commit is contained in:
parent
3966eaa3b8
commit
8dcc709b98
2 changed files with 14 additions and 1 deletions
|
@ -543,6 +543,11 @@ export class default_config {
|
|||
// "youtube.com": "google",
|
||||
})
|
||||
|
||||
/**
|
||||
* Default proxy to use for all URLs. Has to be the name of a proxy. To add a proxy, see `:help proxyadd`.
|
||||
*/
|
||||
proxy = ""
|
||||
|
||||
/**
|
||||
* Definitions of proxies.
|
||||
*
|
||||
|
|
|
@ -108,9 +108,17 @@ const getProxiesForUrl = async (url: string): Promise<ProxyInfo[]> => {
|
|||
const aucon = new AutoContain()
|
||||
const [, containerProxies] = await aucon.getAuconAndProxiesForUrl(url)
|
||||
const proxies = await getProxies()
|
||||
return Object.entries(proxies)
|
||||
const filteredProxies = Object.entries(proxies)
|
||||
.filter(([name, ]) => containerProxies.includes(name))
|
||||
.map(([, proxy]) => proxy)
|
||||
const defaultProxy = await config.getAsync("proxy")
|
||||
if (
|
||||
defaultProxy in proxies &&
|
||||
!containerProxies.includes(defaultProxy)
|
||||
) {
|
||||
filteredProxies.push(proxies[defaultProxy])
|
||||
}
|
||||
return filteredProxies
|
||||
}
|
||||
|
||||
export const onRequestListener = async (
|
||||
|
|
Loading…
Add table
Reference in a new issue