Commits (4)
......@@ -4,7 +4,7 @@ require("acmev2.js", "ACMEv2");
* File names used...
*/
var sks_fname = backslash(system.ctrl_dir)+"ssl.cert";
var maincnf_fname = backslash(system.ctrl_dir)+"main.cnf";
var main_ini_fname = backslash(system.ctrl_dir)+"main.ini";
var recycle_sem = backslash(system.ctrl_dir)+"recycle.web";
var csr_fname = backslash(system.ctrl_dir)+"csr.cert";
......@@ -14,7 +14,7 @@ var cert;
var domains = [system.inet_addr];
var i;
var ks;
var maincnf = new File(maincnf_fname);
var main_ini = new File(main_ini_fname);
var syspass;
var f;
......@@ -34,12 +34,10 @@ function create_dnsnames(names) {
return ext;
}
if (!maincnf.open("rb", true))
throw("Unable to open "+maincnf.name);
maincnf.position = 186; // Indeed.
syspass = maincnf.read(40);
syspass = syspass.replace(/\x00/g,'');
maincnf.close();
if (!main_ini.open("r", true))
throw("Unable to open "+main_ini.name);
syspass = main_ini.iniGetValue(null, "password");
main_ini.close();
for (i=0; i<argc; i++) {
if (argv[i] == '--domain' && i+1 < argc) {
......
......@@ -6,7 +6,7 @@ require("acmev2.js", "ACMEv2");
var ks_fname = backslash(system.ctrl_dir)+"letsyncrypt.key";
var setting_fname = backslash(system.ctrl_dir)+"letsyncrypt.ini";
var sks_fname = backslash(system.ctrl_dir)+"ssl.cert";
var maincnf_fname = backslash(system.ctrl_dir)+"main.cnf";
var main_ini_fname = backslash(system.ctrl_dir)+"main.ini";
var recycle_sem = backslash(system.ctrl_dir)+"recycle";
function at_least_a_third()
......@@ -149,7 +149,7 @@ var i;
var identifiers = [];
var ks;
var key_id;
var maincnf = new File(maincnf_fname);
var main_ini = new File(main_ini_fname);
var new_host = "acme-v02.api.letsencrypt.org";
var new_domain_hash = '';
var old_domain_hash;
......@@ -239,12 +239,10 @@ if (renew || rekey || revoke || print_tos) {
*
* TODO: What happens when the system password changes?
*/
if (!maincnf.open("rb", true))
throw("Unable to open "+maincnf.name);
maincnf.position = 186; // Indeed.
syspass = maincnf.read(40);
syspass = syspass.replace(/\x00/g,'');
maincnf.close();
if (!main_ini.open("r", true))
throw("Unable to open "+main_ini.name);
syspass = main_ini.iniGetValue(null, "password");
main_ini.close();
/*
* Now open/create the keyset and RSA signing key for
......
// $Id: text_sec.js,v 1.9 2020/05/08 17:27:47 rswindell Exp $
// [General] Text File Section ("G-Files")
// Replacement for Baja TEXT_FILE_SECTION and JS bbs.text_sec() functions
// Ported from src/sbbs3/text_sec.cpp
......@@ -11,10 +9,11 @@ require("nodedefs.js", 'NODE_RTXT');
require("cga_defs.js", 'LIGHTGRAY');
require("sbbsdefs.js", 'P_CPM_EOF');
if(!bbs.mods.cnflib)
bbs.mods.cnflib = load({}, "cnflib.js");
var file_cnf = bbs.mods.cnflib.read("file.cnf");
var file_cnf = new File(system.ctrl_dir + "file.ini");
if(!file_cnf.open(file_cnf.exists ? 'r+':'w+')) {
alert("Error opening " + file_cnf.name);
exit(0);
}
function txtsec_data(sec)
{
......@@ -50,9 +49,11 @@ function write_list(sec, list)
}
var usrsec = [];
for(var i in file_cnf.txtsec) {
if(bbs.compare_ars(file_cnf.txtsec[i].ars))
usrsec.push(file_cnf.txtsec[i]);
var txtsec = file_cnf.iniGetAllObjects("code", "text:");
file_cnf.close();
for(var i in txtsec) {
if(bbs.compare_ars(txtsec[i].ars))
usrsec.push(txtsec[i]);
}
if(!usrsec.length) {
console.print(bbs.text(NoTextSections));
......@@ -131,17 +132,8 @@ while(bbs.online) {
var path = console.getstr(path, 128, K_EDIT|K_LINE|K_TRIM);
if(!path || console.aborted)
break;
if(!file_exists(path)) {
var default_path = backslash(txtsec_data(usrsec[cursec])) + path;
if (!file_exists(default_path)) {
console.print(bbs.text(FileNotFound));
break;
} else {
// only change the path if the file was found, otherwise
// leave it alone so they can correct it
path = default_path;
}
}
if(!file_exists(path))
path = backslash(txtsec_data(usrsec[cursec])) + path;
console.printfile(path);
console.crlf();
console.print(bbs.text(AddTextFileDesc));
......@@ -194,25 +186,21 @@ while(bbs.online) {
alert("Sorry, you can't read that file");
break;
}
if(!list[cmd].path) {
alert("Sorry, that file doesn't exist yet");
break;
}
if(file_size(list[cmd].path) < 1) {
alert("Sorry, that file doens't have any content yet");
break;
}
var mode = P_OPENCLOSE | P_CPM_EOF;
var mode = P_CPM_EOF;
if(list[cmd].mode !== undefined)
mode = eval(list[cmd].mode);
if(list[cmd].petscii_graphics)
console.putbyte(142);
if(console.term_supports(USER_RIP))
console.write("\x02|*\r\n");
if(list[cmd].tail)
console.printtail(list[cmd].path, list[cmd].tail, mode);
else
console.printfile(list[cmd].path, mode);
log(LOG_INFO, "read text file: " + list[cmd].path);
console.pause();
if(console.term_supports(USER_RIP))
console.write("\x02|*\r\n");
}
break;
}
......
......@@ -37,15 +37,15 @@ if(argv.indexOf("-install") >= 0)
{
print("Installing TickFix");
var cnflib = load({}, "cnflib.js");
var xtrn_cnf = cnflib.read("xtrn.cnf");
if(!xtrn_cnf)
js.report_error("Failed to read xtrn.cnf", /* fatal */true);
var cfglib = load({}, "cfglib.js");
var xtrn_cfg = cfglib.read("xtrn.ini");
if(!xtrn_cfg)
js.report_error("Failed to read xtrn.ini", /* fatal */true);
var changed = false;
if(!xtrn_area.event["tickfix"]) {
print("Adding timed event: TICKFIX");
xtrn_cnf.event.push( {
xtrn_cfg.event.push( {
"code": "TICKFIX",
"cmd": "?tickfix",
"days": 0,
......@@ -59,8 +59,8 @@ if(argv.indexOf("-install") >= 0)
});
changed = true;
}
if(changed && !cnflib.write("xtrn.cnf", undefined, xtrn_cnf))
js.report_error("Failed to write xtrn.cnf", /* fatal */true);
if(changed && !cfglib.write("xtrn.ini", undefined, xtrn_cfg))
js.report_error("Failed to write xtrn.ini", /* fatal */true);
var f = new File(file_cfgname(system.ctrl_dir, "sbbsecho.ini"));
file_backup(f.name, backup_level);
......