This commit is contained in:
KoalaSat 2023-01-13 17:42:12 +01:00
parent 3e4369aaa4
commit 9d70478d80
No known key found for this signature in database
GPG Key ID: 2F7F61C6146AB157
2 changed files with 4 additions and 4 deletions

View File

@ -15,4 +15,4 @@ export const defaultRelays = [
]
export const REGEX_SOCKET_LINK =
/((wss):\/\/)?([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?/i
/^wss:\/\/.*\..*$/i

View File

@ -65,7 +65,7 @@ export const RelaysPage: React.FC = () => {
}
const onPressAddRelay: () => void = () => {
if ((addRelayInput.match(REGEX_SOCKET_LINK) ?? []).length > 0) {
if (REGEX_SOCKET_LINK.test(addRelayInput)) {
bottomSheetAddRef.current?.close()
addRelayItem({
url: addRelayInput,
@ -100,7 +100,7 @@ export const RelaysPage: React.FC = () => {
const renderItem: ListRenderItem<Relay> = ({ index, item }) => (
<List.Item
key={index}
title={item.url.split('wss://')[1].split('/')[0]}
title={item.url.split('wss://')[1]?.split('/')[0]}
right={() => relayToggle(item)}
onPress={() => {
setSelectedRelay(item)
@ -201,7 +201,7 @@ export const RelaysPage: React.FC = () => {
</View>
</View>
<Divider style={styles.divider}/>
<Text variant='titleLarge'>{selectedRelay?.url.split('wss://')[1].split('/')[0]}</Text>
<Text variant='titleLarge'>{selectedRelay?.url.split('wss://')[1]?.split('/')[0]}</Text>
</View>
</RBSheet>
</View>