Fix proxy connection race condition and remove Arweave source
This commit is contained in:
parent
bb621d1ba1
commit
e79b52490e
@ -130,9 +130,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="setting-control">
|
<div class="setting-control">
|
||||||
<select class="select" id="proxy-source">
|
<select class="select" id="proxy-source">
|
||||||
<option value="arweave">Arweave</option>
|
|
||||||
<option value="git">GitBros</option>
|
|
||||||
<option value="github">GitHub</option>
|
<option value="github">GitHub</option>
|
||||||
|
<option value="git">GitBros</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -317,7 +317,7 @@ async function handleNextProxy() {
|
|||||||
* @param {string} source - Proxy source
|
* @param {string} source - Proxy source
|
||||||
* @returns {Promise<object>}
|
* @returns {Promise<object>}
|
||||||
*/
|
*/
|
||||||
async function handleFetchProxies(source = 'arweave') {
|
async function handleFetchProxies(source = 'github') {
|
||||||
const result = await ProxyManager.fetchProxyList(source);
|
const result = await ProxyManager.fetchProxyList(source);
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
|||||||
15
js/config.js
15
js/config.js
@ -18,26 +18,21 @@ const CONFIG = {
|
|||||||
WEBRTC_PROTECTION: false,
|
WEBRTC_PROTECTION: false,
|
||||||
KILL_SWITCH: false,
|
KILL_SWITCH: false,
|
||||||
BYPASS_LOCAL: true,
|
BYPASS_LOCAL: true,
|
||||||
PROXY_SOURCE: 'arweave',
|
PROXY_SOURCE: 'github',
|
||||||
UPDATE_INTERVAL: 0 // manual only
|
UPDATE_INTERVAL: 0 // manual only
|
||||||
},
|
},
|
||||||
|
|
||||||
// Proxy Sources
|
// Proxy Sources
|
||||||
PROXY_SOURCES: {
|
PROXY_SOURCES: {
|
||||||
arweave: {
|
github: {
|
||||||
name: 'Arweave',
|
name: 'GitHub',
|
||||||
url: 'https://arweave.net/FjxfWIbSnZb7EaJWbeuWCsBBFWjTppfS3_KHxUP__B8',
|
url: 'https://raw.githubusercontent.com/DeBrosDAO/anyone-proxy-list/refs/heads/main/anonproxies.json',
|
||||||
icon: 'AR'
|
icon: 'GH'
|
||||||
},
|
},
|
||||||
git: {
|
git: {
|
||||||
name: 'GitBros',
|
name: 'GitBros',
|
||||||
url: 'https://git.debros.io/DeBros/anyone-proxy-list/raw/branch/main/anonproxies.json',
|
url: 'https://git.debros.io/DeBros/anyone-proxy-list/raw/branch/main/anonproxies.json',
|
||||||
icon: 'GIT'
|
icon: 'GIT'
|
||||||
},
|
|
||||||
github: {
|
|
||||||
name: 'GitHub',
|
|
||||||
url: 'https://raw.githubusercontent.com/DeBrosOfficial/anyone-proxy-list/refs/heads/main/anonproxies.json',
|
|
||||||
icon: 'GH'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -284,19 +284,16 @@ async function handleProxySourceChange() {
|
|||||||
|
|
||||||
function updateSourceNameDisplay(source) {
|
function updateSourceNameDisplay(source) {
|
||||||
const names = {
|
const names = {
|
||||||
git: 'GitBros',
|
|
||||||
github: 'GitHub',
|
github: 'GitHub',
|
||||||
arweave: 'Arweave'
|
git: 'GitBros'
|
||||||
};
|
};
|
||||||
const urls = {
|
const urls = {
|
||||||
git: 'git.debros.io/DeBros/anyone-proxy-list',
|
github: 'github.com/DeBrosDAO/anyone-proxy-list',
|
||||||
github: 'github.com/DeBrosOfficial/anyone-proxy-list',
|
git: 'git.debros.io/DeBros/anyone-proxy-list'
|
||||||
arweave: 'arweave.net/FjxfWIbS...B8'
|
|
||||||
};
|
};
|
||||||
const fullUrls = {
|
const fullUrls = {
|
||||||
git: 'https://git.debros.io/DeBros/anyone-proxy-list',
|
github: 'https://github.com/DeBrosDAO/anyone-proxy-list',
|
||||||
github: 'https://github.com/DeBrosOfficial/anyone-proxy-list',
|
git: 'https://git.debros.io/DeBros/anyone-proxy-list'
|
||||||
arweave: 'https://arweave.net/FjxfWIbSnZb7EaJWbeuWCsBBFWjTppfS3_KHxUP__B8'
|
|
||||||
};
|
};
|
||||||
const externalIcon = `<svg class="icon-external" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
const externalIcon = `<svg class="icon-external" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||||
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>
|
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>
|
||||||
@ -395,14 +392,14 @@ async function refreshProxies() {
|
|||||||
const originalText = elements.btnRefreshProxies.innerHTML;
|
const originalText = elements.btnRefreshProxies.innerHTML;
|
||||||
elements.btnRefreshProxies.innerHTML = '<span>Refreshing...</span>';
|
elements.btnRefreshProxies.innerHTML = '<span>Refreshing...</span>';
|
||||||
|
|
||||||
const source = elements.proxySource.value || 'arweave';
|
const source = elements.proxySource.value || 'github';
|
||||||
const response = await sendMessage({ action: 'fetchProxies', source });
|
const response = await sendMessage({ action: 'fetchProxies', source });
|
||||||
|
|
||||||
elements.btnRefreshProxies.disabled = false;
|
elements.btnRefreshProxies.disabled = false;
|
||||||
elements.btnRefreshProxies.innerHTML = originalText;
|
elements.btnRefreshProxies.innerHTML = originalText;
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
const sourceNames = { arweave: 'Arweave', git: 'GitBros', github: 'GitHub' };
|
const sourceNames = { github: 'GitHub', git: 'GitBros' };
|
||||||
const usedName = sourceNames[response.usedSource] || response.usedSource;
|
const usedName = sourceNames[response.usedSource] || response.usedSource;
|
||||||
|
|
||||||
if (response.usedSource && response.usedSource !== source) {
|
if (response.usedSource && response.usedSource !== source) {
|
||||||
|
|||||||
@ -529,7 +529,7 @@ async function refreshProxies() {
|
|||||||
|
|
||||||
// Get the stored proxy source setting
|
// Get the stored proxy source setting
|
||||||
const settings = await sendMessage({ action: 'getSettings' });
|
const settings = await sendMessage({ action: 'getSettings' });
|
||||||
const source = settings.settings?.proxySource || 'arweave';
|
const source = settings.settings?.proxySource || 'github';
|
||||||
|
|
||||||
const response = await sendMessage({ action: 'fetchProxies', source });
|
const response = await sendMessage({ action: 'fetchProxies', source });
|
||||||
|
|
||||||
@ -539,7 +539,7 @@ async function refreshProxies() {
|
|||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
// Show which source was used (especially if fallback occurred)
|
// Show which source was used (especially if fallback occurred)
|
||||||
const sourceNames = { arweave: 'Arweave', git: 'GitBros', github: 'GitHub' };
|
const sourceNames = { github: 'GitHub', git: 'GitBros' };
|
||||||
const usedName = sourceNames[response.usedSource] || response.usedSource;
|
const usedName = sourceNames[response.usedSource] || response.usedSource;
|
||||||
|
|
||||||
if (response.usedSource && response.usedSource !== source) {
|
if (response.usedSource && response.usedSource !== source) {
|
||||||
|
|||||||
@ -233,8 +233,8 @@ const ProxyManager = {
|
|||||||
|
|
||||||
let proxies = this._proxyList;
|
let proxies = this._proxyList;
|
||||||
|
|
||||||
// Test proxies in parallel
|
// Test proxies sequentially
|
||||||
const results = await this.testProxiesParallel(proxies);
|
const results = await this.testProxiesParallel(proxies, 1);
|
||||||
|
|
||||||
// Filter working proxies and sort by latency
|
// Filter working proxies and sort by latency
|
||||||
const working = results
|
const working = results
|
||||||
@ -312,9 +312,9 @@ const ProxyManager = {
|
|||||||
* @param {string} source - Source key from CONFIG.PROXY_SOURCES
|
* @param {string} source - Source key from CONFIG.PROXY_SOURCES
|
||||||
* @returns {Promise<{success: boolean, proxies: object[], error: string|null, usedSource: string|null}>}
|
* @returns {Promise<{success: boolean, proxies: object[], error: string|null, usedSource: string|null}>}
|
||||||
*/
|
*/
|
||||||
async fetchProxyList(source = 'arweave') {
|
async fetchProxyList(source = 'github') {
|
||||||
// Define fallback order
|
// Define fallback order
|
||||||
const fallbackOrder = ['arweave', 'git', 'github'];
|
const fallbackOrder = ['github', 'git'];
|
||||||
|
|
||||||
// Start with the requested source, then try others
|
// Start with the requested source, then try others
|
||||||
const sourcesToTry = [source, ...fallbackOrder.filter(s => s !== source)];
|
const sourcesToTry = [source, ...fallbackOrder.filter(s => s !== source)];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user