Moved Doorparty out into its own container

This commit is contained in:
Deon George 2021-03-16 20:59:44 +11:00
parent 63ea56421e
commit f939158f42
3 changed files with 39 additions and 33 deletions

View File

@ -44,36 +44,6 @@ RUN apt-get update \
&& rm -rf /opt/sbbs/repo \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Add Doorparty
RUN apt-get update \
&& apt-get install -yqq golang git \
&& cd /tmp && git clone https://github.com/echicken/dpc2 \
&& cd dpc2 && echo -n 'ZGlmZiAtLWdpdCBhL2Rvb3JwYXJ0eS1jb25uZWN0b3IuZ28gYi9kb29ycGFydHktY29ubmVjdG9y\
LmdvCmluZGV4IDE4NzNhZTUuLjc3NmFhOGUgMTAwNjQ0Ci0tLSBhL2Rvb3JwYXJ0eS1jb25uZWN0\
b3IuZ28KKysrIGIvZG9vcnBhcnR5LWNvbm5lY3Rvci5nbwpAQCAtMTMyLDcgKzEzMiw3IEBAIGZ1\
bmMgaW5pdCgpIHsKIAogZnVuYyBtYWluKCkgewogCi0JY2ZnLCBlcnIgOj0gaW5pLkxvYWQoImRv\
b3JwYXJ0eS1jb25uZWN0b3IuaW5pIikKKwljZmcsIGVyciA6PSBpbmkuTG9hZCgiL29wdC9zYmJz\
L2N0cmwvZG9vcnBhcnR5LWNvbm5lY3Rvci5pbmkiKQogCWlmIGVyciAhPSBuaWwgewogCQlsb2cu\
RmF0YWxmKCJFcnJvciByZWFkaW5nIGRvb3JwYXJ0eS1jb25uZWN0b3IuaW5pOiAldiIsIGVycikK\
IAl9Cg=='|base64 -d |git apply \
&& go get gopkg.in/ini.v1 \
&& go get golang.org/x/crypto/ssh \
&& go build -i doorparty-connector.go \
&& echo -n 'LS0tIC9zcnYvZG9ja2VyL3NiYnMvbW9kcy9kb29ycGFydHkuanMJMjAyMS0wMS0xMyAyMjozNTox\
Ni4wNzQyNzk2MDggKzExMDAKKysrIC4vc3luY2hyb25ldC9kb29ycGFydHkuanMJMjAyMS0wMS0x\
MyAyMzoyMjoyMi44MzgwNjU4MzIgKzExMDAKQEAgLTMzLDcgKzMzLDcgQEAKICAgICAoY2ZnLnR1\
bm5lbF9ob3N0IHx8ICdsb2NhbGhvc3QnKSArICc6JyArIChjZmcudHVubmVsX3BvcnQgfHwgOTk5\
OSksCiAgICAgZ2V0X3Bhc3N3b3JkKCksIC8vIHBhc3N3b3JkCiAgICAgdXNlci5hbGlhcywKLSAg\
ICBhcmd2Lmxlbmd0aCA/IGFyZ3ZbMF0gOiB1bmRlZmluZWQKKyAgICBhcmd2Lmxlbmd0aCA/ICd4\
dHJuPScrYXJndlswXSA6IHVuZGVmaW5lZAogKTsKIAogY29uc29sZS5hdHRyaWJ1dGVzID0gYXR0\
cjsK'|base64 -d |git apply \
&& mv doorparty-connector synchronet/doorparty.js /opt/sbbs/exec \
&& mv doorparty-connector.ini /opt/sbbs/ctrl.orig \
&& apt-get -y purge golang git \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Add PHP
RUN apt-get update \
&& apt-get install -yqq composer php-cgi php-fpm php-gd php-sqlite3 php-xml \
@ -87,6 +57,7 @@ ENV SBBSEXEC=/opt/sbbs/exec
ENV PATH=$PATH:${SBBSEXEC}
COPY start.sh ${SBBSEXEC}/
COPY doorparty.js ${SBBSEXEC}/
COPY main.cnf /opt/sbbs/ctrl.orig/
VOLUME [ "/var/lib/zerotier-one" ]

38
doorparty.js Normal file
View File

@ -0,0 +1,38 @@
load('sbbsdefs.js');
var userprops = load({}, "userprops.js");
var cfg = load({}, 'modopts.js', "doorparty") || {};
var attr = console.attributes;
function make_password() {
var c;
var p = [];
while (p.length < 8) {
c = ascii(Math.ceil(Math.random() * 58) + 32);
if (p.indexOf(c) > -1) continue;
p.push(c);
}
return p.join('');
}
function get_password() {
if (cfg.password) return cfg.password; // If a system-wide password has been set, use it
var password = userprops.get('doorparty', 'password', '');
if (password != '') return password; // If the user has a DoorParty password on file, use it
password = make_password();
userprops.set('doorparty', 'password', password); // Store a DoorParty password for this user
return password;
}
console.clear(LIGHTGRAY);
console.putmsg('Connecting to DoorParty, please wait ...');
bbs.rlogin_gate(
(cfg.tunnel_host || 'localhost') + ':' + (cfg.tunnel_port || 9999),
get_password(), // password
user.alias,
argv.length ? 'xtrn='+argv[0] : undefined
);
console.attributes = attr;
console.clear();

View File

@ -1,3 +0,0 @@
[program:doorparty]
command=/opt/sbbs/exec/doorparty-connector
stopwaitsecs=60