-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
NebelungDev
committed
Jun 12, 2022
1 parent
fbed7ce
commit 223cb0b
Showing
68 changed files
with
48,883 additions
and
2,944 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
language = "nodejs" | ||
run = "node index.js" | ||
run = "npm start" | ||
onBoot = "npm install" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,3 @@ | ||
/* | ||
Copyright © Fog Network | ||
Made by Nebelung | ||
MIT license: https://opensource.org/licenses/MIT | ||
*/ | ||
|
||
const express = require("express") | ||
const app = express() | ||
const basicAuth = require("express-basic-auth"); | ||
const config = require("./config.json") | ||
const port = process.env.PORT || config.port | ||
const Corrosion = require("./lib/server") | ||
const PalladiumProxy = require("./palladium/server") | ||
const auth = config.auth | ||
const username = config.username | ||
const password = config.password | ||
const users = {} | ||
users[username] = password | ||
const mist = require("mist-yt"); | ||
const fetch = require("node-fetch"); | ||
|
||
const proxy = new Corrosion({ | ||
prefix: "/corrosion/", | ||
codec: "xor", | ||
title: "Tsunami", | ||
forceHttps: true, | ||
requestMiddleware: [ | ||
Corrosion.middleware.blacklist([ | ||
"accounts.google.com", | ||
], "Page is blocked"), | ||
] | ||
}); | ||
|
||
proxy.bundleScripts(); | ||
|
||
const Palladium = new PalladiumProxy({ | ||
encode: "xor", | ||
ssl: false, | ||
prefix: "/palladium/", | ||
server: app, | ||
Corrosion: [true, proxy], | ||
title: "Tsunami", | ||
/*"requestMiddleware": [ | ||
PalladiumProxy.blackList(["accounts.google.com"], "Page is Blocked") | ||
],*/ | ||
}) | ||
|
||
Palladium.init(); | ||
|
||
if (auth == "true") { | ||
app.use(basicAuth({ | ||
users, | ||
challenge: true, | ||
unauthorizedResponse: autherror | ||
})); | ||
} | ||
|
||
function autherror(req) { | ||
return req.auth | ||
? ("Credentials " + req.auth.user + ":" + req.auth.password + " rejected") | ||
: "Error" | ||
} | ||
|
||
app.use(express.static("./public", { | ||
extensions: ["html"] | ||
})); | ||
|
||
app.get("/", function(req, res){ | ||
res.sendFile("index.html", {root: "./public"}); | ||
}); | ||
|
||
app.get("/suggestions", function(req, res){ | ||
async function getsuggestions() { | ||
var term = req.query.q || ""; | ||
var response = await fetch("https://duckduckgo.com/ac/?q=" + term + "&type=list"); | ||
var result = await response.json(); | ||
var suggestions = result[1] | ||
res.send(suggestions) | ||
} | ||
getsuggestions() | ||
}); | ||
|
||
app.use(function (req, res) { | ||
if (req.url.startsWith("/watch")) { | ||
mist.watch(req, res) | ||
} else if (req.url.startsWith("/video")) { | ||
mist.video(req, res) | ||
} else if (req.url.startsWith(proxy.prefix)) { | ||
proxy.request(req,res); | ||
} else if (req.url.startsWith(Palladium.prefix)) { | ||
return Palladium.request(req, res) | ||
} else { | ||
res.status(404).sendFile("404.html", {root: "./public"}); | ||
} | ||
}) | ||
|
||
app.listen(port, () => { | ||
console.log(`Tsunami is running at localhost:${port}`) | ||
}) | ||
(async() => { | ||
await import('./index.mjs'); | ||
})(); |
Oops, something went wrong.