8000 Fix #2326 - Redirect to localhost when on 0.0.0.0 · pyscript/pyscript@5a0066c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a0066c

Browse files
committed
Fix #2326 - Redirect to localhost when on 0.0.0.0
1 parent b911ea9 commit 5a0066c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

core/src/core.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*! (c) PyScript Development Team */
22

3+
import "zero-redirect.js";
34
import stickyModule from "sticky-module";
45
import "@ungap/with-resolvers";
56

core/src/zero-redirect.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
try {
2+
crypto.randomUUID();
3+
}
4+
catch (_) { // eslint-disable-line
5+
if (location.href.startsWith('http://0.0.0.0'))
6+
location.href = location.href.replace('0.0.0.0', 'localhost');
7+
}

0 commit comments

Comments
 (0)
0