Move the various scripts into a dedicated folder
This commit is contained in:
parent
05f464ce4d
commit
0870a0651f
@ -54,7 +54,7 @@ let data = [];
|
|||||||
let pinned = [];
|
let pinned = [];
|
||||||
|
|
||||||
nThen((waitFor) => {
|
nThen((waitFor) => {
|
||||||
let f = './pins/' + edPublic.slice(0, 2) + '/' + edPublic + '.ndjson';
|
let f = '../pins/' + edPublic.slice(0, 2) + '/' + edPublic + '.ndjson';
|
||||||
Fs.readFile(f, waitFor((err, content) => {
|
Fs.readFile(f, waitFor((err, content) => {
|
||||||
if (err) { throw err; }
|
if (err) { throw err; }
|
||||||
pinned = hashesFromPinFile(content.toString('utf8'), f);
|
pinned = hashesFromPinFile(content.toString('utf8'), f);
|
||||||
@ -1,7 +1,7 @@
|
|||||||
/* globals Buffer */
|
/* globals Buffer */
|
||||||
var Https = require('https');
|
var Https = require('https');
|
||||||
var Config = require("./config.js");
|
var Config = require("../config/config.js");
|
||||||
var Package = require("./package.json");
|
var Package = require("../package.json");
|
||||||
|
|
||||||
var body = JSON.stringify({
|
var body = JSON.stringify({
|
||||||
domain: Config.myDomain,
|
domain: Config.myDomain,
|
||||||
@ -5,9 +5,9 @@ const Saferphore = require("saferphore");
|
|||||||
const PinnedData = require('./pinneddata');
|
const PinnedData = require('./pinneddata');
|
||||||
let config;
|
let config;
|
||||||
try {
|
try {
|
||||||
config = require('./config');
|
config = require('../config/config');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
config = require('./config.example');
|
config = require('../config/config.example');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.inactiveTime || typeof(config.inactiveTime) !== "number") { return; }
|
if (!config.inactiveTime || typeof(config.inactiveTime) !== "number") { return; }
|
||||||
@ -5,13 +5,13 @@ var nThen = require("nthen");
|
|||||||
|
|
||||||
var config;
|
var config;
|
||||||
try {
|
try {
|
||||||
config = require('./config');
|
config = require('../config/config');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
config = require('./config.example');
|
config = require('../config/config.example');
|
||||||
}
|
}
|
||||||
|
|
||||||
var FileStorage = require(config.storage || './storage/file');
|
var FileStorage = require('../' + config.storage || './storage/file');
|
||||||
var root = Path.resolve(config.taskPath || './tasks');
|
var root = Path.resolve('../' + config.taskPath || './tasks');
|
||||||
|
|
||||||
var dirs;
|
var dirs;
|
||||||
var nt;
|
var nt;
|
||||||
@ -35,7 +35,7 @@ const hashesFromPinFile = (pinFile, fileName) => {
|
|||||||
|
|
||||||
module.exports.load = function (cb, config) {
|
module.exports.load = function (cb, config) {
|
||||||
nThen((waitFor) => {
|
nThen((waitFor) => {
|
||||||
Fs.readdir('./pins', waitFor((err, list) => {
|
Fs.readdir('../pins', waitFor((err, list) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.code === 'ENOENT') {
|
if (err.code === 'ENOENT') {
|
||||||
dirList = [];
|
dirList = [];
|
||||||
@ -48,11 +48,11 @@ module.exports.load = function (cb, config) {
|
|||||||
}).nThen((waitFor) => {
|
}).nThen((waitFor) => {
|
||||||
dirList.forEach((f) => {
|
dirList.forEach((f) => {
|
||||||
sema.take((returnAfter) => {
|
sema.take((returnAfter) => {
|
||||||
Fs.readdir('./pins/' + f, waitFor(returnAfter((err, list2) => {
|
Fs.readdir('../pins/' + f, waitFor(returnAfter((err, list2) => {
|
||||||
if (err) { throw err; }
|
if (err) { throw err; }
|
||||||
list2.forEach((ff) => {
|
list2.forEach((ff) => {
|
||||||
if (config && config.exclude && config.exclude.indexOf(ff) > -1) { return; }
|
if (config && config.exclude && config.exclude.indexOf(ff) > -1) { return; }
|
||||||
fileList.push('./pins/' + f + '/' + ff);
|
fileList.push('../pins/' + f + '/' + ff);
|
||||||
});
|
});
|
||||||
})));
|
})));
|
||||||
});
|
});
|
||||||
@ -65,7 +65,7 @@ const pinned = {}; // map of pinned files
|
|||||||
module.exports.load = function (config, cb) {
|
module.exports.load = function (config, cb) {
|
||||||
nThen((waitFor) => {
|
nThen((waitFor) => {
|
||||||
// read the subdirectories in the datastore
|
// read the subdirectories in the datastore
|
||||||
Fs.readdir('./datastore', waitFor((err, list) => {
|
Fs.readdir('../datastore', waitFor((err, list) => {
|
||||||
if (err) { throw err; }
|
if (err) { throw err; }
|
||||||
dirList = list;
|
dirList = list;
|
||||||
}));
|
}));
|
||||||
@ -76,15 +76,15 @@ module.exports.load = function (config, cb) {
|
|||||||
sema.take((returnAfter) => {
|
sema.take((returnAfter) => {
|
||||||
// get the list of files in every subdirectory
|
// get the list of files in every subdirectory
|
||||||
// and push them to 'fileList'
|
// and push them to 'fileList'
|
||||||
Fs.readdir('./datastore/' + f, waitFor(returnAfter((err, list2) => {
|
Fs.readdir('../datastore/' + f, waitFor(returnAfter((err, list2) => {
|
||||||
if (err) { throw err; }
|
if (err) { throw err; }
|
||||||
list2.forEach((ff) => { fileList.push('./datastore/' + f + '/' + ff); });
|
list2.forEach((ff) => { fileList.push('../datastore/' + f + '/' + ff); });
|
||||||
})));
|
})));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}).nThen((waitFor) => {
|
}).nThen((waitFor) => {
|
||||||
// read the subdirectories in 'blob'
|
// read the subdirectories in 'blob'
|
||||||
Fs.readdir('./blob', waitFor((err, list) => {
|
Fs.readdir('../blob', waitFor((err, list) => {
|
||||||
if (err) { throw err; }
|
if (err) { throw err; }
|
||||||
// overwrite dirList
|
// overwrite dirList
|
||||||
dirList = list;
|
dirList = list;
|
||||||
@ -96,9 +96,9 @@ module.exports.load = function (config, cb) {
|
|||||||
sema.take((returnAfter) => {
|
sema.take((returnAfter) => {
|
||||||
// get the list of files in every subdirectory
|
// get the list of files in every subdirectory
|
||||||
// and push them to 'fileList'
|
// and push them to 'fileList'
|
||||||
Fs.readdir('./blob/' + f, waitFor(returnAfter((err, list2) => {
|
Fs.readdir('../blob/' + f, waitFor(returnAfter((err, list2) => {
|
||||||
if (err) { throw err; }
|
if (err) { throw err; }
|
||||||
list2.forEach((ff) => { fileList.push('./blob/' + f + '/' + ff); });
|
list2.forEach((ff) => { fileList.push('../blob/' + f + '/' + ff); });
|
||||||
})));
|
})));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -118,7 +118,7 @@ module.exports.load = function (config, cb) {
|
|||||||
});
|
});
|
||||||
}).nThen((waitFor) => {
|
}).nThen((waitFor) => {
|
||||||
// read the subdirectories in the pinstore
|
// read the subdirectories in the pinstore
|
||||||
Fs.readdir('./pins', waitFor((err, list) => {
|
Fs.readdir('../pins', waitFor((err, list) => {
|
||||||
if (err) { throw err; }
|
if (err) { throw err; }
|
||||||
dirList = list;
|
dirList = list;
|
||||||
}));
|
}));
|
||||||
@ -131,9 +131,9 @@ module.exports.load = function (config, cb) {
|
|||||||
sema.take((returnAfter) => {
|
sema.take((returnAfter) => {
|
||||||
// get the list of files in every subdirectory
|
// get the list of files in every subdirectory
|
||||||
// and push them to 'fileList' (which is empty because we keep reusing it)
|
// and push them to 'fileList' (which is empty because we keep reusing it)
|
||||||
Fs.readdir('./pins/' + f, waitFor(returnAfter((err, list2) => {
|
Fs.readdir('../pins/' + f, waitFor(returnAfter((err, list2) => {
|
||||||
if (err) { throw err; }
|
if (err) { throw err; }
|
||||||
list2.forEach((ff) => { fileList.push('./pins/' + f + '/' + ff); });
|
list2.forEach((ff) => { fileList.push('../pins/' + f + '/' + ff); });
|
||||||
})));
|
})));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user