Browse Source

better clean check

feature/dockerfile-arm v0.8.7
Evan Feenstra 5 years ago
parent
commit
5029ad2ebb
  1. 2
      .gitignore
  2. 6
      api/utils/nodeinfo.ts
  3. 6
      dist/api/utils/nodeinfo.js
  4. 2
      dist/api/utils/nodeinfo.js.map

2
.gitignore

@ -1,5 +1,7 @@
notes.md
dist/public/uploads
dist/config/app.json
dist/config/config.json

6
api/utils/nodeinfo.ts

@ -79,6 +79,10 @@ export {nodeinfo}
async function isClean(){
// has owner but with no auth token
const cleanOwner = await models.Contact.findOne({ where: { isOwner: true, authToken: null }})
if(cleanOwner) return true
const msgs = await models.Message.findAll()
const allContacts = await models.Contact.findAll()
const noMsgs = msgs.length===0
const onlyOneContact = allContacts.length===1
if(cleanOwner && noMsgs && onlyOneContact) return true
return false
}

6
dist/api/utils/nodeinfo.js

@ -85,7 +85,11 @@ function isClean() {
return __awaiter(this, void 0, void 0, function* () {
// has owner but with no auth token
const cleanOwner = yield models_1.models.Contact.findOne({ where: { isOwner: true, authToken: null } });
if (cleanOwner)
const msgs = yield models_1.models.Message.findAll();
const allContacts = yield models_1.models.Contact.findAll();
const noMsgs = msgs.length === 0;
const onlyOneContact = allContacts.length === 1;
if (cleanOwner && noMsgs && onlyOneContact)
return true;
return false;
});

2
dist/api/utils/nodeinfo.js.map

@ -1 +1 @@
{"version":3,"file":"nodeinfo.js","sourceRoot":"","sources":["../../../api/utils/nodeinfo.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,kDAAgD;AAChD,sCAAqC;AACrC,8CAA0D;AAC1D,sCAAgC;AAEhC,SAAS,QAAQ;IACf,OAAO,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,MAAM,EAAC,EAAE;QAC1C,IAAI,SAAS,GAAG,EAAE,CAAA;QAClB,IAAI;YACF,SAAS,GAAG,MAAM,QAAQ,CAAC,EAAE,EAAE,CAAA;SAChC;QAAC,OAAM,CAAC,EAAC;YACR,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;S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