Skip to content

Commit f68c41f

Browse files
committed
fix socket & network widget 0%
1 parent c80e8fd commit f68c41f

File tree

4 files changed

+35
-7
lines changed

4 files changed

+35
-7
lines changed

components/Feed.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ const head = computed(() => appStore.head)
9494
</Flex>
9595

9696
<template #content>
97-
<Flex align="center" gap="8">
97+
<Flex align="center" gap="6">
9898
<div :class="[$style.status, head.synced ? $style.green : $style.red]" />
99-
<template v-if="!head.synced">Not</template>
100-
<Text color="primary"> Synced </Text>
99+
100+
<Text color="primary"><template v-if="!head.synced">Not</template> Synced </Text>
101101
</Flex>
102102
</template>
103103
</Tooltip>

components/widgets/NetworkWidget.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ onMounted(async () => {
111111

112112
<Flex align="center" justify="between">
113113
<Text v-if="!isNaN(pos)" size="16" weight="600" color="tertiary" :class="$style.ds_font"> {{ pos.toFixed(2) }}% </Text>
114-
<Text v-else color="tertiary">is unknown</Text>
114+
<Text v-else size="16" weight="600" color="tertiary" :class="$style.ds_font">0%</Text>
115115

116116
<Text size="12" weight="600" color="support"> Throughput level </Text>
117117
</Flex>

services/api/socket.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** Services */
2-
import { Server } from "../config"
2+
import { useSocketURL } from "../config"
33

44
/** Store */
55
import { useAppStore } from "@/store/app"
@@ -9,7 +9,7 @@ export let socket = null
99
export const init = () => {
1010
const appStore = useAppStore()
1111

12-
socket = new WebSocket(Server.WSS)
12+
socket = new WebSocket(useSocketURL())
1313

1414
socket.addEventListener("open", (e) => {
1515
/** Head Subscription */

services/config.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ export const Server = {
44
mocha: "https://api-mocha-4.celenium.io/v1",
55
dev: "https://api-dev.celenium.io/v1",
66
},
7-
WSS: "wss://api-dev.celenium.io/v1/ws",
7+
WSS: {
8+
mainnet: "wss://api.celenium.io/v1/ws",
9+
mocha: "wss://api-dev.celenium.io/v1/ws",
10+
dev: "wss://api-dev.celenium.io/v1/ws",
11+
},
812
}
913

1014
export const useServerURL = () => {
@@ -17,10 +21,34 @@ export const useServerURL = () => {
1721
case "mocha-4.celenium.io":
1822
return Server.API.mocha
1923

24+
case "mocha.celenium.io":
25+
return Server.API.mocha
26+
2027
case "dev.celenium.io":
2128
return Server.API.dev
2229

2330
default:
2431
return Server.API.dev
2532
}
2633
}
34+
35+
export const useSocketURL = () => {
36+
const requestURL = useRequestURL()
37+
38+
switch (requestURL.hostname) {
39+
case "celenium.io":
40+
return Server.WSS.mainnet
41+
42+
case "mocha-4.celenium.io":
43+
return Server.WSS.mocha
44+
45+
case "mocha.celenium.io":
46+
return Server.WSS.mocha
47+
48+
case "dev.celenium.io":
49+
return Server.WSS.dev
50+
51+
default:
52+
return Server.WSS.dev
53+
}
54+
}

0 commit comments

Comments
 (0)