poikilos
6 years ago
committed by
Jacob Gustafson
5 changed files with 88 additions and 45 deletions
@ -0,0 +1,32 @@ |
|||||
|
|
||||
|
var express = require('express'); |
||||
|
var app = express(); |
||||
|
|
||||
|
app.get('/get-players', function (req, res) { |
||||
|
res.setHeader('Content-Type', 'application/json'); |
||||
|
res.send(JSON.stringify(players)); |
||||
|
}); |
||||
|
|
||||
|
var last_announce_string = "none"; |
||||
|
|
||||
|
app.get('/last-announce', function (req, res) { |
||||
|
res.setHeader('Content-Type', 'text/plain'); |
||||
|
res.send(last_announce_string); |
||||
|
}); |
||||
|
|
||||
|
app.get('/announce', function (req, res) { |
||||
|
last_announce_string = JSON.stringify(req.body); |
||||
|
console.log("announce got:"+last_announce_string); |
||||
|
res.setHeader('Content-Type', 'text/plain'); |
||||
|
res.send(); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
var server = app.listen(3000, function () { |
||||
|
//console.log('express-handlebars example server listening on: 3000');
|
||||
|
var host = server.address().address; |
||||
|
var port = server.address().port; |
||||
|
console.log("listserver address:"); |
||||
|
console.log(JSON.stringify(server.address())); |
||||
|
console.log("(experimental WIP) Minetest master server is listening at http://%s:%s", host, port); |
||||
|
}); |
@ -0,0 +1,29 @@ |
|||||
|
var fs = require('fs'); |
||||
|
|
||||
|
const profilePath = require('os').homedir(); |
||||
|
exports.profilePath = profilePath; |
||||
|
|
||||
|
var minetestPath = profilePath + "/minetest"; // TODO: differs from .minetest if not RUN_IN_PLACE
|
||||
|
exports.minetestPath = function() { |
||||
|
return minetestPath; |
||||
|
} |
||||
|
|
||||
|
const myName = "minetestinfo.js"; |
||||
|
var skinDir = ""; |
||||
|
exports.skinDir = function () { |
||||
|
return skinDir; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
exports.regeneratePaths = function () { |
||||
|
exports.skinDir = exports.minetestPath + "/games/Bucket_Game/mods/codercore/coderskins/textures"; |
||||
|
if (fs.existsSync( minetestPath + "/games/ENLIVEN")) { |
||||
|
skinDir = minetestPath + "/games/ENLIVEN/mods/codercore/coderskins/textures"; |
||||
|
} |
||||
|
console.log("[" + myName + "] skinDir: \"" + skinDir + "\""); |
||||
|
} |
||||
|
var thisMinetest = "/tank/local/owner/minetest"; |
||||
|
if (fs.existsSync(thisMinetest)) { |
||||
|
minetestPath = thisMinetest; |
||||
|
} |
||||
|
exports.regeneratePaths(); |
Loading…
Reference in new issue