Skip to content

Commit

Permalink
fix(settings): avoid probing dweb.link on load
Browse files Browse the repository at this point in the history
we do not need to probe default dweb.link every time,
doing it for custom gateways is enough
  • Loading branch information
lidel committed Sep 10, 2024
1 parent 2de3310 commit 44a43be
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/bundles/gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const checkValidHttpUrl = (value) => {
} catch (_) {
return false
}
console.log(`URL is valid: ${url}, url.protocol=${url.protocol}`) // lucas
return url.protocol === 'http:' || url.protocol === 'https:'
}

Expand Down Expand Up @@ -128,6 +127,10 @@ async function checkViaImgUrl (imgUrl) {
* @returns {Promise<boolean>} A promise that resolves to true if the gateway is functioning correctly, otherwise false.
*/
export async function checkSubdomainGateway (gatewayUrl) {
if (gatewayUrl === DEFAULT_SUBDOMAIN_GATEWAY) {
// avoid sending probe requests to the default gateway every time Settings page is opened
return true
}
let imgSubdomainUrl
let imgRedirectedPathUrl
try {
Expand Down

0 comments on commit 44a43be

Please sign in to comment.