зеркало из https://github.com/mozilla/lightbeam.git
Too spammy
This commit is contained in:
Родитель
36b2f25fe1
Коммит
f20555a426
|
@ -20,6 +20,7 @@ const STORAGE_KEYS = [
|
|||
|
||||
// Upload logic.
|
||||
function serializeConnections(connections) {
|
||||
console.log("serializing connections");
|
||||
let exportSet = {
|
||||
format: 'Lightbeam Save File',
|
||||
version: '1.1',
|
||||
|
@ -28,10 +29,12 @@ function serializeConnections(connections) {
|
|||
uploadTime: Date.now(),
|
||||
connections: connections
|
||||
};
|
||||
console.log(JSON.stringify(exportSet));
|
||||
return JSON.stringify(exportSet);
|
||||
}
|
||||
|
||||
function getUserAgentData() {
|
||||
console.log("Getting user agent data");
|
||||
let retval = {};
|
||||
let app = require("sdk/system/xul-app");
|
||||
retval.appname = app.name;
|
||||
|
@ -43,10 +46,12 @@ function getUserAgentData() {
|
|||
"privacy.donottrack.header.value" ];
|
||||
prefs.forEach(function(p) { retval[p] = prefService.get(p); });
|
||||
retval.addons = getAddons();
|
||||
console.log(JSON.stringify(retval));
|
||||
return retval;
|
||||
}
|
||||
|
||||
function getAddons() {
|
||||
console.log("Getting addon info");
|
||||
const { Cu } = require('chrome');
|
||||
let { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm");
|
||||
let addons = [];
|
||||
|
@ -59,11 +64,12 @@ function getAddons() {
|
|||
addons.push(o);
|
||||
});
|
||||
});
|
||||
console.log(JSON.stringify(addons));
|
||||
return addons;
|
||||
}
|
||||
|
||||
function upload(connections) {
|
||||
console.debug("received upload event in addon");
|
||||
console.log("received upload event in addon");
|
||||
let uploadServer = 'https://data.mozilla.com/submit/lightbeam';
|
||||
let request = Request({
|
||||
url: uploadServer,
|
||||
|
@ -71,7 +77,7 @@ function upload(connections) {
|
|||
onComplete: function (response) {
|
||||
let status = Number(response.status);
|
||||
if (status >= 200 && status < 300) {
|
||||
console.debug("successful upload: ", response.text);
|
||||
console.log("successful upload: ", response.text);
|
||||
} else {
|
||||
// Ignore errors for now. We could save last upload time and try
|
||||
// uploading again the ones that failed previously.
|
||||
|
@ -147,6 +153,7 @@ if (!storage.userId) {
|
|||
|
||||
// Rotate user id if necessary
|
||||
maybeRotateUserId();
|
||||
upload([]);
|
||||
|
||||
console.log('Current quota usage:', Math.round(ss.quotaUsage * 100));
|
||||
console.log("Current user id:", storage.userId);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"title": "Contribute data",
|
||||
"description": "Contribute your Lightbeam data to Mozilla",
|
||||
"type": "bool",
|
||||
"value": false },
|
||||
"value": true },
|
||||
{ "name": "defaultVisualization",
|
||||
"title": "Default visualization",
|
||||
"description": "Graph or list",
|
||||
|
|
Загрузка…
Ссылка в новой задаче