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:
+1
-1
@@ -8,7 +8,7 @@
|
||||
"@babel/plugin-transform-react-jsx": "7.21.0",
|
||||
"@capacitor/android": "3.6.0",
|
||||
"@capacitor/core": "3.6.0",
|
||||
"@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#e602eda8080f2b3449388c2d5868d6e6da60c8f6",
|
||||
"@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#36755ca6b159da9f07591d008082a93a2434d147",
|
||||
"@testing-library/dom": "9.0.1",
|
||||
"@testing-library/jest-dom": "5.14.1",
|
||||
"@testing-library/react": "14.0.0",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -2668,9 +2668,9 @@
|
||||
dependencies:
|
||||
debug "4.3.3"
|
||||
|
||||
"@plebbit/plebbit-react-hooks@https://github.com/plebbit/plebbit-react-hooks.git#e602eda8080f2b3449388c2d5868d6e6da60c8f6":
|
||||
"@plebbit/plebbit-react-hooks@https://github.com/plebbit/plebbit-react-hooks.git#36755ca6b159da9f07591d008082a93a2434d147":
|
||||
version "0.0.1"
|
||||
resolved "https://github.com/plebbit/plebbit-react-hooks.git#e602eda8080f2b3449388c2d5868d6e6da60c8f6"
|
||||
resolved "https://github.com/plebbit/plebbit-react-hooks.git#36755ca6b159da9f07591d008082a93a2434d147"
|
||||
dependencies:
|
||||
"@plebbit/plebbit-js" "https://github.com/plebbit/plebbit-js.git#bcf4ec7ba024fdd7dc0bb2fab76c27c93597dd50"
|
||||
"@plebbit/plebbit-logger" "https://github.com/plebbit/plebbit-logger.git"
|
||||
|
||||
Reference in New Issue
Block a user