/checkupdates: Show Button, when Upgrade Version is available ! (check from the server, the version number

This commit is contained in:
Paolo Arena
2019-02-22 10:23:39 +01:00
parent c7f13d820d
commit d78de1a25c
9 changed files with 133 additions and 4 deletions

View File

@@ -1,9 +1,17 @@
const express = require('express');
const router = express.Router();
var { authenticate } = require('../middleware/authenticate');
const { ObjectID } = require('mongodb');
var mongoose = require('mongoose');
const cfgserver = mongoose.model('cfgserver');
const _ = require('lodash');
var {User} = require('../models/user');
var { User } = require('../models/user');
var server_constants = require('../tools/server_constants');
@@ -69,6 +77,33 @@ router.post(process.env.LINK_REQUEST_NEWPASSWORD, (req, res) => {
});
router.get(process.env.LINK_CHECK_UPDATES, authenticate, (req, res) => {
const userId = req.user._id;
console.log("POST " + process.env.LINK_CHECK_UPDATES + " userId=" + userId);
if (!ObjectID.isValid(userId)) {
return res.status(404).send();
}
cfgserver.find().then((arrcfgrec) => {
if (!arrcfgrec)
return res.status(404).send();
// ++Todo: Add to Log Stat ....
res.send({ cfgServer: arrcfgrec });
}).catch((e) => {
console.log(e);
res.status(400).send();
res.send({ code: server_constants.RIS_CODE_ERR, msg: e });
});
});
// Invio la Nuova Password richiesta dal reset!
// Ritorna il token per poter effettuare le chiamate...
router.post(process.env.LINK_UPDATE_PASSWORD, (req, res) => {