-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcontrollers.js
41 lines (36 loc) · 1.1 KB
/
controllers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var onesignal = require("./library"),
meta = require.main.require("./src/meta"),
nconf = require.main.require("nconf"),
Controllers = {};
Controllers.renderACP = function (req, res) {
onesignal.getAssociatedUsers(function (err, users) {
res.render("admin/plugins/onesignal", {
users: users,
numAssoc: users.length,
base_url: nconf.get("url").replace(/\/+$/, ""),
});
});
};
Controllers.renderAuthSuccess = function (req, res) {
res.render("onesignal/assocSuccess");
};
Controllers.renderSettings = function (req, res) {
onesignal.getUserDevices(req.user.uid, function (err, devices) {
res.render("onesignal/settings", {
site_title: meta.config.title || meta.config.browserTitle || "NodeBB",
setupRequired: res.locals.setupRequired,
devices: devices,
});
});
};
Controllers.getPlayerIds = function (req, res) {
onesignal.getPlayerIds(req.user.uid, function (err, player_ids) {
if (!err) {
players = JSON.parse(player_ids);
res.json(players);
} else {
res.status(500).json(err);
}
});
};
module.exports = Controllers;