mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-24 16:23:12 +09:00
Master now compiles with typescript
This commit is contained in:
1 parent
55df1bae8a
commit
2e756b1649
3 files changed
+33
-3
No files matched your search
@@ -276,7 +276,7 @@ POST World ID management. Slaves post here to tell the server they exist
|
|||||||
@instance
|
@instance
|
||||||
@alias /api/getID
|
@alias /api/getID
|
||||||
*/
|
*/
|
||||||
app.post("/api/getID", authenticate.middleware, function(req: Request,res: Response) {
|
app.post("/api/getID", authenticate.middleware, function(req, res) {
|
||||||
endpointHitCounter.labels(req.route.path).inc();
|
endpointHitCounter.labels(req.route.path).inc();
|
||||||
// request.body should be an object
|
// request.body should be an object
|
||||||
// {rconPort, rconPassword, serverPort, mac, time}
|
// {rconPort, rconPassword, serverPort, mac, time}
|
||||||
@@ -725,7 +725,7 @@ if(args.sslPort || config.sslPort){
|
|||||||
var certificate = fs.readFileSync(path.resolve(config.databaseDirectory, 'certificates/cert.crt'));
|
var certificate = fs.readFileSync(path.resolve(config.databaseDirectory, 'certificates/cert.crt'));
|
||||||
var privateKey = fs.readFileSync(path.resolve(config.databaseDirectory, 'certificates/cert.key'));
|
var privateKey = fs.readFileSync(path.resolve(config.databaseDirectory, 'certificates/cert.key'));
|
||||||
|
|
||||||
httpsServer = require("https").createServer({
|
var httpsServer = require("https").createServer({
|
||||||
key: privateKey,
|
key: privateKey,
|
||||||
cert: certificate
|
cert: certificate
|
||||||
}, app).listen(args.sslPort || config.sslPort);
|
}, app).listen(args.sslPort || config.sslPort);
|
||||||
@@ -734,7 +734,7 @@ if(args.sslPort || config.sslPort){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(args.masterPort || config.masterPort){
|
if(args.masterPort || config.masterPort){
|
||||||
server = require("http").Server(app);
|
var server = require("http").Server(app);
|
||||||
server.listen(args.masterPort || config.masterPort || 8080, function () {
|
server.listen(args.masterPort || config.masterPort || 8080, function () {
|
||||||
console.log("Listening on port %s...", server.address().port);
|
console.log("Listening on port %s...", server.address().port);
|
||||||
});
|
});
|
||||||
@@ -747,6 +747,9 @@ const ioMetrics = require("socket.io-prometheus");
|
|||||||
ioMetrics(io);
|
ioMetrics(io);
|
||||||
var slaveMappers = {};
|
var slaveMappers = {};
|
||||||
class slaveMapper {
|
class slaveMapper {
|
||||||
|
instanceID: string
|
||||||
|
socket: any
|
||||||
|
lastBeat: number
|
||||||
constructor(instanceID, socket) {
|
constructor(instanceID, socket) {
|
||||||
this.instanceID = instanceID;
|
this.instanceID = instanceID;
|
||||||
this.socket = socket;
|
this.socket = socket;
|
||||||
@@ -777,6 +780,10 @@ class slaveMapper {
|
|||||||
}
|
}
|
||||||
var mapRequesters = {};
|
var mapRequesters = {};
|
||||||
class mapRequester {
|
class mapRequester {
|
||||||
|
requesterID: string
|
||||||
|
socket: any
|
||||||
|
instanceID: string
|
||||||
|
lastBeat: number
|
||||||
constructor(requesterID, socket, instanceID){
|
constructor(requesterID, socket, instanceID){
|
||||||
this.requesterID = requesterID;
|
this.requesterID = requesterID;
|
||||||
this.socket = socket;
|
this.socket = socket;
|
||||||
@@ -819,6 +826,10 @@ var wsSlaves = {};
|
|||||||
var wsChatRecievers = [];
|
var wsChatRecievers = [];
|
||||||
var wsAlertRecievers = [];
|
var wsAlertRecievers = [];
|
||||||
class wsSlave {
|
class wsSlave {
|
||||||
|
instanceID: string
|
||||||
|
socket: any
|
||||||
|
lastBeat: number
|
||||||
|
commandsWaitingForReturn: object
|
||||||
constructor(instanceID, socket){
|
constructor(instanceID, socket){
|
||||||
this.instanceID = instanceID;
|
this.instanceID = instanceID;
|
||||||
this.socket = socket;
|
this.socket = socket;
|
||||||
|
|||||||
Vendored
+16
@@ -0,0 +1,16 @@
|
|||||||
|
type MasterPluginInstance = {
|
||||||
|
config: object,
|
||||||
|
pluginConfig: object,
|
||||||
|
path: string,
|
||||||
|
socketio: any,
|
||||||
|
express: any,
|
||||||
|
Prometheus: any,
|
||||||
|
onExit?: Function,
|
||||||
|
}
|
||||||
|
type pluginConfig = {
|
||||||
|
name: string,
|
||||||
|
}
|
||||||
|
interface MasterPlugin {
|
||||||
|
main: MasterPluginInstance,
|
||||||
|
pluginConfig: pluginConfig,
|
||||||
|
}
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
interface slaveMapper {
|
||||||
|
instanceID: string,
|
||||||
|
}
|
||||||
Reference in new issue
Block a user