Merge branch 'master' of ssh://numinibsd/git/base/enigma-bbs
This commit is contained in:
commit
6c67f0e024
1666
core/acs_parser.js
1666
core/acs_parser.js
File diff suppressed because it is too large
Load Diff
|
@ -32,6 +32,7 @@ exports.getFileEntryPath = getFileEntryPath;
|
||||||
exports.changeFileAreaWithOptions = changeFileAreaWithOptions;
|
exports.changeFileAreaWithOptions = changeFileAreaWithOptions;
|
||||||
exports.scanFile = scanFile;
|
exports.scanFile = scanFile;
|
||||||
exports.scanFileAreaForChanges = scanFileAreaForChanges;
|
exports.scanFileAreaForChanges = scanFileAreaForChanges;
|
||||||
|
exports.getDescFromFileName = getDescFromFileName;
|
||||||
|
|
||||||
const WellKnownAreaTags = exports.WellKnownAreaTags = {
|
const WellKnownAreaTags = exports.WellKnownAreaTags = {
|
||||||
Invalid : '',
|
Invalid : '',
|
||||||
|
@ -670,3 +671,11 @@ function scanFileAreaForChanges(areaInfo, options, iterator, cb) {
|
||||||
return cb(err);
|
return cb(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDescFromFileName(fileName) {
|
||||||
|
// :TODO: this method could use some more logic to really be nice.
|
||||||
|
const ext = paths.extname(fileName);
|
||||||
|
const name = paths.basename(fileName, ext);
|
||||||
|
|
||||||
|
return _.upperFirst(name.replace(/[\-_.+]/g, ' ').replace(/\s+/g, ' '));
|
||||||
|
}
|
|
@ -290,8 +290,9 @@ module.exports = class FileEntry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// :TODO: Use static get accessor:
|
static get WellKnownMetaValues() {
|
||||||
static getWellKnownMetaValues() { return Object.keys(FILE_WELL_KNOWN_META); }
|
return Object.keys(FILE_WELL_KNOWN_META);
|
||||||
|
}
|
||||||
|
|
||||||
static findFileBySha(sha, cb) {
|
static findFileBySha(sha, cb) {
|
||||||
// full or partial SHA-256
|
// full or partial SHA-256
|
||||||
|
|
|
@ -93,8 +93,9 @@ class PacketHeader {
|
||||||
|
|
||||||
// See FSC-48
|
// See FSC-48
|
||||||
if(address.point) {
|
if(address.point) {
|
||||||
|
this.auxNet = address.origNet;
|
||||||
this.origNet = -1;
|
this.origNet = -1;
|
||||||
this.auxNet = address.net;
|
|
||||||
} else {
|
} else {
|
||||||
this.origNet = address.net;
|
this.origNet = address.net;
|
||||||
this.auxNet = 0;
|
this.auxNet = 0;
|
||||||
|
@ -296,7 +297,7 @@ function Packet(options) {
|
||||||
|
|
||||||
buffer.writeUInt16LE(packetHeader.baud, 16);
|
buffer.writeUInt16LE(packetHeader.baud, 16);
|
||||||
buffer.writeUInt16LE(FTN_PACKET_HEADER_TYPE, 18);
|
buffer.writeUInt16LE(FTN_PACKET_HEADER_TYPE, 18);
|
||||||
buffer.writeUInt16LE(-1 === packetHeader.origNet ? 0xff : packetHeader.origNet, 20);
|
buffer.writeUInt16LE(-1 === packetHeader.origNet ? 0xffff : packetHeader.origNet, 20);
|
||||||
buffer.writeUInt16LE(packetHeader.destNet, 22);
|
buffer.writeUInt16LE(packetHeader.destNet, 22);
|
||||||
buffer.writeUInt8(packetHeader.prodCodeLo, 24);
|
buffer.writeUInt8(packetHeader.prodCodeLo, 24);
|
||||||
buffer.writeUInt8(packetHeader.prodRevHi, 25);
|
buffer.writeUInt8(packetHeader.prodRevHi, 25);
|
||||||
|
@ -334,7 +335,7 @@ function Packet(options) {
|
||||||
|
|
||||||
buffer.writeUInt16LE(packetHeader.baud, 16);
|
buffer.writeUInt16LE(packetHeader.baud, 16);
|
||||||
buffer.writeUInt16LE(FTN_PACKET_HEADER_TYPE, 18);
|
buffer.writeUInt16LE(FTN_PACKET_HEADER_TYPE, 18);
|
||||||
buffer.writeUInt16LE(-1 === packetHeader.origNet ? 0xff : packetHeader.origNet, 20);
|
buffer.writeUInt16LE(-1 === packetHeader.origNet ? 0xffff : packetHeader.origNet, 20);
|
||||||
buffer.writeUInt16LE(packetHeader.destNet, 22);
|
buffer.writeUInt16LE(packetHeader.destNet, 22);
|
||||||
buffer.writeUInt8(packetHeader.prodCodeLo, 24);
|
buffer.writeUInt8(packetHeader.prodCodeLo, 24);
|
||||||
buffer.writeUInt8(packetHeader.prodRevHi, 25);
|
buffer.writeUInt8(packetHeader.prodRevHi, 25);
|
||||||
|
|
|
@ -23,7 +23,14 @@ const exitCodes = exports.ExitCodes = {
|
||||||
BAD_ARGS : -3,
|
BAD_ARGS : -3,
|
||||||
};
|
};
|
||||||
|
|
||||||
const argv = exports.argv = require('minimist')(process.argv.slice(2));
|
const argv = exports.argv = require('minimist')(process.argv.slice(2), {
|
||||||
|
alias : {
|
||||||
|
h : 'help',
|
||||||
|
v : 'version',
|
||||||
|
c : 'config',
|
||||||
|
n : 'no-prompt',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function printUsageAndSetExitCode(errMsg, exitCode) {
|
function printUsageAndSetExitCode(errMsg, exitCode) {
|
||||||
if(_.isUndefined(exitCode)) {
|
if(_.isUndefined(exitCode)) {
|
||||||
|
|
|
@ -9,12 +9,14 @@ const initConfigAndDatabases = require('./oputil_common.js').initConfigAndDataba
|
||||||
const getHelpFor = require('./oputil_help.js').getHelpFor;
|
const getHelpFor = require('./oputil_help.js').getHelpFor;
|
||||||
const getAreaAndStorage = require('./oputil_common.js').getAreaAndStorage;
|
const getAreaAndStorage = require('./oputil_common.js').getAreaAndStorage;
|
||||||
const Errors = require('../../core/enig_error.js').Errors;
|
const Errors = require('../../core/enig_error.js').Errors;
|
||||||
|
const getDescFromFileName = require('../../core/file_base_area.js').getDescFromFileName;
|
||||||
|
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const paths = require('path');
|
const paths = require('path');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
|
const inq = require('inquirer');
|
||||||
|
|
||||||
exports.handleFileBaseCommand = handleFileBaseCommand;
|
exports.handleFileBaseCommand = handleFileBaseCommand;
|
||||||
|
|
||||||
|
@ -33,6 +35,40 @@ exports.handleFileBaseCommand = handleFileBaseCommand;
|
||||||
|
|
||||||
let fileArea; // required during init
|
let fileArea; // required during init
|
||||||
|
|
||||||
|
function finalizeEntryAndPersist(fileEntry, cb) {
|
||||||
|
async.series(
|
||||||
|
[
|
||||||
|
function getDescIfNeeded(callback) {
|
||||||
|
if(false === argv.prompt || ( fileEntry.desc && fileEntry.desc.length > 0 ) ) {
|
||||||
|
return callback(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
const questions = [
|
||||||
|
{
|
||||||
|
name : 'desc',
|
||||||
|
message : `Description for ${fileEntry.fileName}:`,
|
||||||
|
type : 'input',
|
||||||
|
default : getDescFromFileName(fileEntry.fileName),
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
inq.prompt(questions).then( answers => {
|
||||||
|
fileEntry.desc = answers.desc;
|
||||||
|
return callback(null);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function persist(callback) {
|
||||||
|
fileEntry.persist( err => {
|
||||||
|
return callback(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
],
|
||||||
|
err => {
|
||||||
|
return cb(err);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function scanFileAreaForChanges(areaInfo, options, cb) {
|
function scanFileAreaForChanges(areaInfo, options, cb) {
|
||||||
|
|
||||||
const storageLocations = fileArea.getAreaStorageLocations(areaInfo).filter(sl => {
|
const storageLocations = fileArea.getAreaStorageLocations(areaInfo).filter(sl => {
|
||||||
|
@ -94,7 +130,7 @@ function scanFileAreaForChanges(areaInfo, options, cb) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fileEntry.persist( err => {
|
finalizeEntryAndPersist(fileEntry, err => {
|
||||||
return nextFile(err);
|
return nextFile(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,13 +12,13 @@ const usageHelp = exports.USAGE_HELP = {
|
||||||
<command> [<args>]
|
<command> [<args>]
|
||||||
|
|
||||||
global args:
|
global args:
|
||||||
--config PATH : specify config path (${getDefaultConfigPath()})
|
-c, --config PATH : specify config path (${getDefaultConfigPath()})
|
||||||
--no-prompt : assume defaults/don't prompt for input where possible
|
-n, --no-prompt : assume defaults/don't prompt for input where possible
|
||||||
|
|
||||||
where <command> is one of:
|
where <command> is one of:
|
||||||
user : user utilities
|
user : user utilities
|
||||||
config : config file management
|
config : config file management
|
||||||
fb : file base management
|
fb : file base management
|
||||||
|
|
||||||
`,
|
`,
|
||||||
User :
|
User :
|
||||||
|
|
|
@ -22,7 +22,7 @@ module.exports = function() {
|
||||||
if(0 === argv._.length ||
|
if(0 === argv._.length ||
|
||||||
'help' === argv._[0])
|
'help' === argv._[0])
|
||||||
{
|
{
|
||||||
printUsageAndSetExitCode(getHelpFor('General'), ExitCodes.SUCCESS);
|
return printUsageAndSetExitCode(getHelpFor('General'), ExitCodes.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(argv._[0]) {
|
switch(argv._[0]) {
|
||||||
|
|
|
@ -142,6 +142,8 @@ const OPTIONS = {
|
||||||
//SSPI_LOGON : 139,
|
//SSPI_LOGON : 139,
|
||||||
//PRAGMA_HEARTBEAT : 140
|
//PRAGMA_HEARTBEAT : 140
|
||||||
|
|
||||||
|
ARE_YOU_THERE : 246, // aka 'AYT' RFC 854 @ https://tools.ietf.org/html/rfc854
|
||||||
|
|
||||||
EXTENDED_OPTIONS_LIST : 255, // RFC 861 (STD 32)
|
EXTENDED_OPTIONS_LIST : 255, // RFC 861 (STD 32)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -192,7 +194,7 @@ OPTION_IMPLS[OPTIONS.TERMINAL_SPEED] =
|
||||||
OPTION_IMPLS[OPTIONS.REMOTE_FLOW_CONTROL] =
|
OPTION_IMPLS[OPTIONS.REMOTE_FLOW_CONTROL] =
|
||||||
OPTION_IMPLS[OPTIONS.X_DISPLAY_LOCATION] =
|
OPTION_IMPLS[OPTIONS.X_DISPLAY_LOCATION] =
|
||||||
OPTION_IMPLS[OPTIONS.SEND_LOCATION] =
|
OPTION_IMPLS[OPTIONS.SEND_LOCATION] =
|
||||||
|
OPTION_IMPLS[OPTIONS.ARE_YOU_THERE] =
|
||||||
OPTION_IMPLS[OPTIONS.SUPPRESS_GO_AHEAD] = function(bufs, i, event) {
|
OPTION_IMPLS[OPTIONS.SUPPRESS_GO_AHEAD] = function(bufs, i, event) {
|
||||||
event.buf = bufs.splice(0, i).toBuffer();
|
event.buf = bufs.splice(0, i).toBuffer();
|
||||||
return event;
|
return event;
|
||||||
|
|
|
@ -44,12 +44,12 @@
|
||||||
return client.node === value;
|
return client.node === value;
|
||||||
},
|
},
|
||||||
NP : function numberOfPosts() {
|
NP : function numberOfPosts() {
|
||||||
// :TODO: implement me!!!!
|
const postCount = parseInt(user.properties.post_count, 10);
|
||||||
return false;
|
return !isNaN(value) && postCount >= value;
|
||||||
},
|
},
|
||||||
NC : function numberOfCalls() {
|
NC : function numberOfCalls() {
|
||||||
// :TODO: implement me!!
|
const loginCount = parseInt(user.properties.login_count, 10);
|
||||||
return false;
|
return !isNaN(value) && loginCount >= value;
|
||||||
},
|
},
|
||||||
SC : function isSecureConnection() {
|
SC : function isSecureConnection() {
|
||||||
return client.session.isSecure;
|
return client.session.isSecure;
|
||||||
|
|
|
@ -229,7 +229,7 @@ exports.getModule = class FileAreaList extends MenuModule {
|
||||||
// We need the entry object to contain meta keys even if they are empty as
|
// We need the entry object to contain meta keys even if they are empty as
|
||||||
// consumers may very likely attempt to use them
|
// consumers may very likely attempt to use them
|
||||||
//
|
//
|
||||||
const metaValues = FileEntry.getWellKnownMetaValues();
|
const metaValues = FileEntry.WellKnownMetaValues;
|
||||||
metaValues.forEach(name => {
|
metaValues.forEach(name => {
|
||||||
const value = !_.isUndefined(currEntry.meta[name]) ? currEntry.meta[name] : 'N/A';
|
const value = !_.isUndefined(currEntry.meta[name]) ? currEntry.meta[name] : 'N/A';
|
||||||
entryInfo[_.camelCase(name)] = value;
|
entryInfo[_.camelCase(name)] = value;
|
||||||
|
|
|
@ -8,6 +8,7 @@ const getSortedAvailableFileAreas = require('../core/file_base_area.js').getSor
|
||||||
const getAreaDefaultStorageDirectory = require('../core/file_base_area.js').getAreaDefaultStorageDirectory;
|
const getAreaDefaultStorageDirectory = require('../core/file_base_area.js').getAreaDefaultStorageDirectory;
|
||||||
const scanFile = require('../core/file_base_area.js').scanFile;
|
const scanFile = require('../core/file_base_area.js').scanFile;
|
||||||
const getFileAreaByTag = require('../core/file_base_area.js').getFileAreaByTag;
|
const getFileAreaByTag = require('../core/file_base_area.js').getFileAreaByTag;
|
||||||
|
const getDescFromFileName = require('../core/file_base_area.js').getDescFromFileName;
|
||||||
const ansiGoto = require('../core/ansi_term.js').goto;
|
const ansiGoto = require('../core/ansi_term.js').goto;
|
||||||
const moveFileWithCollisionHandling = require('../core/file_util.js').moveFileWithCollisionHandling;
|
const moveFileWithCollisionHandling = require('../core/file_util.js').moveFileWithCollisionHandling;
|
||||||
const pathWithTerminatingSeparator = require('../core/file_util.js').pathWithTerminatingSeparator;
|
const pathWithTerminatingSeparator = require('../core/file_util.js').pathWithTerminatingSeparator;
|
||||||
|
@ -673,7 +674,7 @@ exports.getModule = class UploadModule extends MenuModule {
|
||||||
|
|
||||||
tagsView.setText( Array.from(fileEntry.hashTags).join(',') ); // :TODO: optional 'hashTagsSep' like file list/browse
|
tagsView.setText( Array.from(fileEntry.hashTags).join(',') ); // :TODO: optional 'hashTagsSep' like file list/browse
|
||||||
yearView.setText(fileEntry.meta.est_release_year || '');
|
yearView.setText(fileEntry.meta.est_release_year || '');
|
||||||
|
|
||||||
if(self.fileEntryHasDetectedDesc(fileEntry)) {
|
if(self.fileEntryHasDetectedDesc(fileEntry)) {
|
||||||
descView.setPropertyValue('mode', 'preview');
|
descView.setPropertyValue('mode', 'preview');
|
||||||
descView.setText(fileEntry.desc);
|
descView.setText(fileEntry.desc);
|
||||||
|
@ -681,7 +682,7 @@ exports.getModule = class UploadModule extends MenuModule {
|
||||||
self.viewControllers.fileDetails.switchFocus(MciViewIds.fileDetails.tags);
|
self.viewControllers.fileDetails.switchFocus(MciViewIds.fileDetails.tags);
|
||||||
} else {
|
} else {
|
||||||
descView.setPropertyValue('mode', 'edit');
|
descView.setPropertyValue('mode', 'edit');
|
||||||
descView.setText('');
|
descView.setText(getDescFromFileName(fileEntry.fileName)); // try to come up with something good as a default
|
||||||
descView.acceptsFocus = true;
|
descView.acceptsFocus = true;
|
||||||
self.viewControllers.fileDetails.switchFocus(MciViewIds.fileDetails.desc);
|
self.viewControllers.fileDetails.switchFocus(MciViewIds.fileDetails.desc);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue