Modularize nebula JS files and add maps for osana

This commit is contained in:
wearrrrr 2023-04-12 22:54:41 -05:00
parent afe883a31a
commit 3c48bc02f8
8 changed files with 169 additions and 160 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"version":3,"file":"osana.config.js","mappings":"mBAAAA,KAAKC,eAAiB,CAClBC,KAAM,GAAGC,SAASC,eAClBC,OAAQ,WACRC,MAAON,KAAKO,eAAeC,OAAOC,KAClCC,MAAO,CACHC,OAAQ,mBACRC,OAAQ,mBACRC,OAAQ,mBACRC,OAAQ,oBAEZC,UAAW,CACP,wBACA,0B","sources":["webpack://osana/./src/config.ts"],"sourcesContent":["self.__osana$config = {\n bare: `${location.origin}/bare/`,\n prefix: \"/~osana/\",\n codec: self.__osana$bundle.codecs.none,\n files: {\n config: \"/osana.config.js\",\n client: \"/osana.client.js\",\n bundle: \"/osana.bundle.js\",\n worker: \"/osana.worker.js\"\n },\n blacklist: [\n /^(www\\.)?netflix\\.com/,\n /^accounts\\.google\\.com/,\n ]\n};\nexport {};\n"],"names":["self","__osana$config","bare","location","origin","prefix","codec","__osana$bundle","codecs","none","files","config","client","bundle","worker","blacklist"],"sourceRoot":""}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,49 @@
// Get's the current day using the Date function built in.
// A dependency for displaying time - displayTime(void)
function getDayName(dateStr, locale) {
var date = new Date(dateStr);
return date.toLocaleDateString(locale, { weekday: "long" });
}
// The main function to show the time on the main page
// needs to be initialized by a call (only one)
// Dependent on getDayName function
function displayTime() {
var date = new Date();
var h = date.getHours(); // 0 - 23
var m = date.getMinutes(); // 0 - 59
var s = date.getSeconds(); // 0 - 59
var session = "AM";
h = h == 12 ? 24 : h;
if (h == 0) {
h = 12;
} else if (h >= 12) {
h = h - 12;
session = "PM";
}
h = h < 10 ? "0" + h : h;
m = m < 10 ? "0" + m : m;
s = s < 10 ? "0" + s : s;
// Repeat itself every second
setTimeout(displayTime, 1000);
// Get today's date
var today = new Date();
var dd = String(today.getDate()).padStart(2, "0");
var mm = String(today.getMonth() + 1).padStart(2, "0"); //January is 0!
var yyyy = today.getFullYear();
today = mm + "/" + dd + "/" + yyyy;
var time =
h + "<span style='opacity:100%;' class='clockColon'>:</span>" + m;
try {
document.getElementById("digitalClock").innerHTML = getDayName(today, "us-US") + ", " + time + " " + session + ".";
} catch {
}
return time;
}
// initialize the time function
displayTime();

View file

@ -34,10 +34,11 @@ function setLoaderText() {
}, 17000); }, 17000);
} }
window.stealthEngineLoaded = false;
window.addEventListener("load", () => { window.addEventListener("load", () => {
// Register the service workers for Osana and Ultraviolet proxy protocols // Register the service workers for Osana and Ultraviolet proxy protocols
// This is a better method than registering onsubmit because this allows the ability to use proxied links on the main page. // This is a better method than registering onsubmit because this allows the ability to use proxied links on the main page.
const dbPromise = Ultraviolet.openDB("keyval-store", 1, { const dbPromise = Ultraviolet.openDB("keyval-store", 1, {
upgrade(db) { upgrade(db) {
db.createObjectStore("keyval"); db.createObjectStore("keyval");
@ -62,56 +63,6 @@ window.addEventListener("load", () => {
scope: "/service/" scope: "/service/"
}); });
// Get's the current day using the Date function built in.
// A dependency for displaying time - displayTime(void)
function getDayName(dateStr, locale) {
var date = new Date(dateStr);
return date.toLocaleDateString(locale, { weekday: "long" });
}
// The main function to show the time on the main page
// needs to be initialized by a call (only one)
// Dependent on getDayName function
function displayTime() {
var date = new Date();
var h = date.getHours(); // 0 - 23
var m = date.getMinutes(); // 0 - 59
var s = date.getSeconds(); // 0 - 59
var session = "AM";
h = h == 12 ? 24 : h;
if (h == 0) {
h = 12;
} else if (h >= 12) {
h = h - 12;
session = "PM";
}
h = h < 10 ? "0" + h : h;
m = m < 10 ? "0" + m : m;
s = s < 10 ? "0" + s : s;
// Repeat itself every second
setTimeout(displayTime, 1000);
// Get today's date
var today = new Date();
var dd = String(today.getDate()).padStart(2, "0");
var mm = String(today.getMonth() + 1).padStart(2, "0"); //January is 0!
var yyyy = today.getFullYear();
today = mm + "/" + dd + "/" + yyyy;
var time =
h + "<span style='opacity:100%;' class='clockColon'>:</span>" + m;
try {
document.getElementById("digitalClock").innerHTML = getDayName(today, "us-US") + ", " + time + " " + session + ".";
} catch {
}
return time;
}
// initialize the time function
displayTime();
// Link evaluation // Link evaluation
// This functions' purpose is to check a string of text (the argument) // This functions' purpose is to check a string of text (the argument)
// it recognizes whether a string is a URL or not, and it returns a true or false value // it recognizes whether a string is a URL or not, and it returns a true or false value
@ -169,7 +120,11 @@ window.addEventListener("load", () => {
: __osana$config.prefix + __osana$config.codec.encode(url); : __osana$config.prefix + __osana$config.codec.encode(url);
const option = localStorage.getItem("nogg"); const option = localStorage.getItem("nogg");
if (option === "on") { if (option === "on") {
if (window.stealthEngineLoaded !== false) {
stealthEngine(redirectTo); stealthEngine(redirectTo);
} else {
console.error("Stealth Engine failed to load! Please contact support - discord.gg/unblocker")
}
} else { } else {
setTimeout(() => { setTimeout(() => {
// If StealthMode is off, this is the enabled option. // If StealthMode is off, this is the enabled option.
@ -256,100 +211,6 @@ document.addEventListener("visibilitychange", handleTabLeave)
}); });
let tryAbFavi = localStorage.getItem("ABfaviconURL");
let ABFavicon = "";
if (tryAbFavi === null) {
console.warn("ABfaviconURL is null, Defaulting");
ABFavicon = "";
} else if (tryAbFavi == "") {
console.warn("ABfaviconURL is empty, Defaulting");
ABFavicon = "";
} else {
ABFavicon = tryAbFavi;
}
let tryAbTitle = localStorage.getItem("ABtitle");
let ABTitle = "";
if (tryAbTitle === null) {
console.warn("ABtitle is null, Defaulting");
ABTitle = "";
} else if (tryAbTitle == "") {
console.warn("ABtitle is empty, Defaulting");
ABTitle = "";
} else {
ABTitle = tryAbTitle;
}
// Stealth engine, a dependency for everything above.
function stealthEngine(encodedURL) {
// Remember that the EncodedURL argument must be pre-encoded, or encoded before the function is called.
// This function does not encode the argument at all!
// Initialize the variable
let inFrame;
// make sure there isn't a window open already
try {
inFrame = window !== top;
} catch (e) {
inFrame = true;
}
setTimeout(() => {
// Basically, a checklist to make sure that an error won't occur.
// In this if statement, we're checking if an iframe is already being opened, if popups are disabled, and if the user agent IS NOT firefox (firefox sucks, sorry Moz)
if (!inFrame && !navigator.userAgent.includes("Firefox")) {
const popup = open("about:blank", "_blank");
if (!popup || popup.closed) {
alert("StealthEngine was unable to open a popup. (do you have popups disabled?)");
} else {
const doc = popup.document;
const iframe = doc.createElement("iframe");
const style = iframe.style;
popup.onload = () => {
document.getElementById("lpoader").style.display = "none"
document.getElementById('connectorText').textContent = "connecting to service"
setTimeout(() => {
document.getElementById('connectorText').textContent = "connecting to service"
}, 17500);
};
var isClosed = setInterval(function () {
if (popup.closed) {
clearInterval(isClosed);
document.getElementById("lpoader").style.display = "none"
document.getElementById('connectorText').textContent = "connecting to service"
}
}, 1000);
// Favicon attachment
const img = doc.createElement("link");
const arcSrc = doc.createElement("script");
// We attach ARC because it supports us, keeping our arc link there would be greatly appreciated :)
arcSrc.setAttribute("src", "https://arc.io/widget.min.js#BgaWcYfi");
arcSrc.setAttribute("async", "");
doc.head.appendChild(arcSrc);
const link = location.href;
img.rel = "icon";
img.href = ABFavicon || "https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png";
if (localStorage.nogg == "on") {
doc.title = ABTitle || getRandomName();
} else {
doc.title = ABTitle || "Nebula";
}
var currentLink = link.slice(0, link.length - 1);
iframe.src = currentLink + encodedURL;
style.position = "fixed";
style.top = style.bottom = style.left = style.right = 0;
style.border = style.outline = "none";
style.width = style.height = "100%";
doc.body.appendChild(iframe);
doc.head.appendChild(img);
}
}
}, 1500);
}
}); });
// Set the option // Set the option

View file

@ -0,0 +1,97 @@
// Stealth engine, a dependency for everything above.
// ensures that the js file is loaded
window.stealthEngineLoaded = true;
function stealthEngine(encodedURL) {
// Remember that the EncodedURL argument must be pre-encoded, or encoded before the function is called.
// This function does not encode the argument at all!
// Initialize the variable
let inFrame;
// make sure there isn't a window open already
try {
inFrame = window !== top;
} catch (e) {
inFrame = true;
}
setTimeout(() => {
// Basically, a checklist to make sure that an error won't occur.
// In this if statement, we're checking if an iframe is already being opened, if popups are disabled, and if the user agent IS NOT firefox (firefox sucks, sorry Moz)
if (!inFrame && !navigator.userAgent.includes("Firefox")) {
const popup = open("about:blank", "_blank");
if (!popup || popup.closed) {
alert("StealthEngine was unable to open a popup. (do you have popups disabled?)");
} else {
const doc = popup.document;
const iframe = doc.createElement("iframe");
const style = iframe.style;
popup.onload = () => {
document.getElementById("lpoader").style.display = "none"
document.getElementById('connectorText').textContent = "connecting to service"
setTimeout(() => {
document.getElementById('connectorText').textContent = "connecting to service"
}, 17500);
};
var isClosed = setInterval(function () {
if (popup.closed) {
clearInterval(isClosed);
document.getElementById("lpoader").style.display = "none"
document.getElementById('connectorText').textContent = "connecting to service"
}
}, 1000);
// Favicon attachment
const img = doc.createElement("link");
const arcSrc = doc.createElement("script");
// We attach ARC because it supports us, keeping our arc link there would be greatly appreciated :)
arcSrc.setAttribute("src", "https://arc.io/widget.min.js#BgaWcYfi");
arcSrc.setAttribute("async", "");
doc.head.appendChild(arcSrc);
const link = location.href;
img.rel = "icon";
img.href = ABFavicon || "https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png";
if (localStorage.nogg == "on") {
doc.title = ABTitle || getRandomName();
} else {
doc.title = ABTitle || "Nebula";
}
var currentLink = link.slice(0, link.length - 1);
iframe.src = currentLink + encodedURL;
style.position = "fixed";
style.top = style.bottom = style.left = style.right = 0;
style.border = style.outline = "none";
style.width = style.height = "100%";
doc.body.appendChild(iframe);
doc.head.appendChild(img);
}
}
}, 1500);
}
let tryAbFavi = localStorage.getItem("ABfaviconURL");
let ABFavicon = "";
if (tryAbFavi === null) {
console.warn("ABfaviconURL is null, Defaulting");
ABFavicon = "";
} else if (tryAbFavi == "") {
console.warn("ABfaviconURL is empty, Defaulting");
ABFavicon = "";
} else {
ABFavicon = tryAbFavi;
}
let tryAbTitle = localStorage.getItem("ABtitle");
let ABTitle = "";
if (tryAbTitle === null) {
console.warn("ABtitle is null, Defaulting");
ABTitle = "";
} else if (tryAbTitle == "") {
console.warn("ABtitle is empty, Defaulting");
ABTitle = "";
} else {
ABTitle = tryAbTitle;
}

View file

@ -39,16 +39,15 @@
<!-- Stylesheets --> <!-- Stylesheets -->
<script src="resources/nebulamain.js"></script> <script src="resources/nebulamain.js"></script>
<link rel="stylesheet" href="style/main.css" /> <script src="resources/nebulaclock.js"></script>
<script src="resources/stealthEngine.js"></script>
<link rel="stylesheet" href="style/main.css">
<!-- Embed --> <!-- Embed -->
<meta name="theme-color" content="#eb6f92" /> <meta name="theme-color" content="#eb6f92">
<meta property="og:title" content="Nebula" /> <meta property="og:title" content="Nebula">
<meta property="og:type" content="website" /> <meta property="og:type" content="website">
<meta <meta property="og:image" content="https://static.nebulacdn.xyz/content/images/nebula_logo_619x619.png">
property="og:image" <meta property="og:description" content="Nebula Web">
content="https://static.nebulacdn.xyz/content/images/nebula_logo_619x619.png"
/>
<meta property="og:description" content="Nebula Web" />
</head> </head>
<body> <body>
<!-- Scripts --> <!-- Scripts -->
@ -389,8 +388,7 @@
<a <a
class="tos" class="tos"
href="#" href="#"
onclick="href = '/service/go/' + __uv$config.encodeUrl('https://static.nebulacdn.xyz/content/other/nebula-privacy-policy/index.html')" onclick='window.href = "/service/go/" + __uv$config.encodeUrl("https://static.nebulacdn.xyz/content/other/nebula-privacy-policy/index.html")'>Privacy</a
>Privacy</a
> >
</div> </div>
</body> </body>