This commit is contained in:
TheEmeraldStarr 2020-10-04 14:20:04 -07:00
parent be87160768
commit 0c1a73e3dc
4 changed files with 29 additions and 22 deletions

6
app.js
View file

@ -66,12 +66,6 @@
resave: true resave: true
})); }));
app.use(session({
secret: 'nu_auth',
cookie: { sameSite: 'none', secure: 'true' },
saveUninitialized: true,
resave: true
}));
// We made our own version of body-parser instead, due to issues. // We made our own version of body-parser instead, due to issues.
app.use((req, res, next) => { app.use((req, res, next) => {

18
auth.js
View file

@ -1,5 +1,10 @@
#!/usr/bin/env node #!/usr/bin/env node
const express = require('express'),
app = express(),
session = require('express-session'),
var crypto = require('crypto'); var crypto = require('crypto');
var os = require('os'); var os = require('os');
var querystring = require('querystring'); var querystring = require('querystring');
@ -19,12 +24,19 @@ module.exports = function(env) {
return module.exports; return module.exports;
}; };
app.use(session({
secret: 'nu_auth',
cookie: { sameSite: 'none', secure: 'true' },
saveUninitialized: true,
resave: true
}));
module.exports.auth = function(req, res, next) { module.exports.auth = function(req, res, next) {
// Allow using with express as well as socket.io // Allow using with express as well as socket.io
next = next || res; next = next || res;
var cookies = new Cookies(req); var cookies = new Cookies(req);
var hash = cookies.get('session') ? var hash = cookies.get('nu_auth') ?
module.exports.hash(cookies.get('session')) : ''; module.exports.hash(cookies.get('nu_auth')) : '';
if (settings.hashes.indexOf(hash) >= 0) { if (settings.hashes.indexOf(hash) >= 0) {
next(); next();
} else { } else {
@ -35,7 +47,7 @@ module.exports.auth = function(req, res, next) {
module.exports.sign = function(req, res, next) { module.exports.sign = function(req, res, next) {
var cookies = new Cookies(req, res); var cookies = new Cookies(req, res);
var query = url.parse(req.url, true).query; var query = url.parse(req.url, true).query;
cookies.set('session', query.key ? module.exports.hash(query.key) : null); cookies.set('nu_auth', query.key ? module.exports.hash(query.key) : null);
res.writeHead(302, { location: query.path ? query.path : settings.redirect }); res.writeHead(302, { location: query.path ? query.path : settings.redirect });
res.end(); res.end();
}; };

View file

@ -75,27 +75,28 @@
</script> </script>
<div class="d-flex align-items-center order-12" style="height:200px;"> <div class="d-flex align-items-center order-12" style="height:200px;">
<div class="container border rounded text-center justify-content-center align-items-center button" style="color: rgb(255,255,255);filter: blur(0px); opacity: 0.95;"> <div class="container border rounded text-center justify-content-center align-items-center button" style="color: rgb(255,255,255);filter: blur(0px); opacity: 0.95;">
<form id="pd" onkeydown="pd()"> <form id="pc" onkeydown="nu()">
<p style=" font-size: 46px; ">P<wbr>yDo<wbr>dge B</p> <p style=" font-size: 46px; ">No&#8203;de Unbloc&#8203;ker</p>
<p style="font-family: 'Montserrat Alternates', sans-serif; ">An alterna<wbr>tive pr<wbr>oxy of a modi<wbr>fied Via Pro<wbr>xy by O<wbr>lyB.</p> <p style="font-family: 'Montserrat Alternates', sans-serif; ">A flexib&#8203;le seco&#8203;ndary pr&#8203;oxy compared to All&#8203;oy, P&#8203;M and P&#8203;D.</p>
<div class="input-group "> <div class="input-group ">
<div class="input-group-prepend"></div><input id="url" class="bg-dark border rounded-0 border-info shadow-sm form-control form-control-lg " type="text" name="url" style="width: 194px;font-family: <div class="input-group-prepend"></div><input id="url" class="bg-dark border rounded-0 border-info shadow-sm form-control form-control-lg " type="text" name="url" style="width: 194px;font-family:
'Montserrat Alternates', sans-serif;opacity: 0.80; color:rgb(255,255,255); " placeholder="Insert URL "> 'Montserrat Alternates', sans-serif;opacity: 0.80; color:rgb(255,255,255); " placeholder="Insert URL ">
<div class="input-group-append "><button id="pdprox" class="btn btn-dark btn-lg bg-dark border rounded-0 border-info shadow-lg select " data-bs-hover-animate="pulse " name="button" type="submit" style="width: 78px;padding: 8px;margin: <div class="input-group-append "><button id="nprox" class="btn btn-dark btn-lg bg-dark border rounded-0 border-info shadow-lg select " data-bs-hover-animate="pulse " name="button" type="submit " style="width: 78px;padding: 8px;margin:
0px;height: 46.126px;font-family: 'Montserrat Alternates', sans-serif;font-size: 16px; ">Go</button></div> 0px;height: 46.126px;font-family: 'Montserrat Alternates', sans-serif;font-size: 16px; ">Go</button></div>
</div> </div>
<div> <div>
<script> <script>
var header = document.getElementById("pd"); var header = document.getElementById("pc");
var btns = header.getElementsByClassName("pdprox"); var btns = header.getElementsByClassName("nprox");
for (var i = 0; i < btns.length; i++) { for (var i = 0; i < btns.length; i++) {
btns[i].addEventListener("click", function() {}); btns[i].addEventListener("click", function() {});
} }
</script> </script>
</div> </div>
<p class="text-primary " style="font-size: 20px;font-family: 'Montserrat Alternates', sans-serif; ">More Information:<br></p> <p class="text-primary " style="font-size: 20px;font-family: 'Montserrat Alternates', sans-serif; ">More Informat&#8203;ion:<br></p>
<p class="text-light " style="font-family: Lato, sans-serif; ">Works on vari<wbr>ous sites.<br><br>Explore!</p> <p class="text-light " style="font-family: Lato, sans-serif; ">Works on Di&#8203;scord (QR Code Only), Yout&#8203;ube (Might need to reload), etc.<br><br>Many sites work with this. Explore!</p>
<p class="text-primary " style="font-family: Lato, sans-serif; ">GitH<wbr>ub:&nbsp;<a class="text-primary " href="https://github.com/BinBashB&#8203;anana/Py&#8203;Dodge "><strong>&nbsp;https://github.com/BinBashBa&#8203;nana/PyD&#8203;odge</strong></a><br><br>Crea<wbr>ted by Ol<wbr>yB.</p> <p class="text-primary " style="font-family: Lato, sans-serif; ">Gi&#8203;tHub:&nbsp;<a class="text-primary " href="https://github.com/nf&#8203;riedly/n&#8203;ode-unblo&#8203;cker "><strong>&nbsp;https://git&#8203;hub.com/nfri&#8203;edly/no&#8203;de-unblo&#8203;cker</strong></a><br><br>Created
by Nat&#8203;han Friedl&#8203;y.</p>
</form> </form>
</div> </div>
</div> </div>
@ -144,7 +145,7 @@
<script src="assets/js/jquery.min.js "></script> <script src="assets/js/jquery.min.js "></script>
<script src="assets/bootstrap/js/bootstrap.min.js "></script> <script src="assets/bootstrap/js/bootstrap.min.js "></script>
<script src="assets/js/bs-init.js "></script> <script src="assets/js/bs-init.js "></script>
<script src="expr/pdbp.js "></script> <script src="expr/pd.js "></script>
</body> </body>
</html> </html>

View file

@ -3,7 +3,7 @@ function $(id) {
}; };
$('pmprox').onclick = function() { $('pmprox').onclick = function() {
var url = $('pmurl').value; var url = $('url').value;
var det = document.domain; var det = document.domain;
var domain = det.replace('www.', '').split(/[/?#]/)[0]; var domain = det.replace('www.', '').split(/[/?#]/)[0];
window.location.href = "https://p." + domain + "/" + url; window.location.href = "https://p." + domain + "/" + url;
@ -26,5 +26,5 @@ Array.from(document.getElementsByTagName('button')).forEach(e => {
}); });
window.onload = function() { window.onload = function() {
$('pmurl').focus(); $('url').focus();
} }