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,15 +1,34 @@
<?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;
App::get('/', fn() =>
route('/', fn() =>
view('home'));
App::get('/test', fn() =>
route('/test', fn() =>
view('test'));
http_response_code(404);

View File

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

View File

@ -1,7 +1,3 @@
</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>
</html>

View File

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

View File

@ -2,94 +2,21 @@
<h1>Willy's Website</h1>
<p>
<i>More than just willies! Some of the time</i>
</p>
<p><em>More than just willies! Most of the time.</em></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>
<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>
<h2>Now, where would you like to go?</h2>
<ul>
<li>
<i><?=date("d.m.Y")?></i> - <a href="/posts/0">Restoring my dignity</a> (draft)<br>
I have fallen and I can't get up
<p><a href="//git.willy.club">Gitea</a></p>
</li>
<li>
<i>08.04.2023</i> - <a href="./img/IMG_20230408_190827.jpg">ULTRA REALISTIC MINECRAFT MOD!</a><br>
holy moly
<p><a href="mumble://mumble.willy.club">Mumble</a></p>
</li>
</ul>
<h2>Contact</h2>
<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>
<p><img src="<?=url('/img/laptop.jpg')?>" alt=""></p>
<?= view('footer') ?>

File diff suppressed because one or more lines are too long