Added setup script for inspIRCd

Added bot script for registering and unregistering permanent channels
TODO: inspircd config template
merge-requests/1/merge
knotteye 5 years ago
parent dd0ab1e465
commit 4309da7c39
  1. 2
      .gitignore
  2. 13
      README
  3. 26
      ircd-setup
  4. 76
      package-lock.json
  5. 11
      package.json
  6. 33
      src/chanbot.ts
  7. 10
      src/server.ts

2
.gitignore vendored

@ -1,3 +1,5 @@
node_modules
media
server.js
chanbot.js
lib/inspircd-*

@ -0,0 +1,13 @@
Satyr: A livestreaming server
System dependencies: npm, node, typescript
(Typescript can be installed through npm)
Build Instructions
git clone https://gitlab.com/knotteye/satyr.git
cd satyr
npm install
tsc
Run the server
node server.js

@ -0,0 +1,26 @@
#!/bin/sh
mkdir -p lib
cd lib
wget https://github.com/inspircd/inspircd/archive/v3.3.0.tar.gz
tar -xvf v3.3.0.tar.gz
rm v3.3.0.tar.gz
cd inspircd-3.3.0
#./configure --enable-extras=m_pgsql.cpp --enable-extras=m_ssl_openssl.cpp
echo "no
yes
no
no
no
yes
no
no
no
no
no
no
no
no
yes
yes
no" | ./configure
make -j8 install

76
package-lock.json generated

@ -5,9 +5,10 @@
"requires": true,
"dependencies": {
"@types/node": {
"version": "12.7.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.4.tgz",
"integrity": "sha512-W0+n1Y+gK/8G2P/piTkBBN38Qc5Q1ZSO6B5H3QmPCUewaiXOo2GCAWZ4ElZCcNhjJuBSUSLGFUJnmlCn5+nxOQ=="
"version": "12.7.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.5.tgz",
"integrity": "sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w==",
"dev": true
},
"abbrev": {
"version": "1.1.1",
@ -125,11 +126,6 @@
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
},
"carrier": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/carrier/-/carrier-0.1.13.tgz",
"integrity": "sha1-xWKA47F4AFKpc3mqNSnr6AFIzok="
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@ -163,10 +159,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
},
"commander": {
"version": "git://github.com/visionmedia/commander.js.git#43123022cae2f01cc4cffe3eb44b5275e857a6d2",
"from": "git://github.com/visionmedia/commander.js.git"
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@ -360,11 +352,11 @@
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"fs-minipass": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz",
"integrity": "sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==",
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz",
"integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==",
"requires": {
"minipass": "^2.2.1"
"minipass": "^2.6.0"
}
},
"fs.realpath": {
@ -429,6 +421,15 @@
}
}
},
"iconv": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/iconv/-/iconv-2.2.3.tgz",
"integrity": "sha1-4ITWDut9c9p/CpwJbkyKvgkL+u0=",
"optional": true,
"requires": {
"nan": "^2.3.5"
}
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
@ -469,6 +470,21 @@
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz",
"integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA=="
},
"irc": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/irc/-/irc-0.5.2.tgz",
"integrity": "sha1-NxT0doNlqW0LL3dryRFmvrJGS7w=",
"requires": {
"iconv": "~2.2.1",
"irc-colors": "^1.1.0",
"node-icu-charset-detector": "~0.2.0"
}
},
"irc-colors": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/irc-colors/-/irc-colors-1.5.0.tgz",
"integrity": "sha512-HtszKchBQTcqw1DC09uD7i7vvMayHGM1OCo6AHt5pkgZEyo99ClhHTMJdf+Ezc9ovuNNxcH89QfyclGthjZJOw=="
},
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
@ -482,11 +498,6 @@
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
},
"line-reader": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/line-reader/-/line-reader-0.4.0.tgz",
"integrity": "sha1-F+RIGNoKwzVnW6MAlU+U72cOZv0="
},
"lodash": {
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
@ -539,9 +550,9 @@
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
},
"minipass": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.5.1.tgz",
"integrity": "sha512-dmpSnLJtNQioZFI5HfQ55Ad0DzzsMAb+HfokwRTNXwEQjepbTkl5mtIlSVxGIkOkxlpX7wIn5ET/oAd9fZ/Y/Q==",
"version": "2.6.5",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.6.5.tgz",
"integrity": "sha512-ewSKOPFH9blOLXx0YSE+mbrNMBFPS+11a2b03QZ+P4LVrUHW/GAlqeYC7DBknDyMWkHzrzTpDhUvy7MUxqyrPA==",
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -588,6 +599,15 @@
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"node-icu-charset-detector": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/node-icu-charset-detector/-/node-icu-charset-detector-0.2.0.tgz",
"integrity": "sha1-wjINo3Tdy2cfxUy0oOBB4Vb/1jk=",
"optional": true,
"requires": {
"nan": "^2.3.3"
}
},
"node-media-server": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/node-media-server/-/node-media-server-2.1.3.tgz",
@ -921,13 +941,13 @@
}
},
"tar": {
"version": "4.4.10",
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz",
"integrity": "sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==",
"version": "4.4.11",
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.11.tgz",
"integrity": "sha512-iI4zh3ktLJKaDNZKZc+fUONiQrSn9HkCFzamtb7k8FFmVilHVob7QsLX/VySAW8lAviMzMbFw4QtFb4errwgYA==",
"requires": {
"chownr": "^1.1.1",
"fs-minipass": "^1.2.5",
"minipass": "^2.3.5",
"minipass": "^2.6.4",
"minizlib": "^1.2.1",
"mkdirp": "^0.5.0",
"safe-buffer": "^5.1.2",

@ -3,16 +3,17 @@
"version": "0.1.0",
"description": "A livestreaming server.",
"license": "AGPL-3.0",
"author": "knotteye",
"repository": {
"type": "git",
"url": "https://gitlab.com/knotteye/satyr.git"
},
"dependencies": {
"@types/node": "^12.7.4",
"carrier": "^0.1.13",
"bcrypt": ">= 0.8.0",
"line-reader": ">= 0.4.0",
"commander": "git://github.com/visionmedia/commander.js.git",
"bcrypt": "^3.0.6",
"irc": "^0.5.2",
"node-media-server": ">=2.1.3 <3.0.0"
},
"devDependencies": {
"@types/node": "^12.7.5"
}
}

@ -0,0 +1,33 @@
import irc = require('irc');
function chanReg(channel: string, owner: string){
var bot = new irc.Client('127.0.0.1', 'ChanReg', {
channels: ['#ChanReg'],
userName: 'ChanReg',
realName: 'Channel Registration Bot',
floodProtection: false,
});
bot.addListener('registered', (message) => {
bot.send('OPER', 'admin', 'test');
bot.join(channel);
bot.send('MODE', channel, '+P');
bot.send('MODE', channel, '+w', 'o:'+owner+'!*@*');
bot.disconnect();
});
}
function chanUnReg(channel: string){
var 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.send('OPER', 'admin', 'test');
bot.join(channel);
bot.send('MODE', channel, '-P');
bot.disconnect();
});
}

@ -1,7 +1,6 @@
import NodeMediaServer = require("node-media-server");
import fs = require ("fs");
import NodeMediaServer = require('node-media-server');
import fs = require('fs');
const { exec } = require('child_process');
const ircd = require("./lib/IRCDjs-six/lib/server.js").Server;
//initialize configs, eventually grab from runtime config file
const mediaconfig = {
@ -51,10 +50,9 @@ function streamAuth(path: string){
}
var nms = new NodeMediaServer(mediaconfig);
const nms = new NodeMediaServer(mediaconfig);
nms.run();
ircd.boot();
nms.on('prePublish', (id, StreamPath, args) => {
console.log("[NodeMediaServer] Prepublish Hook for stream id=",id);
@ -100,4 +98,4 @@ nms.on('postPublish', (id, StreamPath, args) => {
return true;
}
console.log('[NodeMediaServer] Skipping recording for ', `id=${id} StreamPath=${StreamPath}`);
});
});