Skip to content

Commit 6c77da5

Browse files
committed
Update client-channel.js
1 parent e69cdc9 commit 6c77da5

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

worker/client-channel.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,25 @@
33
// service worker/client communication channel
44

55

6+
const ORIGIN_URL = self.location.origin;
7+
68
// internal paths
79
const INTERNAL_PATHS = {
810

9-
internal: 'https://codeit.codes/',
10-
internal_: 'https://dev.codeit.codes/',
11+
internal: ORIGIN_URL,
1112

12-
run: 'https://codeit.codes/run',
13-
run_: 'https://dev.codeit.codes/run',
13+
run: ORIGIN_URL + '/run',
1414

1515
relLivePath: ('/run/' + '_/'.repeat(15)),
1616

17-
clientId: 'https://codeit.codes/worker/getClientId',
18-
clientId_: 'https://dev.codeit.codes/worker/getClientId',
17+
clientId: ORIGIN_URL + '/worker/getClientId'
1918

2019
};
2120

2221

2322
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
2423

25-
const isDev = (self.origin === 'https://dev.codeit.codes');
24+
const isDev = (ORIGIN_URL === 'https://dev.codeit.codes');
2625

2726

2827
// key : value
@@ -39,7 +38,7 @@ function getPathType(path) {
3938

4039
if (path.startsWith(type[1])) {
4140

42-
pathType = type[0].replaceAll('_', '');
41+
pathType = type[0];
4342

4443
}
4544

0 commit comments

Comments
 (0)