From bb905111ecc1f66888de781658b1bc8cf93f9a74 Mon Sep 17 00:00:00 2001 From: Theenoro Date: Fri, 8 Sep 2017 00:06:24 +0200 Subject: [PATCH] 1.4.1 Alpha --- browser_out/tampermonkey_plugin.js | 26 ++++++++++++++++++++++++++ package.json | 3 +++ src/controller/webLoader/router.js | 22 ++++++++++++++++++++++ src/controller/youtube-dl.js | 4 +++- 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 browser_out/tampermonkey_plugin.js create mode 100644 src/controller/webLoader/router.js diff --git a/browser_out/tampermonkey_plugin.js b/browser_out/tampermonkey_plugin.js new file mode 100644 index 0000000..e3b8a3e --- /dev/null +++ b/browser_out/tampermonkey_plugin.js @@ -0,0 +1,26 @@ +// ==UserScript== +// @name Cyber Downloader ADD +// @namespace http://tampermonkey.net/ +// @version 0.1 +// @description try to take over the world! +// @author You +// @require http://code.jquery.com/jquery-latest.js +// @match https://www.youtube.com/watch?v=* +// @grant none +// ==/UserScript== + +(function() { + 'use strict'; + var s = jQuery.noConflict(); + console.log('loaded'); + setTimeout(function(){ + s('#end').prepend(''); + },1000); + // Your code here... + s('body').delegate('#cb3_send','click',function(){ + var sy = window.location; + s.post( "http://127.0.0.1:54167/download?url="+encodeURI(sy),function() { + + }); + }); +})(); diff --git a/package.json b/package.json index 7e95600..0bf613e 100644 --- a/package.json +++ b/package.json @@ -47,8 +47,11 @@ } }, "dependencies": { + "body-parser": "^1.17.2", + "cors": "^2.8.4", "electron": "^1.6.11", "electron-compile": "^6.4.1", + "express": "^4.15.4", "fs": "0.0.1-security", "mkdirp": "^0.5.1", "path": "^0.12.7", diff --git a/src/controller/webLoader/router.js b/src/controller/webLoader/router.js new file mode 100644 index 0000000..c8801a2 --- /dev/null +++ b/src/controller/webLoader/router.js @@ -0,0 +1,22 @@ +const app = require('express')(); +var cors = require('cors') +app.use(cors()) +const bodyParser = require('body-parser'); + +app.use( bodyParser.json() ); // to support JSON-encoded bodies +app.use(bodyParser.urlencoded({ // to support URL-encoded bodies + extended: true +})); + + +app.post('/download', function(req, res) { + var log = req.query.url; + console.log(log) + // ... +}); + + +app.listen(54167, "127.0.0.1"); + + +module.exports = app; diff --git a/src/controller/youtube-dl.js b/src/controller/youtube-dl.js index 5a38d5c..4d91711 100644 --- a/src/controller/youtube-dl.js +++ b/src/controller/youtube-dl.js @@ -2,7 +2,9 @@ const { spawn } = require('child_process'); const ipcMain = require('electron').ipcMain; const dl_routine = require('./youtube-dl.routine') -const pot = require('./player_onTop') +const web = require('./webLoader/router'); + +const pot = require('./player_onTop'); const folderWatchr = require('./watchr') console.log(global.dir);