mirror of
https://github.com/amark/gun.git
synced 2025-06-06 22:26:48 +00:00
Improvements to automatic redirect on loading SEA module (#1055)
* Warn on automatic redirect to HTTPS * Don't redirect to HTTPS on loopback IP addresses * Check if current location is a local loopback IP address (127.0.0.0/8) and do not redirect
This commit is contained in:
parent
5be57c3fb1
commit
ae6d5cb6bf
2
sea.js
2
sea.js
@ -35,7 +35,9 @@
|
|||||||
try{ if(SEA.window){
|
try{ if(SEA.window){
|
||||||
if(location.protocol.indexOf('s') < 0
|
if(location.protocol.indexOf('s') < 0
|
||||||
&& location.host.indexOf('localhost') < 0
|
&& location.host.indexOf('localhost') < 0
|
||||||
|
&& ! /^127\.\d+\.\d+\.\d+$/.test(location.hostname)
|
||||||
&& location.protocol.indexOf('file:') < 0){
|
&& location.protocol.indexOf('file:') < 0){
|
||||||
|
console.warn('WebCrypto used by GUN SEA implementation does not work without HTTPS. Will automatically redirect.')
|
||||||
location.protocol = 'https:'; // WebCrypto does NOT work without HTTPS!
|
location.protocol = 'https:'; // WebCrypto does NOT work without HTTPS!
|
||||||
}
|
}
|
||||||
} }catch(e){}
|
} }catch(e){}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user