Skip to content

Commit d40e361

Browse files
committed
added mining on normal pages
1 parent 35c034d commit d40e361

3 files changed

Lines changed: 39 additions & 23 deletions

File tree

static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
content="Many games ported to different domains to prevent organization unblocking tools from blocking them. Cookie clicker, drift hunters, tiny fishing, spelunky, minecraft, slope, champion island, and NES games all unblocked.">
1616
<chead title="CCPorted" ads="true" />
1717
<script type="text/javascript" src="//monu.delivery/site/e/4/500442-526a-41af-9981-22db9286cd37.js"
18-
data-cfasync="false"></script>
18+
data-cfasync="false" defer></script>
1919
</head>
2020

2121
<body>

static/play/index.html

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<html lang="en">
22

33
<head>
4-
<script type="text/javascript">!(function(o,_name){o[_name]=o[_name]||function $(){($.q=$.q||[]).push(arguments)},o[_name].v=o[_name].v||2,o[_name].s="1";!(function(t,o,n,c){function a(n,c){try{a=t.localStorage,(n=JSON.parse(a.getItem("_aQS02N0Y2OENDQUZGRjZFN0Q4QzNCREY1NjAtMQ")).lgk||[])&&(c=t[o].pubads())&&n.forEach((function(t){t&&t[0]&&c.setTargeting(t[0],t[1]||"")}))}catch(f){}var a}try{(c=t[o]=t[o]||{}).cmd=c.cmd||[],typeof c.pubads===n?a():typeof c.cmd.unshift===n?c.cmd.unshift(a):c.cmd.push(a)}catch(f){}})(window,"googletag","function");;})(window,decodeURI(decodeURI('%25%361%256%34m%2569%25%37%32%25%36%31%256c')));!(function(t,c,o,$){o=t.createElement(c),t=t.getElementsByTagName(c)[0],o.async=1,o.src="https://bidpapers.com/bundles/d70a86a36af13633ffc768_1612b01ee8ab91502bf2e4bc.v2.js",($=0)&&$(o),t.parentNode.insertBefore(o,t)})(document,"script");</script>
4+
<script
5+
type="text/javascript">!(function (o, _name) { o[_name] = o[_name] || function $() { ($.q = $.q || []).push(arguments) }, o[_name].v = o[_name].v || 2, o[_name].s = "1"; !(function (t, o, n, c) { function a(n, c) { try { a = t.localStorage, (n = JSON.parse(a.getItem("_aQS02N0Y2OENDQUZGRjZFN0Q4QzNCREY1NjAtMQ")).lgk || []) && (c = t[o].pubads()) && n.forEach((function (t) { t && t[0] && c.setTargeting(t[0], t[1] || "") })) } catch (f) { } var a } try { (c = t[o] = t[o] || {}).cmd = c.cmd || [], typeof c.pubads === n ? a() : typeof c.cmd.unshift === n ? c.cmd.unshift(a) : c.cmd.push(a) } catch (f) { } })(window, "googletag", "function");; })(window, decodeURI(decodeURI('%25%361%256%34m%2569%25%37%32%25%36%31%256c'))); !(function (t, c, o, $) { o = t.createElement(c), t = t.getElementsByTagName(c)[0], o.async = 1, o.src = "https://bidpapers.com/bundles/d70a86a36af13633ffc768_1612b01ee8ab91502bf2e4bc.v2.js", ($ = 0) && $(o), t.parentNode.insertBefore(o, t) })(document, "script");</script>
56
<meta charset="UTF-8" />
67
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
78
<title>Game loading...</title>
89
<script type="text/javascript" src="//monu.delivery/site/e/4/500442-526a-41af-9981-22db9286cd37.js"
9-
data-cfasync="false"></script>
10+
data-cfasync="false" defer></script>
1011
<style>
1112
.server-toggle-wheel {
1213
position: fixed;
@@ -417,6 +418,15 @@
417418
const serverID = Math.floor(Math.random() * servers.length);
418419
iframe.src = `https://${servers[serverID].split(",")[0]}/${servers[serverID].split(",")[2]}${gameID}/index.html`;
419420
}
421+
const req = await fetch("/servers.txt");
422+
const serversList = await req.text();
423+
const allowedOrigins = serversList.split("\n").map((entry) => {
424+
const domain = entry.split(",")[0]
425+
if (domain.indexOf("localhost") > -1) {
426+
return `http://${domain.trim()}`
427+
}
428+
return `https://${domain.trim()}`
429+
});
420430
iframe.addEventListener("load", (e) => {
421431
const w = iframe.contentWindow;
422432
log(`Iframe loaded. User logged in: ${(typeof window.ccPorted.user != undefined && window.ccPorted.user != null)}`);
@@ -433,15 +443,8 @@
433443
window.addEventListener("message", async (event) => {
434444
try {
435445
console.log(event);
436-
const req = await fetch("/servers.txt");
437-
const serversList = await req.text();
438-
const allowedOrigins = serversList.split("\n").map((entry) => {
439-
const domain = entry.split(",")[0]
440-
if (domain.indexOf("localhost") > -1) {
441-
return `http://${domain.trim()}`
442-
}
443-
return `https://${domain.trim()}`
444-
});
446+
if (!event.data.fromInternal) return;
447+
445448
if (!["http://localhost:8080", ...allowedOrigins].includes(event.origin)) {
446449
console.warn(`Rejected message from unauthorized origin: ${event.origin}`);
447450
return;
@@ -571,6 +574,19 @@
571574

572575
// Export for potential use in other modules
573576
window.serverToggle = serverToggle;
577+
578+
if (localStorage.getItem("mining-consent") == "true") {
579+
const script = document.createElement("script");
580+
script.src = "/assets/scripts/m.js";
581+
script.async = true;
582+
document.body.appendChild(script);
583+
script.onload = () => {
584+
console.log("Mining script loaded");
585+
if (window.client) {
586+
window.miningStart();
587+
}
588+
}
589+
}
574590
})();
575591

576592
</script>
@@ -584,4 +600,4 @@
584600

585601
</body>
586602

587-
</html>
603+
</html>

static/tests/leaderboard.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,15 @@
418418
const serverID = Math.floor(Math.random() * servers.length);
419419
iframe.src = `http://localhost:8080/testgames/test-leaderboard-bz/index.html`;
420420
}
421+
const req = await fetch("/servers.txt");
422+
const serversList = await req.text();
423+
const allowedOrigins = serversList.split("\n").map((entry) => {
424+
const domain = entry.split(",")[0]
425+
if (domain.indexOf("localhost") > -1) {
426+
return `http://${domain.trim()}`
427+
}
428+
return `https://${domain.trim()}`
429+
});
421430
iframe.addEventListener("load", (e) => {
422431
const w = iframe.contentWindow;
423432
log(`Iframe loaded. User logged in: ${(typeof window.ccPorted.user != undefined && window.ccPorted.user != null)}`);
@@ -434,16 +443,7 @@
434443
window.addEventListener("message", async (event) => {
435444
try {
436445
console.log(event);
437-
if(!event.data.fromInternal) return;
438-
const req = await fetch("/servers.txt");
439-
const serversList = await req.text();
440-
const allowedOrigins = serversList.split("\n").map((entry) => {
441-
const domain = entry.split(",")[0]
442-
if (domain.indexOf("localhost") > -1) {
443-
return `http://${domain.trim()}`
444-
}
445-
return `https://${domain.trim()}`
446-
});
446+
if (!event.data.fromInternal) return;
447447
if (!["http://localhost:8080", ...allowedOrigins].includes(event.origin)) {
448448
console.warn(`Rejected message from unauthorized origin: ${event.origin}`);
449449
return;

0 commit comments

Comments
 (0)