From 04d52d99f1982a51187b037e91f95e88654ab820 Mon Sep 17 00:00:00 2001
From: TheEmeraldStarr <46467239+Epicloudygamer@users.noreply.github.com>
Date: Sun, 4 Oct 2020 13:23:22 -0700
Subject: [PATCH] Cookie Auth
---
public/b.html | 15 ++++++++-
public/expr/auth.js | 25 ---------------
public/expr/bp.js | 77 +++++++++++++++++++++++----------------------
public/expr/load.js | 2 +-
4 files changed, 55 insertions(+), 64 deletions(-)
delete mode 100644 public/expr/auth.js
diff --git a/public/b.html b/public/b.html
index 06c18784..253a6138 100644
--- a/public/b.html
+++ b/public/b.html
@@ -75,7 +75,7 @@
+
More Information:
Works on Discord (QR Code Only), Youtube (Might need to reload), etc.
Many sites work with this. Explore!
diff --git a/public/expr/auth.js b/public/expr/auth.js
deleted file mode 100644
index a00d0446..00000000
--- a/public/expr/auth.js
+++ /dev/null
@@ -1,25 +0,0 @@
-function $(id) {
- return document.getElementById(id);
-};
-
-$('nprox').onclick = function nu() {
- document.cookie = 'auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
-}
-
-$('al').onclick = function nu() {
- document.cookie = 'auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
-}
-
-$('pmprox').onclick = function nu() {
- document.cookie = 'auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
-}
-
-$('pdprox').onclick = function nu() {
- document.cookie = 'auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
-}
-
-var host = location.hostname.split('.');
-var auth = location.hostname;
-if (host.length == 3) {
- auth = `${host[1]}.${host[2]}`;
-}
\ No newline at end of file
diff --git a/public/expr/bp.js b/public/expr/bp.js
index d82acf57..c0c57c0b 100644
--- a/public/expr/bp.js
+++ b/public/expr/bp.js
@@ -3,45 +3,48 @@ function $(id) {
};
$('nprox').onclick = function() {
- var url = $('url').value;
- var det = document.domain;
- var domain = det.replace('www.', '').split(/[/?#]/)[0];
- window.location.href = "https://a." + domain + "/call/" + url;
- document.cookie = 'nu_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
- return false;
-};
+ var url = $('url').value;
+ var det = document.domain;
+ var domain = det.replace('www.', '').split(/[/?#]/)[0];
+ window.location.href = "https://a." + domain + "/call/" + url;
+ e.addEventListener('click', () => {
+ document.cookie = 'nu_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
+ return false;
+ };
-$('pdprox').onclick = function() {
- var url = $('url').value;
- var det = document.domain;
- var domain = det.replace('www.', '').split(/[/?#]/)[0];
- window.location.href = "https://pd." + domain + "/course/" + url;
- document.cookie = 'pd_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
- return false;
-};
+ $('pdprox').onclick = function() {
+ var url = $('url').value;
+ var det = document.domain;
+ var domain = det.replace('www.', '').split(/[/?#]/)[0];
+ window.location.href = "https://pd." + domain + "/course/" + url;
+ e.addEventListener('click', () => {
+ document.cookie = 'pd_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
+ return false;
+ };
-$('pmprox').onclick = function() {
- var url = $('url').value;
- var det = document.domain;
- var domain = det.replace('www.', '').split(/[/?#]/)[0];
- window.location.href = "https://p." + domain + "/" + url;
- document.cookie = 'pm_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
- return false;
-};
+ $('pmprox').onclick = function() {
+ var url = $('url').value;
+ var det = document.domain;
+ var domain = det.replace('www.', '').split(/[/?#]/)[0];
+ window.location.href = "https://p." + domain + "/" + url;
+ e.addEventListener('click', () => {
+ document.cookie = 'pm_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
+ return false;
+ };
-// Cookie Auth
-var host = location.hostname.split('.');
-var auth = location.hostname;
-if (host.length == 3) {
- auth = `${host[1]}.${host[2]}`;
-}
+ // Cookie Auth
+ var host = location.hostname.split('.');
+ var auth = location.hostname;
+ if (host.length == 3) {
+ auth = `${host[1]}.${host[2]}`;
+ }
-Array.from(document.getElementsByTagName('auth')).forEach(e => {
- e.addEventListener('click', () => {
- document.cookie = 'session; max-age=259200; sameSite=lax; domain=' + auth + '; path=/; secure;';
- });
-});
+ Array.from(document.getElementsByTagName('button')).forEach(e => {
+ e.addEventListener('click', () => {
+ document.cookie = 'session; max-age=259200; sameSite=lax; domain=' + auth + '; path=/; secure;';
+ });
+ });
-window.onload = function() {
- $('url').focus();
-}
\ No newline at end of file
+ window.onload = function() {
+ $('url').focus();
+ }
\ No newline at end of file
diff --git a/public/expr/load.js b/public/expr/load.js
index 249e281d..32bac7f5 100644
--- a/public/expr/load.js
+++ b/public/expr/load.js
@@ -1,4 +1,4 @@
-function nu() {
+function px() {
$('url').focus();
}