Compile coffee files and remove them

With,

  ./node_modules/.bin/coffee -b -c Cakefile `find . -path ./node_modules -prune -o -name '*.coffee'`
This commit is contained in:
Arlo Breault 2019-07-06 15:13:06 +02:00
parent 82562fb21d
commit 31ad9566e6
38 changed files with 2277 additions and 1725 deletions

76
proxy/init-webext.js Normal file
View file

@ -0,0 +1,76 @@
// Generated by CoffeeScript 2.4.1
/*
Entry point.
*/
var broker, config, dbg, debug, init, log, snowflake, ui, update;
debug = false;
snowflake = null;
config = null;
broker = null;
ui = null;
// Log to both console and UI if applicable.
// Requires that the snowflake and UI objects are hooked up in order to
// log to console.
log = function(msg) {
console.log('Snowflake: ' + msg);
return snowflake != null ? snowflake.ui.log(msg) : void 0;
};
dbg = function(msg) {
if (debug) {
return log(msg);
}
};
if (!Util.featureDetect()) {
chrome.runtime.onConnect.addListener(function(port) {
return port.postMessage({
missingFeature: true
});
});
return;
}
init = function() {
config = new Config;
ui = new WebExtUI();
broker = new Broker(config.brokerUrl);
snowflake = new Snowflake(config, ui, broker);
log('== snowflake proxy ==');
return ui.initToggle();
};
update = function() {
if (!ui.enabled) {
// Do not activate the proxy if any number of conditions are true.
snowflake.disable();
log('Currently not active.');
return;
}
// Otherwise, begin setting up WebRTC and acting as a proxy.
dbg('Contacting Broker at ' + broker.url);
log('Starting snowflake');
snowflake.setRelayAddr(config.relayAddr);
return snowflake.beginWebRTC();
};
// Notification of closing tab with active proxy.
window.onbeforeunload = function() {
if (!silenceNotifications && Snowflake.MODE.WEBRTC_READY === snowflake.state) {
return Snowflake.MESSAGE.CONFIRMATION;
}
return null;
};
window.onunload = function() {
snowflake.disable();
return null;
};
window.onload = init;