Skip to content

Commit

Permalink
log fixes and action restore on error save
Browse files Browse the repository at this point in the history
  • Loading branch information
suculent committed May 8, 2022
1 parent 0d543a9 commit 0c42f1b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 22 deletions.
16 changes: 2 additions & 14 deletions lib/thinx/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ module.exports = class Device {

if (buffer.length < 1000) {
console.log("⚠️ [warning] Input file too short for a firmware, skipping (" + buffer.length + ")");
upload_callback(false);
return;
return upload_callback(false);
}
if (typeof (ott) !== "undefined" && ott !== null) {
this.client.expire("ott:" + ott, 3600); // The OTT is valid for 60 minutes after first use
Expand Down Expand Up @@ -258,12 +257,7 @@ module.exports = class Device {

console.log(`ℹ️ [info] Device ${udid} has auto-update disabled.`);

if (Util.isDefined(callback)) {
if (debug_device) {
console.log("ℹ️ [info] Check-in reply (existing): " + JSON.stringify(registration_response));
}
callback(res, true, registration_response);
}
if (Util.isDefined(callback)) callback(res, true, registration_response);

} else {

Expand Down Expand Up @@ -775,10 +769,6 @@ module.exports = class Device {
// Validate input parameters
//

if (debug_device) {
console.log("🔨 [debug] [device.register]:", { reg });
}

if ((typeof (reg) === "undefined") || (reg === null)) return callback(res, false, "no_registration_info");

var rdict = {};
Expand Down Expand Up @@ -1426,8 +1416,6 @@ module.exports = class Device {

delete changes.udid;

//console.log("[debug] Atomic update with changes: ", JSON.stringify(changes, null, 2));

devicelib.atomic("devices", "modify", udid, changes, (atomic_err, body) => {
if (atomic_err) {
let data = JSON.stringify(changes, null, 2);
Expand Down
8 changes: 4 additions & 4 deletions lib/thinx/gdpr.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ module.exports = class GDPR {
((typeof (user.notifiedBeforeGDPRRemoval24) === "undefined") || (user.notifiedBeforeGDPRRemoval24 !== true))
) {
owner.sendGDPRExpirationEmail24(user, user.email, () => {
this.userlib.atomic("users", "edit", user.owner, { notifiedBeforeGDPRRemoval24: true }, (uerror, abody) => {
console.log("📤 [info] sendGDPRExpirationEmail24", uerror, abody);
this.userlib.atomic("users", "edit", user.owner, { notifiedBeforeGDPRRemoval24: true }, (uerror) => {
//console.log("📤 [info] sendGDPRExpirationEmail24", uerror, abody);
opt_callback(uerror);
opt_callback = null; // to prevent double call
});
Expand All @@ -95,8 +95,8 @@ module.exports = class GDPR {
((typeof (user.notifiedBeforeGDPRRemoval168) === "undefined") || (user.notifiedBeforeGDPRRemoval168 !== true))
) {
owner.sendGDPRExpirationEmail168(user, user.email, () => {
this.userlib.atomic("users", "edit", user.owner, { notifiedBeforeGDPRRemoval168: true }, (uerror, abody) => {
console.log("📤 [info] sendGDPRExpirationEmail168", uerror, abody);
this.userlib.atomic("users", "edit", user.owner, { notifiedBeforeGDPRRemoval168: true }, (uerror) => {
//console.log("📤 [info] sendGDPRExpirationEmail168", uerror, abody);
if (typeof (opt_callback) !== "undefined") {
opt_callback(uerror);
opt_callback = null; // to prevent double call
Expand Down
2 changes: 1 addition & 1 deletion lib/thinx/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = class Platform {
var yml_platform = Platform.getPlatformFromPath(local_path);

if (yml_platform !== null) {
console.log("[warning] overriding platform from yml from", platform, "to", yml_platform, "path", local_path);
console.log("[info] using thinx.yml platform", platform);
platform = yml_platform;
}

Expand Down
5 changes: 3 additions & 2 deletions lib/thinx/queue_action.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ module.exports = class Action {
}

setError() {
this.action.status = "error";
this.save();
let action = new Action(this.action.udid);
action.action.status = "error";
action.save();
}

toString() {
Expand Down
1 change: 0 additions & 1 deletion spec/jasmine/00-AppSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ describe("AppSpec Session Management", function () {
chai.request(thx.app)
.get('/api/logout')
.end((err, res) => {
console.log("GET /api/logout (without session)", err, res);
expect(res.status).to.equal(200);
expect(res.text).to.be.a('string'); // html...
done();
Expand Down

0 comments on commit 0c42f1b

Please sign in to comment.