This commit is contained in:
William 2023-05-02 02:13:29 +02:00
parent 5973fe3af0
commit 21cc1ba95b
12 changed files with 86 additions and 271 deletions

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
/vendor
/composer.lock

View File

@ -1,11 +0,0 @@
{
"repositories": [
{
"type": "vcs",
"url": "https://git.willy.club/WillySoft/Route"
}
],
"require": {
"willysoft/route": "dev-master"
}
}

View File

@ -1,44 +0,0 @@
<?php
/**
* Helper for evaluating/including views
*/
function view(string $_view, array $_data = [])
{
$_path = __DIR__ . '/view/' . $_view . '.php';
extract($_data);
require $_path;
}
/**
* Helper for converting and outputting JSON
*/
function json_response(mixed $data, int $status_code = 200)
{
http_response_code($status_code);
header('Content-type: application/json');
echo json_encode($data);
}
/**
* Helper for reading and decoding JSON from request body
*/
function json_decode_input(): array|bool|null
{
return json_decode(file_get_contents('php://input'), true);
}
/**
* Helper for generating URLs
*/
function url(string $url, bool $full = false): string
{
$dir = dirname($_SERVER['SCRIPT_NAME']);
if ($dir === '/') {
$dir = '';
}
if (!$full) {
return $dir . $url;
}
return isset($_SERVER['HTTPS']) ? 'https' : 'http' . '://' . $_SERVER['HTTP_HOST'] . $dir . $url;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

BIN
public/img/laptop.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,16 +1,35 @@
<?php <?php
function route(string $uri, callable $callback) {
if (urldecode(strtok($_SERVER['REQUEST_URI'], '?')) !== $uri)
return;
$callback();
die();
}
require '../vendor/autoload.php'; /**
* Loads a view from the view directory
*/
function view(string $_view, array $_data = []) {
$_path = __DIR__ . '/../view/' . $_view . '.php';
extract($_data);
require $_path;
}
require '../helpers.php'; /**
* Use for prefixing URLs so that they work in nested subdirectories
*/
function url(string $url, bool $full = false): string {
$dir = dirname($_SERVER['SCRIPT_NAME']);
if ($dir === '/') $dir = '';
if (!$full) return $dir . $url;
return isset($_SERVER['HTTPS']) ? 'https' : 'http' . '://' . $_SERVER['HTTP_HOST'] . $dir . $url;
}
use WillySoft\Route as App; route('/', fn() =>
view('home'));
App::get('/', fn() => route('/test', fn() =>
view('home')); view('test'));
App::get('/test', fn() =>
view('test'));
http_response_code(404); http_response_code(404);
view('404'); view('404');

View File

@ -1,35 +1,27 @@
:root { :root {
--primary: #fffafa; --primary: #fff;
--secondary: #f6ebeb; --secondary: #eee;
--text: #111; --text: #111;
--links: #156215; --links: #00f;
--border: #e6d1d1;
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root { :root {
--primary: #000; --primary: #111;
--secondary: #222222; --secondary: #222222;
--text: #eee; --text: #eee;
--links: #aaf; --links: #aaf;
--border: #333;
} }
img { img {
filter: brightness(90%); filter: brightness(90%);
} }
} }
hr {
border: 0;
border-top: 3px dotted var(--border);
}
body { body {
background: var(--primary); background: var(--primary);
margin: 0; margin: 0;
color: var(--text); color: var(--text);
font-family: Iowan Old Style, Apple Garamond, Baskerville, Times New Roman, Droid Serif, Times, Source Serif Pro, serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol; font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif;
line-height: 1.5;
font-size: 1rem; font-size: 1rem;
padding: .75rem; padding: .75rem;
max-width: 40rem; max-width: 40rem;
@ -61,9 +53,6 @@ th {
text-align: left; text-align: left;
padding: .375rem; padding: .375rem;
} }
tr {
border-bottom: 1px solid var(--border);
}
tr:nth-child(even) { tr:nth-child(even) {
background: var(--secondary); background: var(--secondary);
} }
@ -72,7 +61,6 @@ pre,
code { code {
font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
background: var(--secondary); background: var(--secondary);
border: 1px solid var(--border);
} }
pre { pre {
padding: .75rem; padding: .75rem;
@ -84,14 +72,8 @@ pre {
blockquote { blockquote {
font-style: italic; font-style: italic;
background: var(--secondary); padding: .5rem;
padding: .375rem;
padding-left: 1.25rem; padding-left: 1.25rem;
border: 1px solid var(--border); border-left: .25rem solid var(--secondary);
border-left: .25rem solid var(--border);
margin: 0; margin: 0;
}
h2 {
border-bottom: 1px solid var(--border);
} }

View File

@ -1,7 +1,3 @@
</main> </main>
<footer>
<hr>
<p>I am indifferent to the constraints of copyright that may govern the temporal realm of this digital domain from the year of our Lord 2020 to 2023.</p>
</footer>
</body> </body>
</html> </html>

View File

@ -13,14 +13,8 @@ if (!isset($is_index)) {
</head> </head>
<body> <body>
<?php if (!$is_index): ?> <?php if (!$is_index): ?>
<nav>
<a href="<?=url('/')?>">&lt; Go back</a>
</nav>
<hr>
<main> <main>
<h1><?=$title?></h1> <h1><a href="<?=url('/')?>">Willy's Website</a> | <?=$title?></h1>
<?php endif; ?> <?php endif; ?>
<main> <main>

View File

@ -2,94 +2,21 @@
<h1>Willy's Website</h1> <h1>Willy's Website</h1>
<p> <p><em>More than just willies! Most of the time.</em></p>
<i>More than just willies! Some of the time</i>
</p>
<hr> <p>Welcome to my webserver! Your bits have passed through the pipes that make up the internet all the way to my laptop located in South Norway, Kristiansand.</p>
<blockquote>For who doesn't fancy a tasteful Willy?</blockquote> <h2>Now, where would you like to go?</h2>
<p>Greetings and salutations esteemed visitors, and allow me to extend a most cordial welcome to my digital domain. I am Willy, the proud proprietor of this magnificent website, a virtual palace of knowledge and enlightenment crafted with the utmost care and precision.</p>
<p>As an erudite individual with a prodigious intellect and a discerning eye for detail, I have spared no effort in curating a veritable treasure trove of information and wisdom for the benefit of all who grace this hallowed ground with their presence.</p>
<p>So, without further ado, I invite you to immerse yourselves in the wondrous world of Willy's website, where knowledge reigns supreme and the pursuit of truth is a never-ending quest. Let us embark on a journey of discovery together, and may the winds of wisdom and enlightenment guide us towards a brighter and more enlightened future.</p>
<h2>Service</h2>
<p>Lo and behold, within this sacred realm exists a space of great import, one that plays host to a myriad of services that I and my esteemed companions hold dear.</p>
<p>For within this hallowed ground, we have forged a bond of camaraderie and fellowship, a union of kindred spirits that transcends the mundane and the ordinary.</p>
<table>
<tr>
<th>Name</th>
<th>Info</th>
</tr>
<tr>
<td><a href="//git.willy.club">Gitea</a></td>
<td>A place to host your code</td>
</tr>
<tr>
<td><s><a href="#">Matrix Homeserver</a></s></td>
<td>Easy to use decentralized end-to-end encrypted chat<br><span style="color: red;">REGISTRATIONS FUCKED ATM</span></td>
</tr>
<tr>
<td><a href="mumble://mumble.willy.club">Mumble</a></td>
<td>Voice chat application</td>
</tr>
</table>
<h2>Blog</h2>
<p>From the most arcane and obscure topics to the most pressing and consequential issues of our time, my website offers a cornucopia of insights, analyses, and perspectives that will leave you spellbound and awestruck.</p>
<ul> <ul>
<li> <li>
<i><?=date("d.m.Y")?></i> - <a href="/posts/0">Restoring my dignity</a> (draft)<br> <p><a href="//git.willy.club">Gitea</a></p>
I have fallen and I can't get up
</li> </li>
<li> <li>
<i>08.04.2023</i> - <a href="./img/IMG_20230408_190827.jpg">ULTRA REALISTIC MINECRAFT MOD!</a><br> <p><a href="mumble://mumble.willy.club">Mumble</a></p>
holy moly
</li> </li>
</ul> </ul>
<h2>Contact</h2> <p><img src="<?=url('/img/laptop.jpg')?>" alt=""></p>
<p>Should you desire to touch base and explore the possibilities of collaboration and partnership, I humbly request that you contact using one of the options seen below. Your touch would be most welcome, and I look forward to the possibility of embarking on a journey of mutual benefit and growth.</p>
<p>Matrix: <a href="https://matrix.to/#/@william:willy.club">@william:willy.club</a></p>
<img src="./img/cat-heart-letter.gif" alt="">
<h2>Cool Stuffs</h2>
<p>
Check out this
<a href="<?=url('/test')?>">test page</a>
for formatting stuffs.
</p>
<p>
<a href="https://www.youtube.com/watch?v=5WPB2u8EzL8">How to get motivated, sigma grindset motivational story</a>
</p>
<blockquote>On the loom of language we weave our perceptions into the tapestry of comprehension.</blockquote>
<pre> Intelligence Chart
__
.' '.
You / \ Me
| _.' '._ |
_v__....---'' ''---....___________v___
</pre>
<h3>🤯🤯🤯</h3>
<p>funny</p>
<p>Amen</p>
<?= view('footer') ?> <?= view('footer') ?>

File diff suppressed because one or more lines are too long