Insert Image model + Uploads Folders list

This commit is contained in:
NGPixel
2016-09-18 23:03:19 -04:00
parent 405e23f01e
commit 567e1307da
14 changed files with 293 additions and 78 deletions

View File

@@ -75,12 +75,15 @@ var job = new cron({
let jobs = [];
let repoPath = path.resolve(ROOTPATH, appconfig.datadir.repo);
let uploadsPath = path.join(repoPath, 'uploads');
// ----------------------------------------
// Compile Jobs
// ----------------------------------------
//*****************************************
//-> Resync with Git remote
//*****************************************
jobs.push(git.onReady.then(() => {
return git.resync().then(() => {
@@ -140,6 +143,24 @@ var job = new cron({
});
}));
//*****************************************
//-> Refresh uploads data
//*****************************************
jobs.push(fs.readdirAsync(uploadsPath).then((ls) => {
return Promise.map(ls, (f) => {
return fs.statAsync(path.join(uploadsPath, f)).then((s) => { return { filename: f, stat: s }; });
}).filter((s) => { return s.stat.isDirectory(); }).then((arrStats) => {
ws.emit('uploadsSetFolders', {
auth: WSInternalKey,
content: _.map(arrStats, 'filename')
});
return true;
});
}));
// ----------------------------------------
// Run
// ----------------------------------------