mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Will be redoing the event interface for subscriptions, some work for the wi and crash fixes
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
var auth = require('../core/jwt_auth.js').auth;
|
||||
|
||||
function RegisterFunction(path, fn, app, api) {
|
||||
app.post(path, auth, function (req, res) {
|
||||
var params = req.body.params || [];
|
||||
|
||||
api.Call(fn, params)
|
||||
.then(function(value) {
|
||||
res.send({ response: value });
|
||||
})
|
||||
.catch(function(reason) {
|
||||
if(reason.message) {
|
||||
res.send({ status: reason.message });
|
||||
}
|
||||
else if(reason === 'Not connected to world server.') {
|
||||
res.send({ status: 'ENCONNECTED' });
|
||||
} else {
|
||||
res.sendStatus(500);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
'Register': RegisterFunction
|
||||
}
|
||||
+10
-31
@@ -1,37 +1,16 @@
|
||||
var auth = require('../core/jwt_auth.js').auth;
|
||||
const common = require('./common.js');
|
||||
|
||||
var RegisterEQW = function(app, api) {
|
||||
app.post('/api/eqw/islocked', auth, function (req, res) {
|
||||
api.Call('EQW::IsLocked', [])
|
||||
.then(function(value) {
|
||||
res.send({ response: value });
|
||||
})
|
||||
.catch(function(reason) {
|
||||
res.sendStatus(500);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/eqw/lock', auth, function (req, res) {
|
||||
api.Call('EQW::Lock', [])
|
||||
.then(function(value) {
|
||||
res.send({ response: value });
|
||||
})
|
||||
.catch(function(reason) {
|
||||
res.sendStatus(500);
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/eqw/unlock', auth, function (req, res) {
|
||||
api.Call('EQW::Unlock', [])
|
||||
.then(function(value) {
|
||||
res.send({ response: value });
|
||||
})
|
||||
.catch(function(reason) {
|
||||
res.sendStatus(500);
|
||||
});
|
||||
});
|
||||
common.Register('/api/eqw/getconfig', 'EQW::GetConfig', app, api);
|
||||
common.Register('/api/eqw/islocked', 'EQW::IsLocked', app, api);
|
||||
common.Register('/api/eqw/lock', 'EQW::Lock', app, api);
|
||||
common.Register('/api/eqw/unlock', 'EQW::Unlock', app, api);
|
||||
common.Register('/api/eqw/getplayercount', 'EQW::GetPlayerCount', app, api);
|
||||
common.Register('/api/eqw/getzonecount', 'EQW::GetZoneCount', app, api);
|
||||
common.Register('/api/eqw/getlaunchercount', 'EQW::GetLauncherCount', app, api);
|
||||
common.Register('/api/eqw/getloginservercount', 'EQW::GetLoginServerCount', app, api);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
'Register': RegisterEQW
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user