Makefile fixes; adding DiscordBridge whitelist

This commit is contained in:
DarkFeather 2018-07-27 14:01:22 -05:00
parent d39ed670cc
commit 11da27e0c4
3 changed files with 11 additions and 6 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
raven.mono raven.mono
theraven-*.tar.xz theraven-*.tar.xz
pkg/ pkg/
src/
.config

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Text.RegularExpressions;
using System.Collections.Generic; using System.Collections.Generic;
using AniNIX.Shared; using AniNIX.Shared;
@ -13,6 +14,9 @@ namespace AniNIX.TheRaven {
public string target { get; protected set; } public string target { get; protected set; }
public string message { get; protected set; } public string message { get; protected set; }
// Adding whitelist for default Discord-Bridge config
private string _discordRegex = "\\<.+\\>\\s+";
public IRCServerMessage(String serverString) { public IRCServerMessage(String serverString) {
incomingIRCString = serverString.Trim(); incomingIRCString = serverString.Trim();
try { try {
@ -23,6 +27,7 @@ namespace AniNIX.TheRaven {
messageL.RemoveAt(0); messageL.RemoveAt(0);
messageL.RemoveAt(0); messageL.RemoveAt(0);
message = String.Join(":",messageL.ToArray()); message = String.Join(":",messageL.ToArray());
message = Regex.Replace(message,_discordRegex,"");
if (bySpace[0].Contains("!")) { if (bySpace[0].Contains("!")) {
String[] byExclamation = bySpace[0].Split('!'); String[] byExclamation = bySpace[0].Split('!');
user = byExclamation[0]; user = byExclamation[0];

View File

@ -1,11 +1,8 @@
CONFDIR = ${pkgdir}/usr/local/etc/TheRaven CONFDIR = ${pkgdir}/usr/local/etc/TheRaven
INSTALLER != curl -s https://aninix.net/foundation/installer-test.bash | /bin/bash
compile: clean ./chatbot-support.bash ./math-support.bash /usr/sbin/pb compile: clean ./chatbot-support.bash ./math-support.bash /usr/sbin/pb
mkdir -p ${pkgdir}/usr/local/src/ mkdir -p ${pkgdir}/usr/local/src/
if [ ! -d ${pkgdir}/usr/local/src/SharedLibraries ]; then git -C ${pkgdir}/usr/local/src/ clone https://aninix.net/foundation/SharedLibraries; fi (mcs -out:raven.mono /opt/aninix/SharedLibraries/CSharp/*.csharp *.csharp Raven.csharp 2>&1 | grep -v CS2002); printf ""
git -C ${pkgdir}/usr/local/src/SharedLibraries pull
(mcs -out:raven.mono ${pkgdir}/usr/local/src/SharedLibraries/CSharp/*.csharp *.csharp Raven.csharp 2>&1 | grep -v CS2002); printf ""
clean: clean:
for i in raven.mono; do if [ -f $$i ]; then rm $$i; fi; done for i in raven.mono; do if [ -f $$i ]; then rm $$i; fi; done
@ -13,12 +10,13 @@ clean:
test: compile test: compile
script -c "mono ./raven.mono -c raven-test.conf -v" ${pkgdir}/tmp/raven-test.log script -c "mono ./raven.mono -c raven-test.conf -v" ${pkgdir}/tmp/raven-test.log
install: compile install: compile /usr/sbin/pwgen
mkdir -p ${pkgdir}/opt mkdir -p ${pkgdir}/opt
cp raven.mono ${pkgdir}/opt/raven.mono cp raven.mono ${pkgdir}/opt/raven.mono
if [ ! -d ${CONFDIR} ]; then mkdir -p ${CONFDIR}; cp sample-confs/* ${CONFDIR}; fi if [ ! -d ${CONFDIR} ]; then mkdir -p ${CONFDIR}; cp sample-confs/* ${CONFDIR}; fi
# Hook to deprivilege bot # Hook to deprivilege bot
if ! getent passwd raven; then useradd -M -G git,ircd,api -d ${CONFDIR} raven; fi if ! getent passwd raven; then useradd -M -G git,ircd,api -d ${CONFDIR} raven; fi
echo "raven:$$(/usr/sbin/pwgen 24 1)" | chpasswd;
make checkperm make checkperm
# Hook for Heartbeat # Hook for Heartbeat
if [ -f ${pkgdir}/usr/local/etc/Heartbeat/services.list ] && [ `grep -c TheRaven ${pkgdir}/usr/local/etc/Heartbeat/services.list` -eq 0 ]; then echo "" >> ${pkgdir}/usr/local/etc/Heartbeat/services.list; fi if [ -f ${pkgdir}/usr/local/etc/Heartbeat/services.list ] && [ `grep -c TheRaven ${pkgdir}/usr/local/etc/Heartbeat/services.list` -eq 0 ]; then echo "" >> ${pkgdir}/usr/local/etc/Heartbeat/services.list; fi