some small updates

This commit is contained in:
russell2259
2023-10-21 01:26:10 +00:00
parent 2357592e43
commit 5655cdfe8a
6 changed files with 1609 additions and 40 deletions
+5 -17
View File
@@ -15,13 +15,9 @@ const bareServer = createBareServer('/bare/');
const port = process.env.PORT || process.argv[2] || 8080;
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
let navbar = fs.readFileSync('./templates/navbar.html', 'utf-8');
const navbar = fs.readFileSync('./templates/navbar.html', 'utf-8');
fs.readdirSync('./pages').forEach(file => {
let fileData = fs.readFileSync('./pages/' + file, 'utf-8');
fileData = fileData.replace('<body>', '<body> ' + navbar);
app.get(`/${file.split('.')[0] === 'index' ? '' : file.split('.')[0]}`, (req, res) => res.status(200).send(fileData));
});
fs.readdirSync('./pages').forEach(file => app.get(`/${file.split('.')[0] === 'index' ? '' : file.split('.')[0]}`, (req, res) => res.status(200).send(fs.readFileSync('./pages/' + file, 'utf-8').replace('<body>', '<body> ' + navbar))));
app.use(express.static(path.join(__dirname, '/static')));
@@ -39,15 +35,13 @@ app.get('/cdn/*', cors({
'content-type': mime.getType(reqTarget)
});
if (mime.getType(reqTarget) === 'text/html') data = data + '<script src=\'/assets/js/cdn_inject.js\' preload=\'true\'></script>';
if (mime.getType(reqTarget) === 'text/html') data = '<script src=\'/assets/js/cdn_inject.js\' async></script>' + data;
res.end(data);
} else next();
});
let notFoundFile = fs.readFileSync('./pages/404.html', 'utf-8');
notFoundFile = notFoundFile.replace('<body>', '<body> ' + navbar);
app.use((req, res, next) => res.status(404).send(notFoundFile));
app.use((req, res) => res.status(404).send(fs.readFileSync('./pages/404.html', 'utf-8').replace('<body>', '<body> ' + navbar)));
server.on('request', (req, res) => {
if (bareServer.shouldRoute(req)) bareServer.routeRequest(req, res);
@@ -59,10 +53,4 @@ server.on('upgrade', (req, socket, head) => {
else socket.end();
});
server.on('listening', () => {
console.log(`Polaris started! http://localhost:${port}`);
});
server.listen({
port
});
server.listen(() => console.log(`Polaris is running on port ${port} using node.js ${process.version}`));
+1555
View File
File diff suppressed because it is too large Load Diff
+18 -15
View File
@@ -9,40 +9,43 @@
<link rel="stylesheet" href="/assets/css/main.css">
<meta name="6f9c120da628a61af2a67d51a1785baa69240b33" content="6f9c120da628a61af2a67d51a1785baa69240b33" />
<script src="https://cdn.counter.dev/script.js" data-id="b0b2d4b2-daca-47e1-9287-b9e649b3dcd2" data-utcoffset="-5"></script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9661054437111080"
crossorigin="anonymous"></script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9661054437111080" crossorigin="anonymous"></script>
<title>Home | Polaris</title>
</head>
<body>
<h1>Welcome to <div class="blue">Polaris</div></h1>
<h1>Welcome to <span class="blue">Polaris</span></h1>
<div class="mainpageimage">
<div class="featuredcontainer">
<div class="featuredtopbar">
<b>
<p>Featured Game</p>
</b>
<b>Featured Game</b>
</div>
<div>
<img class="featuredimg" loading="eager" data-link="true" />
</div>
</div>
</div>
<div class="mainpage-text">
<h1>Polaris</h1>
<p>By Skool</p>
<a href="https://dsc.gg/skoolworld "><button>Join our Discord Server</button></a>
<br>
<br>
<a href="https://dsc.gg/skoolworld ">
<button>Join our Discord Server</button>
</a>
<br><br>
<hr>
<h2>Changelog</h2>
<p class="small">10/20/2023</p>
<p class="small">Added many games, fixed Minecraft, fixed alignment</p>
<p class="small">10/19/2023</p>
<p class="small">Redid homescreen to have a changelog</p>
<div id="changelog"></div>
</div>
<br>
<br>
<br><br>
<script src="/assets/js/main.js" type="module"></script>
<script src='https://cdn.jsdelivr.net/npm/@widgetbot/crate@3' async defer>
new Crate({
+10
View File
@@ -0,0 +1,10 @@
[
{
date: '10/20/2023',
simpleDescription: 'Added games, other small updates'
},
{
date: '10/19/2023',
simpleDescription: 'Homepage now has a changelog!'
}
]
+5 -5
View File
@@ -1,11 +1,11 @@
import PolarisError from './error.js';
const tiltEffectSettings = {
max: 8, // max tilt rotation (degrees (deg))
perspective: 1000, // transform perspective, the lower the more extreme the tilt gets (pixels (px))
scale: 1.05, // transform scale - 2 = 200%, 1.5 = 150%, etc..
speed: 800, // speed (transition-duration) of the enter/exit transition (milliseconds (ms))
easing: 'cubic-bezier(.03,.98,.52,.99)' // easing (transition-timing-function) of the enter/exit transition
max: 8,
perspective: 1000,
scale: 1.05,
speed: 800,
easing: 'cubic-bezier(.03,.98,.52,.99)'
};
const load = () => {
+16 -3
View File
@@ -1,4 +1,4 @@
// THIS FILE IS CRITICAL, DO NOT TOUCH UNLESS YOU KNOW WHAT YOU'RE DOING
// Don't touch
import { load } from './settings.js';
import Games from './games.js';
import Apps from './apps.js';
@@ -39,7 +39,7 @@ if (window.self === window.top) {
if (location.pathname === '/') {
fetch('/assets/JSON/games.json').then(res => res.json()).then(games => {
const randomID = 22; // :3
const randomID = 22;
const game = games[randomID];
document.querySelector('.featuredimg').addEventListener('click', () => {
@@ -47,10 +47,23 @@ if (location.pathname === '/') {
type: 'game',
game
}));
location.href = '/view';
});
document.querySelector('.featuredimg').src = "/assets/img/wide/crossyroad.webp";
document.querySelector('.featuredimg').src = '/assets/img/wide/crossyroad.webp';
}).catch(e => new PolarisError('Failed to load featured game.'));
fetch('/assets/JSON/changelog.json').then(res => res.json()).then(changelog => changelog.forEach(change => {
const date = document.createElement('p');
date.textContent = change.date;
date.classList = 'small';
document.querySelector('#changelog').appendChild(date);
const description = document.createElement('p');
description.textContent = change.simpleDescription;
description.classList = 'small';
document.querySelector('#changelog').appendChild(description);
}));
}