mirror of
https://git.waldn.net/git/knotteye/satyr.git
synced 2025-10-20 19:08:52 +00:00
Fix logging in cluster.ts
Fix a bug calling the cluster process in index.ts Set a default value for rtmp.cluster in config.ts Update documentation
This commit is contained in:
@@ -133,14 +133,14 @@ if (cluster.isMaster) {
|
||||
db.query('update user_meta set live=true where username=\''+results[0].username+'\' limit 1');
|
||||
db.query('SELECT twitch_key,enabled from twitch_mirror where username='+db.raw.escape(results[0].username)+' limit 1').then(async (tm) => {
|
||||
if(!tm[0]['enabled'] || !config['twitch_mirror']['enabled'] || !config['twitch_mirror']['ingest']) return;
|
||||
console.log('[NodeMediaServer] Mirroring to twitch for stream:',id)
|
||||
console.log(`[RTMP Cluster WORKER ${process.pid}] Mirroring to twitch for stream: ${id}`)
|
||||
execFile(config['media']['ffmpeg'], ['-loglevel', 'fatal', '-i', 'rtmp://127.0.0.1:'+wPort+'/'+config['media']['privateEndpoint']+'/'+key, '-vcodec', 'copy', '-acodec', 'copy', '-f', 'flv', config['twitch_mirror']['ingest']+tm[0]['twitch_key']], {
|
||||
detached: true,
|
||||
stdio : 'inherit',
|
||||
maxBuffer: Infinity
|
||||
}).unref();
|
||||
});
|
||||
console.log('[NodeMediaServer] Stream key ok for stream:',id);
|
||||
console.log(`[RTMP Cluster WORKER ${process.pid}] Stream key ok for stream: ${id}`);
|
||||
console.log(`[RTMP Cluster WORKER ${process.pid}] Stream key ok for stream: ${id}`);
|
||||
//notify master process that we're handling the stream for this user
|
||||
process.send({type: 'handle-publish', name:results[0].username});
|
||||
@@ -171,14 +171,14 @@ if (cluster.isMaster) {
|
||||
let key: string = StreamPath.split("/")[2];
|
||||
//correctly formatted urls again
|
||||
if (StreamPath.split("/").length !== 3){
|
||||
console.log("[NodeMediaServer] Malformed URL, closing connection for stream:",id);
|
||||
console.log(`[RTMP Cluster WORKER ${process.pid}] Malformed URL, closing connection for stream: ${id}`);
|
||||
session.reject();
|
||||
return false;
|
||||
}
|
||||
//localhost can play from whatever endpoint
|
||||
//other clients must use private endpoint
|
||||
if(app !== config['media']['publicEndpoint'] && !session.isLocal) {
|
||||
console.log("[NodeMediaServer] Non-local Play from private endpoint, rejecting client:",id);
|
||||
console.log(`[RTMP Cluster WORKER ${process.pid}] Non-local Play from private endpoint, rejecting client: ${id}`);
|
||||
session.reject();
|
||||
return false;
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@ const config: Object = {
|
||||
insecureAuth: false,
|
||||
debug: false }, localconfig['database']),
|
||||
rtmp: Object.assign({
|
||||
cluster: false,
|
||||
port: 1935,
|
||||
chunk_size: 6000,
|
||||
gop_cache: true,
|
||||
|
@@ -10,7 +10,7 @@ async function run() {
|
||||
await initDB();
|
||||
await clean();
|
||||
await initHTTP();
|
||||
config['rtmp']['cluster'] ? execFile(process.cwd()+'/node_modules/.bin/ts-node' [process.cwd()+'src/cluster.ts']) : await initRTMP();
|
||||
config['rtmp']['cluster'] ? execFile(process.cwd()+'/node_modules/.bin/ts-node', [process.cwd()+'/src/cluster.ts']) : await initRTMP();
|
||||
await initChat();
|
||||
console.log(`Satyr v${config['satyr']['version']} ready`);
|
||||
}
|
||||
|
Reference in New Issue
Block a user