Added config for gpg key
This commit is contained in:
parent
e6e9396c8d
commit
a5231cb7ff
4
ctrl/videotex.ini
Normal file
4
ctrl/videotex.ini
Normal file
@ -0,0 +1,4 @@
|
||||
; Videotex Options
|
||||
|
||||
; Our key used to sign frames we send to other systems
|
||||
; gpg_key=516@videotex
|
@ -1,6 +1,8 @@
|
||||
load('texdefs.js');
|
||||
load('texfuncs.js');
|
||||
|
||||
var options = loadOptions();
|
||||
|
||||
// Modes of operation:
|
||||
// -s -p x -i y = To send a stored page via the msgbase
|
||||
// {-s} -p x -i y -f file = To update (and optionally send) a page with new content
|
||||
@ -92,7 +94,11 @@ if (! send || ! frame || file) {
|
||||
}
|
||||
|
||||
// @NOTE: We need to use a binary signature then base64 encode it, as mailers may strip 0x0a while messages are in transit.
|
||||
if (send == 1) {
|
||||
if (send == 1 && options.gpg_key) {
|
||||
if (! file) {
|
||||
file = system.text_dir+'ansitex/'+frame.page+'.tex';
|
||||
}
|
||||
|
||||
if (! file_exists(file)) {
|
||||
log(LOG_ERROR,'! ERROR: File '+file+' doesnt exist?');
|
||||
exit(1);
|
||||
@ -101,7 +107,7 @@ if (send == 1) {
|
||||
if (file_exists(file+'.gpg'))
|
||||
file_remove(file+'.gpg')
|
||||
|
||||
result = system.exec('gpg --homedir /opt/sbbs/mods/keys --batch --local-user 516@videotex -s '+file);
|
||||
result = system.exec('gpg --homedir /opt/sbbs/mods/keys --batch --local-user '+options.gpg_key+' -s '+file);
|
||||
w = new File(file+'.gpg');
|
||||
|
||||
if (w.open('r')) {
|
||||
@ -114,6 +120,6 @@ if (send == 1) {
|
||||
|
||||
w.close();
|
||||
|
||||
msgBaseExport(null,frame.page,msg);
|
||||
msgBaseImport(null,frame.page,msg);
|
||||
printf('GPG Result: %s',result);
|
||||
}
|
@ -117,7 +117,21 @@ function getFrame(page) {
|
||||
return frame;
|
||||
}
|
||||
|
||||
function msgBaseExport(msgbase,page,text) {
|
||||
function loadOptions() {
|
||||
ini = new File(file_cfgname(system.ctrl_dir,'videotex.ini'));
|
||||
|
||||
if (!ini.open("r")) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
val = ini.iniGetObject(null);
|
||||
|
||||
ini.close();
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
function msgBaseImport(msgbase,page,text) {
|
||||
var msgbase = new MsgBase(findMsgBase(msgbase));
|
||||
|
||||
log(LOG_DEBUG,'Sending ['+page+'] to message base ['+msgbase.cfg.code+']');
|
||||
|
Loading…
Reference in New Issue
Block a user