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

Skip to content

Commit 403a39b

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

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* eslint no-unused-vars: 0 */
2+
try {
3+
crypto.randomUUID();
4+
}
5+
catch (_) {
6+
if (location.href.startsWith('http://0.0.0.0'))
7+
location.href = location.href.replace('0.0.0.0', 'localhost');
8+
}

0 commit comments

Comments
 (0)
0