Skip to content

Commit

Permalink
beacon consent working
Browse files Browse the repository at this point in the history
  • Loading branch information
wholetthedogsout committed Nov 3, 2016
1 parent f8513ea commit 3cf9c7f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ fieldset input{

fieldset label{
display: inline-block;
width: 110px;
width: 150px;
text-align: right;
padding: 0.4em;
}
Expand Down
8 changes: 8 additions & 0 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ <h2>Configuration</h2>
<label class="settings" for="config-beacon_url">Beacon URL: </label>
<input class="config-input long" id="config-beacon_url" type="text" placeholder="URL for the beacon server" />
</li>
<li>
<label class="settings" for="config-beacon_consent">Beacon Consent: </label>
<select class="config-input long" id="consent_for_beacon"/>
<option value="none">Not Answered</option>
<option value="true">True</option>
<option value="false">False</option>
</select>
</li>
<ul>
</fieldset>
</div>
Expand Down
4 changes: 4 additions & 0 deletions static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ $("#btn-factory-reset").click( function(evt) {


updater.getConfig(function(err, config) {

var updater_version_number = 'unavailable';
try{
updater_version_number = config.version.number || config.version.hash.substring(0,8) + '-' + config.version.type
Expand All @@ -526,9 +527,12 @@ $("#btn-factory-reset").click( function(evt) {
$('.label-platform').text(config.os + '/' + config.platform);
$('.label-os-version').text(config.os_version);
$('.label-machine-id').text(config.id);
$('#consent_for_beacon').val(config.consent_for_beacon);

setOS(config.os);

config = flattenObject(config);

for(key in config) {
v = config[key];
input = $('#config-' + key);
Expand Down
9 changes: 8 additions & 1 deletion updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,19 @@ Updater.prototype.start = function(callback) {

function start_beacon(callback) {
var url = config.updater.get('beacon_url');
var consent = config.updater.get('consent_for_beacon');

log.info("Starting beacon service");
this.beacon = new Beacon({
url : url,
interval : BEACON_INTERVAL
});
this.beacon.start();

if (consent === "true"){
this.beacon.start();
} else if (consent === "false"){
log.error("Beacon is not consented to");
}
}.bind(this)
],
function(err, results) {
Expand Down

0 comments on commit 3cf9c7f

Please sign in to comment.