d6n13l0l1v3r on Nostr: #librewolf active dynamic proxy when access to onion and NWC address cat <<EOF > ...
#librewolf active dynamic proxy when access to onion and NWC address
cat <<EOF > librewolf-tor.pac
function FindProxyForURL(url, host) {
// GetAlby relay domain
var getAlbyRelay = "relay.getalby.com";
// Route WebSocket connections to GetAlby's relay through the Tor proxy
if (shExpMatch(host, getAlbyRelay)) {
return "SOCKS5 127.0.0.1:9050";
}
// Handle custom schemes like nostr+walletconnect://
// Example: nostr+walletconnect://yyyyyy?relay=wss://relay.getalby.com/v1&secret=xxxxx
if (url.indexOf("nostr+walletconnect://") === 0) {
// Extract the relay parameter from the URL
var relay = url.match(/relay=([^&]*)/);
if (relay && relay[1]) {
var relayHost = relay[1].replace("wss://", "").replace("ws://", "").replace("/v1", "");
// Route the relay host through Tor proxy
if (shExpMatch(relayHost, "relay.getalby.com")) {
return "SOCKS5 127.0.0.1:9050";
}
}
}
// Route .onion domains through the Tor proxy
if (shExpMatch(host, "*.onion")) {
return "SOCKS5 127.0.0.1:9050";
}
// For everything else, use a direct connection
return "DIRECT";
}
EOF
then add this file to proxy setting configuration
cat <<EOF > librewolf-tor.pac
function FindProxyForURL(url, host) {
// GetAlby relay domain
var getAlbyRelay = "relay.getalby.com";
// Route WebSocket connections to GetAlby's relay through the Tor proxy
if (shExpMatch(host, getAlbyRelay)) {
return "SOCKS5 127.0.0.1:9050";
}
// Handle custom schemes like nostr+walletconnect://
// Example: nostr+walletconnect://yyyyyy?relay=wss://relay.getalby.com/v1&secret=xxxxx
if (url.indexOf("nostr+walletconnect://") === 0) {
// Extract the relay parameter from the URL
var relay = url.match(/relay=([^&]*)/);
if (relay && relay[1]) {
var relayHost = relay[1].replace("wss://", "").replace("ws://", "").replace("/v1", "");
// Route the relay host through Tor proxy
if (shExpMatch(relayHost, "relay.getalby.com")) {
return "SOCKS5 127.0.0.1:9050";
}
}
}
// Route .onion domains through the Tor proxy
if (shExpMatch(host, "*.onion")) {
return "SOCKS5 127.0.0.1:9050";
}
// For everything else, use a direct connection
return "DIRECT";
}
EOF
then add this file to proxy setting configuration
