mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-30 22:46:17 +02:00
Add Ability to Import All File Areas at Once #271
* Simple wildcard support for area tags param
This commit is contained in:
parent
d6dce82a92
commit
14f7ca9dcc
4 changed files with 41 additions and 3 deletions
|
@ -17,6 +17,7 @@ const StatLog = require('./stat_log.js');
|
|||
const UserProps = require('./user_property.js');
|
||||
const SysProps = require('./system_property.js');
|
||||
const SAUCE = require('./sauce.js');
|
||||
const { wildcardMatch } = require('./string_util');
|
||||
|
||||
// deps
|
||||
const _ = require('lodash');
|
||||
|
@ -40,6 +41,7 @@ exports.getAreaDefaultStorageDirectory = getAreaDefaultStorageDirectory;
|
|||
exports.getAreaStorageLocations = getAreaStorageLocations;
|
||||
exports.getDefaultFileAreaTag = getDefaultFileAreaTag;
|
||||
exports.getFileAreaByTag = getFileAreaByTag;
|
||||
exports.getFileAreasByTagWildcardRule = getFileAreasByTagWildcardRule;
|
||||
exports.getFileEntryPath = getFileEntryPath;
|
||||
exports.changeFileAreaWithOptions = changeFileAreaWithOptions;
|
||||
exports.scanFile = scanFile;
|
||||
|
@ -143,6 +145,15 @@ function getFileAreaByTag(areaTag) {
|
|||
}
|
||||
}
|
||||
|
||||
function getFileAreasByTagWildcardRule(rule) {
|
||||
const areaTags = Object.keys(Config().fileBase.areas)
|
||||
.filter(areaTag => {
|
||||
return !isInternalArea(areaTag) && wildcardMatch(areaTag, rule);
|
||||
});
|
||||
|
||||
return areaTags.map(areaTag => getFileAreaByTag(areaTag));
|
||||
}
|
||||
|
||||
function changeFileAreaWithOptions(client, areaTag, options, cb) {
|
||||
async.waterfall(
|
||||
[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue