From 46088a9f02dd8273e3c11744bee9fe790e00614d Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sun, 1 Nov 2015 13:32:52 -0700 Subject: [PATCH] * Update to encode()/decode() direct calls for iconv-lite * Overrite font (to not use!) when showing pause prompts - they should use the current set by menu/art --- README.md | 2 +- core/ansi_term.js | 2 +- core/art.js | 21 +++++++++++---------- core/client_term.js | 2 +- core/theme.js | 10 ++++++++-- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 6e8543cf..bc5b2448 100644 --- a/README.md +++ b/README.md @@ -53,8 +53,8 @@ git clone https://github.com/NuSkooler/enigma-bbs.git ``` **Create a Config** -Create new *~/.enigma-bbs/config.hjson* file. Example: ```hjson +/* ~/.enigma-bbs/config.hjson */ general: { boardName: Super Awesome BBS } diff --git a/core/ansi_term.js b/core/ansi_term.js index c7eacb35..b036d1cc 100644 --- a/core/ansi_term.js +++ b/core/ansi_term.js @@ -244,7 +244,7 @@ function setSyncTERMFont(name, fontPage) { assert(p1 >= 0 && p1 <= 3); - var p2 = SYNCTERM_FONT_AND_ENCODING_TABLE[name]; + var p2 = SYNCTERM_FONT_AND_ENCODING_TABLE.indexOf(name); if(_.isNumber(p2)) { return ESC_CSI + p1 + ';' + p2 + ' D'; } diff --git a/core/art.js b/core/art.js index eb3067d6..ef52f070 100644 --- a/core/art.js +++ b/core/art.js @@ -35,7 +35,9 @@ var SUPPORTED_ART_TYPES = { '.asc' : { name : 'ASCII', defaultEncoding : 'cp437', eof : 0x1a }, '.pcb' : { name : 'PCBoard', defaultEncoding : 'cp437', eof : 0x1a }, '.bbs' : { name : 'Wildcat', defaultEncoding : 'cp437', eof : 0x1a }, - '.txt' : { name : 'Text', defaultEncoding : 'cp437', eof : 0x1a }, // :TODO: think about this more... + + '.amiga' : { name : 'Amiga', defaultEncoding : 'amiga', eof : 0x1a }, + '.txt' : { name : 'Amiga Text', defaultEncoding : 'cp437', eof : 0x1a }, // :TODO: extentions for wwiv, renegade, celerity, syncronet, ... // :TODO: extension for atari // :TODO: extension for topaz ansi/ascii. @@ -79,7 +81,7 @@ function readSAUCE(data, cb) { return; } - var ver = vars.version.toString('cp437'); + var ver = iconv.decode(vars.version, 'cp437'); if('00' !== ver) { cb(new Error('Unsupported SAUCE version: ' + ver)); @@ -87,12 +89,12 @@ function readSAUCE(data, cb) { } var sauce = { - id : vars.id.toString('cp437'), - version : vars.version.toString('cp437'), - title : vars.title.toString('cp437').trim(), - author : vars.author.toString('cp437').trim(), - group : vars.group.toString('cp437').trim(), - date : vars.date.toString('cp437').trim(), + id : iconv.decode(vars.id, 'cp437'), + version : iconv.decode(vars.version, 'cp437').trim(), + title : iconv.decode(vars.title, 'cp437').trim(), + author : iconv.decode(vars.author, 'cp437').trim(), + group : iconv.decode(vars.group, 'cp437').trim(), + date : iconv.decode(vars.date, 'cp437').trim(), fileSize : vars.fileSize, dataType : vars.dataType, fileType : vars.fileType, @@ -182,7 +184,7 @@ function parseCharacterSAUCE(sauce) { while(i < sauce.tinfos.length && sauce.tinfos[i] !== 0x00) { ++i; } - var fontName = sauce.tinfos.slice(0, i).toString('cp437'); + var fontName = iconv.decode(sauce.tinfos.slice(0, i), 'cp437'); if(fontName.length > 0) { result.fontName = fontName; } @@ -525,7 +527,6 @@ function display(options, cb) { // :TODO: If options.font, set the font via ANSI // ...this should come from sauce, be passed in, or defaulted - var ansiFont = ''; if(options.font) { // :TODO: how to set to ignore SAUCE? diff --git a/core/client_term.js b/core/client_term.js index c1c26b6e..53b4e48c 100644 --- a/core/client_term.js +++ b/core/client_term.js @@ -10,7 +10,7 @@ var iconv = require('iconv-lite'); var assert = require('assert'); var _ = require('lodash'); -iconv.extendNodeEncodings(); +//iconv.extendNodeEncodings(); exports.ClientTerminal = ClientTerminal; diff --git a/core/theme.js b/core/theme.js index 3933a161..8ada3fe1 100644 --- a/core/theme.js +++ b/core/theme.js @@ -280,16 +280,22 @@ function displayThemedPause(options, cb) { promptConfig = promptJson.prompts.pause; callback(_.isObject(promptConfig) ? null : new Error('Invalid prompt config block!')); } else { - callback(new Error('Missing standard \'pause\' prompt')) + callback(new Error('Missing standard \'pause\' prompt')); } } }); }, function displayPausePrompt(callback) { + // + // Override .font so it doesn't change from current setting + // + var dispOptions = promptConfig.options; + dispOptions.font = 'not_really_a_font!'; + displayThemedAsset( promptConfig.art, options.client, - promptConfig.options, + dispOptions, function displayed(err, artData) { artInfo = artData; callback(err);