?
This commit is contained in:
13
app.js
13
app.js
@@ -9,6 +9,8 @@ app.use(express.json());
|
||||
const port = process.env.NODE_PORT || '3000';
|
||||
|
||||
const inject = fs.readFileSync('./inject.html', 'utf8');
|
||||
const mainjs = fs.readFileSync('./static/main.js', 'utf8');
|
||||
|
||||
|
||||
const Transmission = require('transmission-promise')
|
||||
var tr_client = new Transmission({
|
||||
@@ -46,10 +48,14 @@ app.get("/__api/torrent/:id", async function(req, res, next){
|
||||
});
|
||||
|
||||
|
||||
app.all("/*.js", function(req, res){res.send('')});
|
||||
// app.all("/*.js", function(req, res){res.send('')});
|
||||
|
||||
app.all('/static/main.js', function(req,res){
|
||||
res.write(mainjs);
|
||||
});
|
||||
|
||||
app.all("/*", proxy({
|
||||
target: 'http://piratebayztemzmv.onion',
|
||||
target: 'http://piratebayztemzmv.onion', //'http://piratebayztemzmv.onion',
|
||||
autoRewrite: true,
|
||||
selfHandleResponse: true, // so that the onProxyRes takes care of sending the response
|
||||
onProxyRes: function(proxyRes, req, res){
|
||||
@@ -82,7 +88,8 @@ app.all("/*", proxy({
|
||||
proxyRes.headers['content-type'] &&
|
||||
proxyRes.headers['content-type'].match('html')
|
||||
){
|
||||
body = body.toString().replace(/<\s*script[^]*?script>/igm, '');
|
||||
body = body.replace(/http\:\/\/piratebayztemzmv\.onion\//g, '/');
|
||||
// body = body.toString().replace(/<\s*script[^]*?script>/igm, '');
|
||||
body = body.replace(/<\s*iframe[^]*?iframe>/igm, '');
|
||||
body = body.replace("</html>", '');
|
||||
body = body+inject+"</html>";
|
||||
|
||||
Reference in New Issue
Block a user