Skip to content
Snippets Groups Projects
Commit 8d81270a authored by Arlo Breault's avatar Arlo Breault
Browse files

Add bridge probe to badge

parent d4aa9ad2
No related branches found
No related tags found
No related merge requests found
/* global Util, Params, Config, UI, Broker, Snowflake, Popup, Parse, availableLangs */
/* global Util, Params, Config, UI, Broker, Snowflake, Popup, Parse, availableLangs, WS */
/*
UI
......@@ -125,27 +125,39 @@ var debug, snowflake, config, broker, ui, log, dbg, init, update, silenceNotific
update = function() {
const cookies = Parse.cookie(document.cookie);
if (cookies[COOKIE_NAME] === '1') {
ui.turnOn();
dbg('Contacting Broker at ' + broker.url);
log('Starting snowflake');
snowflake.setRelayAddr(config.relayAddr);
snowflake.beginWebRTC();
} else {
if (cookies[COOKIE_NAME] !== '1') {
ui.turnOff();
snowflake.disable();
log('Currently not active.');
return;
}
};
init = function() {
ui = new BadgeUI();
if (!Util.hasWebRTC()) {
ui.missingFeature(messages.getMessage('popupWebRTCOff'));
snowflake.disable();
return;
}
WS.probeWebsocket(config.relayAddr)
.then(
() => {
ui.turnOn();
dbg('Contacting Broker at ' + broker.url);
log('Starting snowflake');
snowflake.setRelayAddr(config.relayAddr);
snowflake.beginWebRTC();
},
() => {
ui.missingFeature(messages.getMessage('popupBridgeUnreachable'));
snowflake.disable();
log('Could not connect to bridge.');
}
);
};
init = function() {
ui = new BadgeUI();
if (!Util.hasCookies()) {
ui.missingFeature(messages.getMessage('badgeCookiesOff'));
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment