fixed the logger lmao
This commit is contained in:
15
logs.log
Normal file
15
logs.log
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[16-06-20 02:51:15] HTTP server listening on port 8080
|
||||||
|
[16-06-20 02:51:15] WebSocket server listening on 8080
|
||||||
|
[16-06-20 02:51:17] New socket connection from id: TSXRgqiCWne8yRn9AAAA
|
||||||
|
[16-06-20 02:51:23] HTTP server listening on port 8080
|
||||||
|
[16-06-20 02:51:23] WebSocket server listening on 8080
|
||||||
|
[16-06-20 02:51:23] New socket connection from id: zD5Up-p5htV05KuGAAAA
|
||||||
|
[16-06-20 02:52:18] HTTP server listening on port 8080
|
||||||
|
[16-06-20 02:52:18] WebSocket server listening on 8080
|
||||||
|
[16-06-20 02:52:20] New socket connection from ip: undefined
|
||||||
|
[16-06-20 02:52:24] HTTP server listening on port 8080
|
||||||
|
[16-06-20 02:52:24] WebSocket server listening on 8080
|
||||||
|
[16-06-20 02:52:24] New socket connection from ip: ::1
|
||||||
|
[16-06-20 02:52:49] HTTP server listening on port 8080
|
||||||
|
[16-06-20 02:52:49] WebSocket server listening on 8080
|
||||||
|
[16-06-20 02:52:51] New socket connection from ip: ::1, unique id: 7W0rQzo24-UqCalpAAAA
|
||||||
@@ -1,11 +1,26 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<title>Ben's Amazing YoutTube Downloader</title>
|
<title>Ben's Amazing YouTube Downloader</title>
|
||||||
</head>
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<body>
|
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
|
||||||
|
<script src="/socket.io/socket.io.js"></script>
|
||||||
</body>
|
</head>
|
||||||
</html>
|
<body>
|
||||||
|
<div id="Instructions">
|
||||||
|
Videos to record (seperate different videos by new lines):
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="Input">
|
||||||
|
<textarea id="VideosToRecord"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button id="Download">Download</button>
|
||||||
|
<input type="checkbox" id="AudioOnly">Only Download Audio (.mp3)
|
||||||
|
|
||||||
|
<script src="index.js"></script>
|
||||||
|
<div id="copyright">Copyright Benjamin Kyd© <script type="text/javascript">document.write(new Date().getFullYear())</script></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
5
public/index.js
Normal file
5
public/index.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
let socket = io();
|
||||||
|
|
||||||
|
(() => {
|
||||||
|
console.log('Starting up');
|
||||||
|
})();
|
||||||
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
@@ -1,4 +1,12 @@
|
|||||||
|
|
||||||
module.exports.Configuration = {}
|
module.exports.Configuration = {}
|
||||||
|
|
||||||
|
module.exports.Load = () =>
|
||||||
|
{
|
||||||
|
module.exports.Configuration = {
|
||||||
|
LogFile: 'logs.log',
|
||||||
|
ListenPort: 8080,
|
||||||
|
PublicDirectory: 'public',
|
||||||
|
StorageDirectory: './tmp/'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
const ytdl = require('ytdl-core');
|
|
||||||
|
|
||||||
|
|
||||||
11
src/index.js
11
src/index.js
@@ -1,6 +1,11 @@
|
|||||||
|
const Logger = require('./logger')
|
||||||
|
const Config = require('./config');
|
||||||
|
const Server = require('./server');
|
||||||
|
|
||||||
|
module.exports.Main = async () =>
|
||||||
module.exports.main = async function()
|
|
||||||
{
|
{
|
||||||
|
await Config.Load();
|
||||||
|
|
||||||
|
await Server.Init();
|
||||||
|
Server.Listen();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
const moment = require('moment');
|
const Config = require('./config')
|
||||||
|
|
||||||
|
const Moment = require('moment');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
const dateFormat = 'DD-MM-YY HH:mm:ss'
|
const dateFormat = 'DD-MM-YY HH:mm:ss'
|
||||||
|
|
||||||
module.exports.log = function(log) {
|
module.exports.Log = (log) =>
|
||||||
let d = moment().format(dateFormat);
|
{
|
||||||
console.log('[' + d.toLocaleString() + '] ' + log);
|
let d = Moment().format(dateFormat);
|
||||||
|
log = '[' + d.toLocaleString() + '] ' + log;
|
||||||
|
console.log(log);
|
||||||
|
fs.appendFile(Config.Configuration.LogFile, log + '\n', (e) => { if (e) throw e; });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
const Logger = require('./logger')
|
||||||
const Config = require('./config');
|
const Config = require('./config');
|
||||||
|
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
@@ -6,24 +7,24 @@ let app;
|
|||||||
let http;
|
let http;
|
||||||
let io;
|
let io;
|
||||||
|
|
||||||
module.exports.Init = async () => {
|
module.exports.Init = async () =>
|
||||||
|
{
|
||||||
app = require('express')();
|
app = require('express')();
|
||||||
http = require('http').Server(app);
|
http = require('http').Server(app);
|
||||||
io = require('socket.io')(http);
|
io = require('socket.io')(http);
|
||||||
|
|
||||||
http.listen(main.config.serverPort, () => {
|
|
||||||
logger.log(`HTTP server listening on port ${main.config.serverPort}`);
|
|
||||||
logger.log(`WebSocket server listening on ${main.config.serverPort}`);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.listen = async () => {
|
module.exports.Listen = async () =>
|
||||||
app.use(express.static('public'));
|
{
|
||||||
|
http.listen(Config.Configuration.ListenPort, () => {
|
||||||
|
Logger.Log(`HTTP server listening on port ${Config.Configuration.ListenPort}`);
|
||||||
|
Logger.Log(`WebSocket server listening on ${Config.Configuration.ListenPort}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
app.use(express.static(Config.Configuration.PublicDirectory));
|
||||||
|
|
||||||
io.on('connection', async (socket) => {
|
io.on('connection', async (socket) => {
|
||||||
logger.log(`New socket connection from id: ${socket.id}`);
|
Logger.Log(`New socket connection from ip: ${socket.handshake.address}, unique id: ${socket.id}`);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
src/youtubedownloader.js
Normal file
3
src/youtubedownloader.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
const YTDL = require('ytdl-core');
|
||||||
|
|
||||||
|
|
||||||
11
src/youtubehelper.js
Normal file
11
src/youtubehelper.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
const YTDL = require('ytdl-core');
|
||||||
|
|
||||||
|
module.exports.GetVideoInfoArr = async (arr) =>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.GetVideoInfo = async (video) =>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user