Moved site dir

Added IRCD logic
merge-requests/1/merge
knotteye 5 years ago
parent d05c59c896
commit 577612cee5
  1. 2
      .gitignore
  2. 18
      src/chanbot.ts
  3. 5
      src/controller.ts
  4. 20
      src/ircd.ts

2
.gitignore vendored

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

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

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

@ -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 };