mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Show PWS icon on mods installed from PWS
This commit is contained in:
parent
4ff59ddca5
commit
36bfcf7db3
@ -7,6 +7,7 @@
|
|||||||
"start": "node app.js"
|
"start": "node app.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"async": "^0.9.0",
|
||||||
"express": "3.x",
|
"express": "3.x",
|
||||||
"slug": "~0.4.0",
|
"slug": "~0.4.0",
|
||||||
"express-resource": "~1.0.0",
|
"express-resource": "~1.0.0",
|
||||||
|
BIN
public/images/playwithsix.png
Normal file
BIN
public/images/playwithsix.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
@ -1,9 +1,13 @@
|
|||||||
<td style="width: 100%;">
|
<td style="width: 100%;">
|
||||||
<a href='#mods/<%-name%>'><%-name%></a>
|
<a href='#mods/<%-name%>'><%-name%></a>
|
||||||
|
|
||||||
|
<% if (playWithSix) { %>
|
||||||
|
<img src="/images/playwithsix.png" height="20px" width="20px" />
|
||||||
|
<% } %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<% if (outdated) { %>
|
<% if (outdated) { %>
|
||||||
<a class="btn btn-primary btn-xs update pull-right ladda-button" data-style="expand-left">
|
<a class="btn btn-primary btn-xs update ladda-button" data-style="expand-left">
|
||||||
<span class="glyphicon glyphicon-save"></span>
|
<span class="glyphicon glyphicon-save"></span>
|
||||||
Update
|
Update
|
||||||
</a>
|
</a>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
var fs = require('fs')
|
var fs = require('fs')
|
||||||
, path = require('path')
|
, path = require('path')
|
||||||
|
, async = require('async')
|
||||||
, playwithsix = require('playwithsix')
|
, playwithsix = require('playwithsix')
|
||||||
, when = require('when')
|
, when = require('when')
|
||||||
, nodefn = require('when/node/function');
|
, nodefn = require('when/node/function');
|
||||||
@ -47,6 +48,15 @@ function walk (directory) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function isPlayWithSixMod(modPath, cb) {
|
||||||
|
var pwsFile = path.join(modPath, '.repository.yml');
|
||||||
|
fs.exists(pwsFile, function (exists) {
|
||||||
|
if (cb) {
|
||||||
|
cb(exists);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
exports.index = function(req, res){
|
exports.index = function(req, res){
|
||||||
fs.readdir(config.path, function (err, files) {
|
fs.readdir(config.path, function (err, files) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -57,9 +67,14 @@ exports.index = function(req, res){
|
|||||||
});
|
});
|
||||||
|
|
||||||
playwithsix.checkOutdated(config.path, function (err, outdatedMods) {
|
playwithsix.checkOutdated(config.path, function (err, outdatedMods) {
|
||||||
res.send(mods.map(function (mod) {
|
async.map(mods, function (mod, cb) {
|
||||||
return { name: mod, outdated: outdatedMods.indexOf(mod) >= 0 };
|
var modPath = path.join(config.path, mod);
|
||||||
}));
|
isPlayWithSixMod(modPath, function (isPlayWithSixMod) {
|
||||||
|
cb(null, { name: mod, outdated: outdatedMods.indexOf(mod) >= 0, playWithSix: isPlayWithSixMod });
|
||||||
|
});
|
||||||
|
}, function (err, mods) {
|
||||||
|
res.send(mods);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user