Moved site dir

Added IRCD logic
merge-requests/1/merge
knotteye 2019-09-20 13:02:29 -05:00
parent d05c59c896
commit 577612cee5
4 changed files with 35 additions and 10 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
node_modules node_modules
media site
build/** build/**
lib/inspircd-* lib/inspircd-*

View File

@ -1,13 +1,13 @@
import irc = require('irc'); import * as irc from "irc";
function chanReg(channel: string, owner: string){ function chanReg(channel: string, owner: string){
var bot = new irc.Client('127.0.0.1', 'ChanReg', { let bot = new irc.Client('127.0.0.1', 'ChanReg', {
channels: ['#ChanReg'], channels: [''],
userName: 'ChanReg', userName: 'ChanReg',
realName: 'Channel Registration Bot', realName: 'Channel Registration Bot',
floodProtection: false, floodProtection: false,
}); });
bot.addListener('registered', (message) => { bot.once('registered', (message) => {
bot.send('OPER', 'admin', 'test'); bot.send('OPER', 'admin', 'test');
bot.join(channel); bot.join(channel);
bot.send('MODE', channel, '+P'); bot.send('MODE', channel, '+P');
@ -17,17 +17,19 @@ function chanReg(channel: string, owner: string){
} }
function chanUnReg(channel: string){ function chanUnReg(channel: string){
var bot = new irc.Client('127.0.0.1', 'ChanReg', { let bot = new irc.Client('127.0.0.1', 'ChanReg', {
channels: [''], channels: [''],
userName: 'ChanReg', userName: 'ChanReg',
realName: 'Channel Registration Bot', realName: 'Channel Registration Bot',
floodProtection: false, floodProtection: false,
debug: true debug: true
}); });
bot.addListener('registered', (message) => { bot.once('registered', (message) => {
bot.send('OPER', 'admin', 'test'); bot.send('OPER', 'admin', 'test');
bot.join(channel); bot.join(channel);
bot.send('MODE', channel, '-P'); bot.send('MODE', channel, '-P');
bot.disconnect(); bot.disconnect();
}); });
} }
export {chanReg, chanUnReg};

View File

@ -1,4 +1,6 @@
import * as mediaserver from "./server"; import * as mediaserver from "./server";
import * as ircd from "./ircd";
function boot(): void{ function boot(): void{
const mediaconfig: any = { const mediaconfig: any = {
rtmp: { rtmp: {
@ -11,7 +13,7 @@ function boot(): void{
http: { http: {
port:8000, port:8000,
allow_origin: '*', allow_origin: '*',
mediaroot: './media' mediaroot: './site'
}, },
trans: { trans: {
ffmpeg: '/usr/bin/ffmpeg', ffmpeg: '/usr/bin/ffmpeg',
@ -25,5 +27,6 @@ function boot(): void{
} }
}; };
mediaserver.boot(mediaconfig); mediaserver.boot(mediaconfig);
ircd.boot();
} }
export { boot }; export { boot };

20
src/ircd.ts Normal file
View File

@ -0,0 +1,20 @@
import * as child from "child_process";
var ircd: child.ChildProcess;
function boot():void{
ircd = child.execFile("./lib/inspircd-3.3.0/run/inspircd", ["restart"], (error, stdout, stderr) => {
if (error){
console.log("[IRCD] Failed to start Inspircd");
console.log(stdout);
throw error;
}
else {
console.log("[IRCD] Started Inspircd");
}
});
}
function reloadSSL():void{
ircd.kill("SIGUSR1");
}
export { boot, reloadSSL };