mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix state strings bug
This commit is contained in:
@@ -21,10 +21,19 @@ const useStateString = (clients) => {
|
||||
}
|
||||
}
|
||||
|
||||
const getClientHost = (clientUrl) => {
|
||||
try {
|
||||
return new URL(clientUrl).hostname || clientUrl
|
||||
}
|
||||
catch (e) {
|
||||
return clientUrl
|
||||
}
|
||||
}
|
||||
|
||||
let stateString = ''
|
||||
for (const state in states) {
|
||||
const clientUrls = states[state]
|
||||
const clientHosts = clientUrls.filter(isValidUrl).map(clientUrl => new URL(clientUrl).hostname)
|
||||
const clientHosts = clientUrls.filter(isValidUrl).map(clientUrl => getClientHost(clientUrl))
|
||||
|
||||
// if there are no valid hosts, skip this state
|
||||
if (clientHosts.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user