Merge pull request 'make site load without javascript' (#2) from selenite/pages:main into main

Reviewed-on: https://codeberg.org/skysthelimitt/selenite/pulls/2
This commit is contained in:
skysthelimitt 2024-01-24 21:30:02 +00:00
commit e7a5113bfb
19 changed files with 223 additions and 7 deletions

BIN
Gloom/779452_-test.swf Normal file

Binary file not shown.

3
Gloom/cover.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.3 KiB

2
Gloom/index.html Normal file
View File

@ -0,0 +1,2 @@
<script src="https://unpkg.com/@ruffle-rs/ruffle"></script>
<embed src="779452_-test.swf" width="100%" height="100%">

12
Selenite.csproj Normal file
View File

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="3.1.0" />
</ItemGroup>
</Project>

56
Startup.cs Normal file
View File

@ -0,0 +1,56 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.IO;
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
}
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new Microsoft.Extensions.FileProviders.PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")),
RequestPath = ""
});
app.Map("/projects", HandleRequest("projects.html"));
app.Map("/bookmarklets", HandleRequest("bookmarklets.html"));
app.Map("/settings", HandleRequest("settings.html"));
app.Map("/support", HandleRequest("support.html"));
app.Map("/about", HandleRequest("about.html"));
app.Map("/transfer", HandleRequest("transfer.html"));
app.Map("/suggest", HandleRequest("suggest.html"));
app.Map("/contact", HandleRequest("contact.html"));
app.Map("/ad", HandleRequest("ad.html"));
app.Run(async (context) =>
{
await context.Response.WriteAsync("Not Found");
});
}
private static Action<IApplicationBuilder> HandleRequest(string fileName)
{
return app => app.Run(async context =>
{
await context.Response.SendFileAsync(Path.Combine(Directory.GetCurrentDirectory(), fileName));
});
}
}

Binary file not shown.

3
copter/cover.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 23 KiB

2
copter/index.html Normal file
View File

@ -0,0 +1,2 @@
<script src="https://unpkg.com/@ruffle-rs/ruffle"></script>
<embed src="copter(www.albinoblacksheep.com).swf" width="100%" height="100%">

2
deps.ts Normal file
View File

@ -0,0 +1,2 @@
export { serve } from 'https://deno.land/std/http/server.ts';
export { join } from 'https://deno.land/std/path/mod.ts';

3
fly/cover.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 889 KiB

Binary file not shown.

2
fly/index.html Normal file
View File

@ -0,0 +1,2 @@
<script src="https://unpkg.com/@ruffle-rs/ruffle"></script>
<embed src="flybooger(www.albinoblacksheep.com).swf" width="100%" height="100%">

View File

@ -1,4 +1,22 @@
[
{
"name": "Gloom",
"image": "cover.svg",
"directory": "Gloom",
"recommended": "1"
},
{
"name": "Fly",
"image": "cover.svg",
"directory": "fly",
"recommended": "1"
},
{
"name": "Copter",
"image": "cover.svg",
"directory": "copter",
"recommended": "1"
},
{
"name": "Minesweeper",
"image": "cover.svg",

View File

@ -67,6 +67,7 @@
</header>
<main id="main" class="noscroll">
<h1>selenite.</h1>
<noscript>enable javascript if you want the games to actually load</noscript>
<p id="randomquote">...</p>
<div class="samerow">
<div class="img-container">

31
index.php Normal file
View File

@ -0,0 +1,31 @@
<?php
$port = $_SERVER['PORT'] ?? 3000;
// Map the requested path to the corresponding HTML file
$routes = [
'/projects' => 'projects.html',
'/bookmarklets' => 'bookmarklets.html',
'/settings' => 'settings.html',
'/support' => 'support.html',
'/about' => 'about.html',
'/transfer' => 'transfer.html',
'/suggest' => 'suggest.html',
'/contact' => 'contact.html',
'/ad' => 'ad.html',
];
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
// Check if the requested path exists in the routes array
if (array_key_exists($path, $routes)) {
// Set the content type to HTML
header('Content-Type: text/html');
// Send the corresponding HTML file
readfile(__DIR__ . '/' . $routes[$path]);
} else {
// Handle 404 Not Found
http_response_code(404);
echo '404 Not Found';
}
?>

68
index.ts Normal file
View File

@ -0,0 +1,68 @@
import { serve } from 'https://deno.land/std/http/server.ts';
import { join } from 'https://deno.land/std/path/mod.ts';
const server = serve({ port: 3000 });
const __dirname = new URL('.', import.meta.url).pathname;
console.log(`Selenite is running on port 3000`);
for await (const req of server) {
let filePath = '';
switch (req.url) {
case '/projects':
filePath = 'projects.html';
break;
case '/bookmarklets':
filePath = 'bookmarklets.html';
break;
case '/settings':
filePath = 'settings.html';
break;
case '/support':
filePath = 'support.html';
break;
case '/about':
filePath = 'about.html';
break;
case '/transfer':
filePath = 'transfer.html';
break;
case '/suggest':
filePath = 'suggest.html';
break;
case '/contact':
filePath = 'contact.html';
break;
case '/ad':
filePath = 'ad.html';
break;
default:
filePath = 'index.html';
break;
}
try {
const file = await Deno.readFile(join(__dirname, filePath));
const body = new TextDecoder().decode(file);
const contentType = getFileContentType(filePath);
req.respond({ body, headers: new Headers({ 'Content-Type': contentType }) });
} catch (error) {
req.respond({ status: 500, body: 'Internal Server Error' });
}
}
function getFileContentType(filePath: string): string {
const extension = filePath.split('.').pop();
switch (extension) {
case 'html':
return 'text/html';
case 'css':
return 'text/css';
case 'js':
return 'application/javascript';
// Add more cases as needed
default:
return 'text/plain';
}
}

View File

@ -8,7 +8,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script src=" https://cdn.jsdelivr.net/npm/js-cookie@3.0.5/dist/js.cookie.min.js "></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.9.0/cdn/themes/dark.css" />
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.9.0/cdn/shoelace-autoloader.js"></script>
<!-- initialize my stuff -->

View File

@ -7,7 +7,13 @@
opacity: 100;
}
}
:root {
--inputbg: #3c096c;
--inputborder: #5a189a;
--uibg: #240046;
--textcolor: #fff;
--bg: #10002b;
}
* {
transition-duration: 0.5s;
outline: none;

View File

@ -1,9 +1,16 @@
:root {
--inputbg: #3c096c;
--inputborder: #5a189a;
--uibg: #240046;
--textcolor: #fff;
--bg: #10002b;
}
body {
--inputbg: #000000;
--inputborder: #000000;
--uibg: #000000;
--textcolor: #000;
--bg: #000000;
--inputbg: #3c096c;
--inputborder: #5a189a;
--uibg: #240046;
--textcolor: #fff;
--bg: #10002b;
}
body[theme=custom] {
--inputbg: #3c096c;