Browse Source

latest_message, cleanup auth module

push-params
Evan Feenstra 4 years ago
parent
commit
a29a59c899
  1. 4
      app.ts
  2. 4
      dist/app.js
  3. 2
      dist/app.js.map
  4. 2
      dist/src/controllers/bots.js
  5. 2
      dist/src/controllers/bots.js.map
  6. 16
      dist/src/utils/nodeinfo.js
  7. 2
      dist/src/utils/nodeinfo.js.map
  8. 2
      src/controllers/bots.ts
  9. 15
      src/utils/nodeinfo.ts

4
app.ts

@ -47,7 +47,7 @@ async function connectToLND(){
async function mainSetup(){
await setupDatabase();
if (config.hub_api_url) {
pingHubInterval(5000)
pingHubInterval(15000)
checkInvitesHubInterval(5000)
}
await setupApp()
@ -90,7 +90,7 @@ async function authModule(req, res, next) {
req.path == '/info' ||
req.path == '/action' ||
req.path == '/contacts/tokens' ||
req.path == '/login' ||
req.path == '/latest' ||
req.path.startsWith('/static') ||
req.path == '/contacts/set_dev'
) {

4
dist/app.js

@ -57,7 +57,7 @@ function mainSetup() {
return __awaiter(this, void 0, void 0, function* () {
yield setup_1.setupDatabase();
if (config.hub_api_url) {
hub_1.pingHubInterval(5000);
hub_1.pingHubInterval(15000);
hub_1.checkInvitesHubInterval(5000);
}
yield setupApp();
@ -98,7 +98,7 @@ function authModule(req, res, next) {
req.path == '/info' ||
req.path == '/action' ||
req.path == '/contacts/tokens' ||
req.path == '/login' ||
req.path == '/latest' ||
req.path.startsWith('/static') ||
req.path == '/contacts/set_dev') {
next();

2
dist/app.js.map

@ -1 +1 @@
{"version":3,"file":"app.js","sourceRoot":"","sources":["../app.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAkC;AAClC,0CAAyC;AACzC,iCAAgC;AAChC,8CAA6C;AAC7C,6BAA4B;AAC5B,iCAAgC;AAChC,6BAA4B;AAC5B,yCAAmC;AACnC,+CAAuC;AACvC,mCAAkE;AAClE,6CAA0D;AAC1D,iDAAgD;AAChD,6CAA4C;AAC5C,yCAAwC;AAExC,IAAI,MAAM,GAAQ,IAAI,CAAA;AACtB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AAS,CAAC,GAAG,EAAE,yBAAyB,EAAE,EAAC,cAAc,EAAG,YAAY,EAAC,CAAC,CAAC;gBAC/E,GAAG,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;aAC/B;iBAAM;gBACN,IAAI,EAAE,CAAC;aACP;SACD;IACF,CAAC;CAAA;AAED,kBAAe,MAAM,CAAA"}

2
dist/src/controllers/bots.js

@ -296,7 +296,7 @@ function buildBotPayload(msg) {
exports.buildBotPayload = buildBotPayload;
function receiveBotRes(payload) {
return __awaiter(this, void 0, void 0, function* () {
console.log("=> receiveBotRes", payload);
console.log("=> receiveBotRes"); //, payload)
const dat = payload.content || payload;
if (!dat.chat || !dat.message || !dat.sender) {
return console.log('=> receiveBotRes error, no chat||msg||sender');

2
dist/src/controllers/bots.js.map

File diff suppressed because one or more lines are too long

16
dist/src/utils/nodeinfo.js

@ -25,6 +25,7 @@ function nodeinfo() {
const lightning = lightning_1.loadLightning();
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
const clean = yield isClean();
const latest_message = yield latestMessage();
try {
lightning.channelBalance({}, (err, channelBalance) => {
if (err)
@ -73,6 +74,7 @@ function nodeinfo() {
best_header_timestamp: info.best_header_timestamp,
testnet: info.testnet,
clean,
latest_message,
};
resolve(node);
}
@ -100,4 +102,18 @@ function isClean() {
return false;
});
}
function latestMessage() {
return __awaiter(this, void 0, void 0, function* () {
const last = yield models_1.models.Message.findAll({
limit: 1,
order: [['createdAt', 'DESC']]
});
if (last) {
return last.createdAt;
}
else {
return '';
}
});
}
//# sourceMappingURL=nodeinfo.js.map

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

@ -1 +1 @@
{"version":3,"file":"nodeinfo.js","sourceRoot":"","sources":["../../../src/utils/nodeinfo.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,kDAAgD;AAChD,sCAAqC;AACrC,8CAA0D;AAC1D,sCAAgC;AAEhC,SAAS,QAAQ;IACf,OAAO,IAAI,OAAO,CAAC,CAAO,OAAO,EAAE,MA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;SACjC,CAAC,CAAA;QACF,IAAG,IAAI,EAAE;YACP,OAAO,IAAI,CAAC,SAAS,CAAA;SACtB;aAAM;YACL,OAAO,EAAE,CAAA;SACV;IACH,CAAC;CAAA"}

2
src/controllers/bots.ts

@ -285,7 +285,7 @@ export function buildBotPayload(msg:Msg): SphinxBot.Message {
}
export async function receiveBotRes(payload) {
console.log("=> receiveBotRes", payload)
console.log("=> receiveBotRes")//, payload)
const dat = payload.content || payload
if(!dat.chat || !dat.message || !dat.sender) {

15
src/utils/nodeinfo.ts

@ -20,6 +20,8 @@ function nodeinfo(){
const clean = await isClean()
const latest_message = await latestMessage()
try {
lightning.channelBalance({}, (err, channelBalance) => {
if(err) console.log(err)
@ -65,6 +67,7 @@ function nodeinfo(){
best_header_timestamp: info.best_header_timestamp,
testnet: info.testnet,
clean,
latest_message,
}
resolve(node)
}
@ -89,4 +92,16 @@ async function isClean(){
const onlyOneContact = allContacts===1
if(cleanOwner && noMsgs && onlyOneContact) return true
return false
}
async function latestMessage(): Promise<any> {
const last = await models.Message.findAll({
limit: 1,
order: [[ 'createdAt', 'DESC' ]]
})
if(last) {
return last.createdAt
} else {
return ''
}
}
Loading…
Cancel
Save