Skip to content
Snippets Groups Projects
Commit 520520bb authored by echicken's avatar echicken :chicken:
Browse files

These files no longer needed with new version.

parent eb603466
Branches
Tags
1 merge request!455Update branch with changes from master
load('sbbsdefs.js');
load('funclib.js');
function loadSettings(path) {
var f = new File((path || js.exec_dir) + 'bullshit.ini');
if (!f.open('r')) throw 'Failed to open bullshit.ini.';
var settings = f.iniGetObject();
settings.colors = f.iniGetObject('colors');
settings.files = f.iniGetObject('files') || {};
f.close();
Object.keys(settings.colors).forEach(function (k) {
settings.colors[k] = settings.colors[k].toUpperCase().split(',');
if (typeof getColor == 'undefined') return;
if (settings.colors[k].length > 1) {
settings.colors[k].forEach(function (e, i, a) {
a[i] = getColor(e);
});
} else {
settings.colors[k] = getColor(settings.colors[k][0]);
}
});
if (settings.colors.titleBackground === undefined) settings.colors.titleBackground = BG_BLACK;
return settings;
}
function readUserHistory() {
const dummy = { files: {}, messages: [] };
const fn = format('%suser/%04d.bullshit', system.data_dir, user.number);
if (!file_exists(fn)) return dummy;
const f = new File(fn);
if (f.open('r')) {
const obj = JSON.parse(f.read());
f.close();
return obj;
}
return dummy;
}
function writeUserHistory(obj) {
const fn = format('%suser/%04d.bullshit', system.data_dir, user.number);
log('Writing ' + fn);
const f = new File(fn);
if (f.open('w')) {
f.write(JSON.stringify(obj));
f.close();
}
}
function setBulletinRead(key) {
const history = readUserHistory();
if (typeof key == 'string') {
history.files[key] = time();
} else if (typeof key == 'number') {
if (history.messages.indexOf(key) < 0) history.messages.push(key);
}
writeUserHistory(history);
}
function loadList(settings) {
const history = readUserHistory();
const list = [];
Object.keys(settings.files).forEach(function (key) {
if (!file_exists(settings.files[key])) return;
if (settings.newOnly && typeof history.files[key] == 'number' && file_date(settings.files[key]) <= history.files[key]) return;
if (js.global.console) {
list.push({
str: format(
'%-' + (console.screen_columns - 29) + 's%s',
key, system.timestr(file_date(settings.files[key]))
),
key: key
});
} else {
list.push({
title: key,
type: 'file',
date: system.timestr(file_date(settings.files[key])),
path: settings.files[key]
});
}
});
if (settings.messageBase) {
const msgBase = new MsgBase(settings.messageBase);
msgBase.open();
var shown = 0;
for (var m = msgBase.last_msg; m >= msgBase.first_msg; m = m - 1) {
try {
var h = msgBase.get_msg_header(m);
} catch (err) {
continue;
}
if (h === null) continue;
if (settings.newOnly && history.messages.indexOf(m) >= 0) continue;
if (h.attr&MSG_DELETE) continue;
if (js.global.console) {
list.push({
str: format(
'%-' + (console.screen_columns - 29) + 's%s',
h.subject.substr(0, console.screen_columns - 30),
system.timestr(h.when_written_time)
),
key: m
});
} else {
list.push({
title: h.subject,
type: 'message',
date: system.timestr(h.when_written_time),
num: h.number
});
}
shown++;
if (settings.maxMessages > 0 && shown >= settings.maxMessages) break;
}
msgBase.close();
}
return list;
}
this;
\ No newline at end of file
messageBase = BULLSHIT
maxMessages = 0
[colors]
title = WHITE
text = LIGHTGRAY
heading = DARKGRAY
lightbarForeground = LIGHTCYAN
lightbarBackground = BG_CYAN
listForeground = LIGHTGRAY
footer = WHITE
border = LIGHTBLUE,CYAN,LIGHTCYAN,LIGHTGRAY,WHITE
[files]
// Bullshit lister function for use with web-v4
load("sbbsdefs.js");
// Deuce's URL-ifier
function linkify(body) {
urlRE = /(?:https?|ftp|telnet|ssh|gopher|rlogin|news):\/\/[^\s'"'<>()]*|[-\w.+]+@(?:[-\w]+\.)+[\w]{2,6}/gi;
body = body.replace(
urlRE, function (str) {
var ret = '';
var p = 0;
var link = str.replace(/\.*$/, '');
var linktext = link;
if (link.indexOf('://') == -1) link = 'mailto:' + link;
return format(
'<a class="ulLink" href="%s">%s</a>%s',
link, linktext, str.substr(linktext.length)
);
}
);
return body;
}
function bullshit(sub, max) {
var mb = new MsgBase(sub);
if (!mb.open()) return;
var shown = 0;
writeln('<div><ul class="list-group">');
for (var m = mb.last_msg; (m >= mb.first_msg && shown < max); m = m - 1) {
var header = mb.get_msg_header(m);
if (header !== null && !(header.attr&MSG_DELETE)) {
writeln(format(
'<li class="list-group-item striped">' +
'<strong>%s</strong><br><em>%s</em>' +
'<div class="message">%s</div></li>',
header.subject, system.timestr(header.when_written_time),
linkify(mb.get_msg_body(m)).replace(/\r?\n/g, '<br>')
));
shown++;
}
}
mb.close();
writeln('</ul></div>');
}
Bullshit 3.0
by echicken -at- bbs.electronicchicken.com
Contents
1) About
2) Setup
3) Customization
4) Bullshit for the web
5) Support
1) About
Bullshit is a lightbar bulletin lister/reader for Synchronet BBS 3.16+.
A message sub-board is used as a storage back-end, so that you can add a
new bulletin to the list just by posting a message. You can also include
.ANS or .TXT files - such as door game score files - as pinned items at the
top of the list.
2) Setup
2.1) Create a message area
This step is recommended, but optional. You can skip this part if you
don't want Bullshit to pull bulletins out of a message base.
Launch SCFG (BBS->Configure in the Synchronet Control Panel on Windows.)
In 'Message Areas', select your local message group, and create a new
sub with the following details:
Long Name Bulletins
Short Name Bulletins
QWK Name BULLSHIT
Internal Code BULLSHIT
Access Requirements LEVEL 90
Reading Requirements LEVEL 90
Posting Requirements LEVEL 90
Toggle Options...
Default on for new scan No
Forced on for new scan No
Default on for your scan No
Note: You can name this message area whatever you want, and you can use
an existing message area if you wish. Ideally only the sysop will be
able to read or post to this area, and it won't be included in the new
message scan.
2.2) Create an External Program entry
Still in SCFG, return to the main menu, select 'External Programs',
then 'Online Programs (Doors)', choose the section you wish to add
Bullshit to, then create a new entry with the following details:
Name Bullshit
Internal Code BULLSHIT
Start-up Directory /sbbs/xtrn/bullshit
Command Line ?bullshit.js
Multiple Concurrent Users Yes
If you want Bullshit to run during your logon process, set the
following:
Execute on Event logon
All other options can be left at their default settings.
3) Customization
Some customization settings are available in 'bullshit.ini':
In the root section:
- The 'messageBase' setting specifies the internal code of the
message sub-board that Bullshit should load.
- The 'maxMessages' setting specifies how many of the most recent
messages in this area should be listed. (Use 0 for no limit.)
- If you don't want to load bulletins from a message base, simply
delete the 'messageBase' setting from 'bullshit.ini'.
- If the optional 'newOnly' setting is present and 'true', only
unread messages and recently updated files will be shown to
users. Per-user read/unread and last-viewed file timestamps
are stored in data/user/####.bullshit JSON files. If nothing
is available to be displayed to the user. Bullshit will exit
silently.
If 'newOnly' is set to the string "logon", then only new bulletins
will be shown to the user at logon time (and will silently exit
if none are available), but all bulletins will be shown at other
times (for example, adding bullshit to the external programs menu)
In the 'colors' section:
- 'title' and 'text' are the colors used when viewing an item
- 'heading' controls color or the 'Title' and 'Date' column headings
- 'lightbarForeground' and 'lightbarBackground' control the color of
a highlighted item in the list
- 'listForeground' controls the color of a non-highlighted item
- 'footer' controls the color of the 'Q to quit ...' text
- 'border' can be a single color, or a comma-separated list
The 'files' section is empty by default. Here you can add any number of
entries for files that you wish to include in the list. The key will be
used as the item's title in the list, while the value must be the path to
the file, for example:
LORD Scores = /sbbs/xtrn/lord/score.ans
At the moment, only files with .ANS and .TXT extensions can be loaded. If
that's a huge pain for you, let me know and I'll maybe do something about
it at some point.
4) Bullshit for the web
The included '999-bullshit.xjs' file is compatible with my "new" web UI for
Synchronet (https://github.com/echicken/synchronet-web-v4). You can add it
to your site by copying it to the 'pages' subdirectory, renaming it as
needed. You could also just copy the contents of this file into another of
your pages if you wish for bulletins to show up there (000-home.xjs, for
example.)
This will probably work with ecweb v3 as well, but I haven't bothered to
test it.
For cosmetic and snobbish design reasons, your pinned 'files' list will not
be displayed in the web UI. You're better off creating a 'Scores' page of
some kind for this purpose.
5) Support
You can contact me for support via any of the following means, in the
following order of preference:
DOVE-Net:
Post a message to 'echicken' in the 'Synchronet Sysops' sub-board.
Unless I'm dead or on vacation, I'll probably get back to you within a
day or so.
electronic chicken bbs:
Post a message in the 'Support' sub-board of the 'Local' message group
on my BBS, bbs.electronicchicken.com
IRC : #synchronet on irc.synchro.net:
I'm not always in front of a computer, so you won't always receive an
immediate response if you contact me on IRC. That said, if you stay
online and idle, I'll probably see your message and respond eventually.
Email:
You can email me at echicken -at- bbs.electronicchicken.com, however I
prefer to discuss problems & provide support in a public forum in case
any information that comes up can be of benefit to somebody else in the
future.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment