gun/sea/https.js
Mark Nadal 638c2c3c23 have unbuild function wrap to prevent scope leaks & allow RETURN hehehe so I can reject @bmatusiak 's lS change O:) O:) I love you you're a hero!
later with @bmatusiak check sea.then for '../gun.js' vs '../' vs ...
note: src/index -> core.js
TODO: something about WebRTC candidates hitting ack decrement limits?
2024-01-17 10:13:00 -08:00

16 lines
545 B
JavaScript

;(function(){
var SEA = require('./root');
try{ if(SEA.window){
if(location.protocol.indexOf('s') < 0
&& location.host.indexOf('localhost') < 0
&& ! /^127\.\d+\.\d+\.\d+$/.test(location.hostname)
&& location.protocol.indexOf('blob:') < 0
&& location.protocol.indexOf('file:') < 0
&& location.origin != 'null'){
console.warn('HTTPS needed for WebCrypto in SEA, redirecting...');
location.protocol = 'https:'; // WebCrypto does NOT work without HTTPS!
}
} }catch(e){}
}());