fix cdn and make play.html better

This commit is contained in:
Russell2259
2023-08-01 21:31:57 -06:00
parent 45c434ca87
commit 8b4795e8c9
9 changed files with 156 additions and 200 deletions
+6 -4
View File
@@ -19,9 +19,11 @@ app.get('/cdn/*', cors({ origin: false }), async (req, res, next) => {
if (asset.status == 200) {
var data = Buffer.from(await asset.arrayBuffer());
res.writeHead(200, {
'content-type': mime.getType(reqTarget)
});
if (mime.getType(reqTarget) === 'text/html') {
res.writeHead(200, {
'content-type': mime.getType(reqTarget)
});
}
if (mime.getType(reqTarget) === 'text/html') data = data + '<script src="/assets/js/cdn_inject.js" preload="true"></script>';
@@ -34,6 +36,6 @@ app.get('/cdn/*', cors({ origin: false }), async (req, res, next) => {
app.use((req, res) => res.status(404).sendFile(path.join(__dirname, './static/', '404.html')));
app.use((e, req, res, next) => res.status(500).send(`Something Broke \n\n The error was: ${e.stack}`));
const server = app.listen(port, '0.0.0.0', () => {
const server = app.listen(port, () => {
console.log(`Polaris is running on port ${server.address().port}, using nodejs ${process.version}`);
});
+82 -97
View File
@@ -90,49 +90,49 @@ button {
}
.mainpageimage-button {
background-color: transparent;
border: none;
padding: 0;
cursor: pointer;
justify-content: center;
width: 45vh;
margin-top: 10vh;
transition: all 0.4s ease;
background-color: transparent;
border: none;
padding: 0;
cursor: pointer;
justify-content: center;
width: 45vh;
margin-top: 10vh;
transition: all 0.4s ease;
}
.mainpageimage-button:hover{
transform: scale(1.025);
.mainpageimage-button:hover {
transform: scale(1.025);
opacity: 1;
}
.mainpageimage-button img {
display: block;
width: 100%;
height: auto;
border-radius: 4vh;
box-shadow: 0vh 0.75vh 1.5vh 0vh black;
display: block;
width: 100%;
height: auto;
border-radius: 4vh;
box-shadow: 0vh 0.75vh 1.5vh 0vh black;
}
.mainpage-text {
box-shadow: 0.5vh 0.5vh 1vh 0vh var(--shadow-color);
background-color: var(--background-color);
width: 30vh;
height: 20vh;
color: var(--text);
text-align: center;
border-radius: 2vh;
justify-content: center;
padding: 0.5vh;
margin: 0 auto;
margin-top: 5vh;
position: relative;
opacity: 0.9;
padding: 2vh;
line-height: 2vh;
box-shadow: 0.5vh 0.5vh 1vh 0vh var(--shadow-color);
background-color: var(--background-color);
width: 30vh;
height: 20vh;
color: var(--text);
text-align: center;
border-radius: 2vh;
justify-content: center;
padding: 0.5vh;
margin: 0 auto;
margin-top: 5vh;
position: relative;
opacity: 0.9;
padding: 2vh;
line-height: 2vh;
}
.settings-button {
box-shadow: 0.5vh 0.5vh 1vh 0vh var(--shadow-color);
box-shadow: 0.5vh 0.5vh 1vh 0vh var(--shadow-color);
}
select {
@@ -245,7 +245,7 @@ input:checked+.slider:before {
border-radius: 1.5vh;
}
.game:hover {
.game:hover {
filter: brightness(95%);
transform: translateY(-0.2vh);
border-color: #ffffff;
@@ -302,7 +302,7 @@ input:checked+.slider:before {
border-radius: 1.5vh;
}
.app:hover {
.app:hover {
filter: brightness(95%);
transform: translateY(-0.2vh);
border-color: #ffffff;
@@ -389,81 +389,66 @@ input:checked+.slider:before {
}
.framei {
border-radius: 2vh;
box-shadow: 0vh 0.75vh 1.5vh 0vh var(--shadow-color);
border-width: 3vh;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 2vh;
box-shadow: 0vh 0.75vh 1.5vh 0vh var(--shadow-color);
border-width: 3vh;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.mainiframe {
position: relative;
position: relative;
}
.center-content {
text-align: center;
justify-content: center;
text-align: center;
justify-content: center;
}
/*SCHMEEBLE WARP*/
/*SCHMEEBLE WARP*/
/*SCHMEEBLE WARP*/
/*SCHMEEBLE WARP*/
/*SCHMEEBLE WARP*/
#game-frame{
margin: 0 auto;
height: 100%;
display: block;
border-top: 3vh solid black;
border-left: 3vh solid black;
border-right: 3vh solid black;
border-radius: 4vh 4vh 0vh 0vh;
border-color: rgba(0, 0, 0, 0.9);
}
#iframe-options{
max-width: 75%;
margin: 0 auto;
border-left: 3vh solid black;
border-right: 3vh solid black;
display: flex;
justify-content: space-between;
border-radius: 0vh 0vh 4vh 4vh;
color: #ffffff;
border-color: rgba(0, 0, 0, 0);
background: rgba(0, 0, 0, 0.9);
}
#iframe-options > b {
display: inline-block;
}
.icons-options{
padding-top: 0;
margin: 0;
display: inline-block;
float: right;
}
.iframe-name{
display: flex;
padding-left: 1vh;
font-size: 17px;
}
.logo-options{
color: #ffffff;
}
.container-frame {
height: 75%;
.frame {
margin: auto;
display: block;
border-top: 3vh solid;
border-left: 3vh solid;
border-right: 3vh solid;
border-radius: 4vh 4vh 0vh 0vh;
background: #fff;
height: 70vh;
width: 75vw;
outline: none;
border-color: rgba(0, 0, 0);
}
#game-icon-sm{
.gamebar img {
width: 35px;
height: 35px;
margin: 10px;
border-radius: 5px;
}
/*JUOODLE SHOOP*/
/*JUOODLE SHOOP*/
.gamebar p {
font-weight: 900;
font-size: 20px;
margin: auto 0;
}
/*JUOODLE SHOOP*/
/*DO NOT TOUCH LINE 445!!!*/
.gamebar i {
font-size: 30px;
margin: auto 0;
margin-left: auto;
}
.gamebar {
width: 75vw;
margin: 0 auto;
border-left: 3vh solid black;
border-right: 3vh solid black;
display: flex;
border-radius: 0vh 0vh 4vh 4vh;
color: #ffffff;
border-color: rgba(0, 0, 0);
background: rgba(0, 0, 0);
}
+10 -7
View File
@@ -15,7 +15,14 @@
font-size: 3vh;
margin-left: 1.3vh;
position: relative;
bottom: 2vh;
top: -2.8vh;
}
.navbar>.title>span>span {
display: block;
position: relative;
font-size: 12px;
margin-left: 3vh;
}
.navbar>.end {
@@ -35,9 +42,5 @@
.navbar>.end>a:hover {
color: var(--hover);
}
.byskool{
float: left:
}
color: var(--hover);
}
+30 -12
View File
@@ -1,23 +1,41 @@
/*const gamedata = JSON.parse(localStorage.getItem('gamedata'));
document.getElementById('logo-options').textContent = gamedata.name;
document.getElementById('game-icon-sm').src = gamedata.imgurl;
document.getElementById('game-frame').src = gamedata.gameurl;*/
const load = (url, name, type) => {
const load = () => {
document.addEventListener('keydown', (e) => {
if (e.key === 'f') fullscreen();
if (e.key === 'f') {
const iframe = document.querySelector('.frame');
if (iframe.requestFullscreen) iframe.requestFullscreen();
else if (iframe.webkitRequestFullscreen) iframe.webkitRequestFullscreen();
else if (iframe.mozRequestFullScreen) iframe.mozRequestFullScreen();
else if (iframe.msRequestFullscreen) iframe.msRequestFullscreen();
}
});
function fullscreen() {
let iframe = document.getElementById('game-frame');
if (!iframe) iframe = document.getElementById('app-frame');
const gameID = new URLSearchParams(location.search).get('id');
fetch('/assets/JSON/games.json')
.then(res => res.json())
.then(games => {
const game = games.find(game => game.id === gameID);
if (game) {
const iframe = document.querySelector('.frame');
iframe.src = game.source;
document.querySelector('#gameicon').src = game.image;
document.querySelector('#gametitle').textContent = game.name;
} else {
document.querySelector('#gametitle').textContent = 'Failed to load game';
}
});
document.querySelector('#fullscreen').addEventListener('click', () => {
const iframe = document.querySelector('.frame');
if (iframe.requestFullscreen) iframe.requestFullscreen();
else if (iframe.webkitRequestFullscreen) iframe.webkitRequestFullscreen();
else if (iframe.mozRequestFullScreen) iframe.mozRequestFullScreen();
else if (iframe.msRequestFullscreen) iframe.msRequestFullscreen();
};
});
};
export default { load };
+5
View File
@@ -1,6 +1,7 @@
import Settings from './settings.js';
import Games from './games.js';
import Apps from './apps.js';
import Frame from './frame.js';
import WPM from './wpm.js';
import PolarisError from './error.js';
@@ -93,6 +94,10 @@ if (window.self === window.top) {
if (location.pathname === '/search') {
WPM.load();
}
if (location.pathname === '/play') {
Frame.load();
}
}, 500);
}
+2 -3
View File
@@ -1,7 +1,7 @@
<div class="navbar">
<a class="title" href="/">
<img src="/assets/img/logo.png" />
<span>Polaris<p class="byskool"> By Skool</p></span>
<span>Polaris<span> By Skool</span></span>
</a>
<div class="end">
@@ -10,7 +10,7 @@
<a href="/apps"><i class="fa-solid fa-rocket-launch fa-xs"></i>Apps</a>
<a href="/search"><i class="fa-solid fa-magnifying-glass fa-xs"></i>Proxy</a>
<a href="/cheats"><i class="fa-solid fa-computer fa-xs"></i>Cheats</a>
<a href="#settings" data-link="true" data-attr="sidebar_trigger"><i class="fa-solid fa-gear fa-sm"></i></a>
<a href="#settings" data-link="true" data-attr="sidebar_trigger"><i class="fa-solid fa-gear fa-sm"></i>Settings</a>
</div>
</div>
@@ -25,7 +25,6 @@
<button class="icon-button"><i class="fa-brands fa-discord"></i></button>
<button class="icon-button"><i class="fa-brands fa-spotify"></i></button>
</div>
<br>
<h1>Settings</h1>
<h3>Panic Key</h3>
+3 -1
View File
@@ -18,7 +18,9 @@
</button>
<div class="mainpage-text">
<h1>Polaris</h1>
<p>By Skool</p><br><button onclick="window.open('https://discord.gg/skool', '_blank');">Join our Discord</a>
<p>By Skool</p>
<br>
<a href="https://discord.gg/skool"><button>Join our Discord</button></a>
</div>
</div>
+18 -66
View File
@@ -2,74 +2,26 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="/assets/css/main.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="/assets/css/main.css">
<title>Home | Polaris</title>
<title>Home | Polaris</title>
</head>
<body style="height: 100%;">
<script src="/assets/js/frame.js" type="module"></script>
<script>
function fullscreen() {
let iframe = document.getElementById('game-frame');
if (!iframe) iframe = document.getElementById('app-frame');
if (iframe.requestFullscreen) iframe.requestFullscreen();
else if (iframe.webkitRequestFullscreen) iframe.webkitRequestFullscreen();
else if (iframe.mozRequestFullScreen) iframe.mozRequestFullScreen();
else if (iframe.msRequestFullscreen) iframe.msRequestFullscreen();
};
</script>
<div class="container-frame">
<iframe id="game-frame" scrolling="no" frameborder="0" width="75%" height="80%" cellspacing="0" src="/loading.html"></iframe>
<div id="iframe-options">
<div class="iframe-icon">
<table style="width: 100%;">
<tr>
<td><img src="https://via.placeholder.com/20x20?text=img" id="game-icon-sm" width="20" height="20"></td>
<td style="width: 40vh; margin-left:3vh;"><b><p class="iframe-name"> Failed to load game</p></b></td>
<td><i class="fa-solid fa-expand" style="color: #ffffff; margin-left: 105vh;" onclick="fullscreen()"></i></a></td>
</table>
<body>
<div>
<iframe class="frame" scrolling="no" frameborder="no"></iframe>
<div class="gamebar">
<img src="https://via.placeholder.com/20x20?text=img" id="gameicon"/>
<p id="gametitle">Loading...</p>
<i class="fa-solid fa-expand" id="fullscreen"></i>
</div>
</div>
</div>
<br>
<br>
<br>
<br>
<h1>Description</h1>
<p id="gamedesc">Failed to load description</p>
<br>
<script>
// Get the current URL
const url = new URL(window.location.href);
// Get the value of the game id
const searchParams = new URLSearchParams(url.search);
const gameID = searchParams.get('id');
fetch('/assets/JSON/games.json')
.then(res => res.json())
.then(games => {
const game = games.find(game => game.id === gameID);
if (game) {
// Get a reference to the iframe element
const iframe = document.getElementById("game-frame");
// Set the src attribute of the iframe
iframe.src = game.source;
document.getElementById("game-icon-sm").src = game.image;
document.querySelector(".iframe-name").textContent = game.name;
document.getElementById("gamedesc").textContent = game.desc;
} else {
document.querySelector(".iframe-name").textContent = "Game not found";
}
});
</script>
<script src="/assets/js/main.js" type="module"></script>
</div>
<script src="/assets/js/main.js" type="module"></script>
</body>
</html>
</html>
-10
View File
@@ -1,10 +0,0 @@
self.__uv$config = {
prefix: "/launch",
bare: "/bare/",
encodeUrl: Ultraviolet.codec.xor.encode,
decodeUrl: Ultraviolet.codec.xor.decode,
handler: "/uv/uv.handler.js",
bundle: "/uv/uv.bundle.js",
config: "/uv/uv.config.js",
sw: "/uv/uv.sw.js",
};