fix osUpdate check and address parser for Tor without protocol (#2941)

This commit is contained in:
Matt Hill
2025-05-10 12:18:20 -06:00
committed by GitHub
parent e1ccc583a3
commit 9b2b54d585
2 changed files with 8 additions and 4 deletions

View File

@@ -56,7 +56,9 @@ export function getAddresses(
addresses.forEach(url => { addresses.forEach(url => {
if (h.kind === 'onion') { if (h.kind === 'onion') {
tor.push({ tor.push({
protocol: new URL(url).protocol.replace(':', '').toUpperCase(), protocol: /^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(url)
? new URL(url).protocol.replace(':', '').toUpperCase()
: null,
url, url,
}) })
} else { } else {
@@ -128,5 +130,5 @@ export type LocalAddress = {
export type TorAddress = { export type TorAddress = {
url: string url: string
protocol: string protocol: string | null
} }

View File

@@ -54,10 +54,12 @@ export class OSService {
serverId: id, serverId: id,
}) })
const [latest, _] = Object.entries(this.osUpdate).at(-1)! const latest = Object.entries(this.osUpdate).at(-1)?.[0]
this.updateAvailable$.next( this.updateAvailable$.next(
Version.parse(latest).compare(Version.parse(version)) === 'greater', latest
? Version.parse(latest).compare(Version.parse(version)) === 'greater'
: false,
) )
} }
} }