summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/public/img/background.webpbin0 -> 12204 bytes
-rw-r--r--src/public/img/headerLogo.pngbin672232 -> 112259 bytes
-rw-r--r--src/public/img/headerLogo.webpbin61450 -> 13540 bytes
-rw-r--r--src/scss/_mixins.scss20
-rw-r--r--src/scss/main.scss6
-rw-r--r--src/web/_views/bucket/main.php18
-rw-r--r--src/web/_views/head.php27
-rw-r--r--src/web/_views/header.php4
-rw-r--r--src/web/lib/hooks.php14
-rw-r--r--src/web/lib/html.php8
10 files changed, 77 insertions, 20 deletions
diff --git a/src/public/img/background.webp b/src/public/img/background.webp
new file mode 100644
index 0000000..ccfcb78
--- /dev/null
+++ b/src/public/img/background.webp
Binary files differ
diff --git a/src/public/img/headerLogo.png b/src/public/img/headerLogo.png
index c829aa2..b92ddaf 100644
--- a/src/public/img/headerLogo.png
+++ b/src/public/img/headerLogo.png
Binary files differ
diff --git a/src/public/img/headerLogo.webp b/src/public/img/headerLogo.webp
index 5596d1d..e92ca7e 100644
--- a/src/public/img/headerLogo.webp
+++ b/src/public/img/headerLogo.webp
Binary files differ
diff --git a/src/scss/_mixins.scss b/src/scss/_mixins.scss
index 0879b18..25eb0c1 100644
--- a/src/scss/_mixins.scss
+++ b/src/scss/_mixins.scss
@@ -65,13 +65,13 @@
@mixin font-face($name) {
@font-face {
font-family: $name;
- src: url("../font/" + $name + ".eot");
- src: url("../font/" + $name + ".eot?#iefix") format("embedded-opentype"),
- url("../font/" + $name + ".woff2") format("woff2"),
- url("../font/" + $name + ".woff") format("woff"),
- url("../font/" + $name + ".ttf") format("truetype"),
- url("../font/" + $name + ".otf") format("opentype"),
- url("../font/" + $name + ".svg#" + $name) format('svg');
+ src: url("WEB_ROOTpublic/font/" + $name + ".eot");
+ src: url("WEB_ROOTpublic/font/" + $name + ".eot?#iefix") format("embedded-opentype"),
+ url("WEB_ROOTpublic/font/" + $name + ".woff2") format("woff2"),
+ url("WEB_ROOTpublic/font/" + $name + ".woff") format("woff"),
+ url("WEB_ROOTpublic/font/" + $name + ".ttf") format("truetype"),
+ url("WEB_ROOTpublic/font/" + $name + ".otf") format("opentype"),
+ url("WEB_ROOTpublic/font/" + $name + ".svg#" + $name) format('svg');
font-weight: normal;
font-style: normal;
font-display: swap;
@@ -89,3 +89,9 @@
-dt-display: table-cell;
display: table-cell;
}
+
+@mixin background-image($fallback, $sources...) {
+ background-image: $fallback;
+ background-image: -webkit-image-set(#{$sources});
+ background-image: image-set(#{$sources});
+}
diff --git a/src/scss/main.scss b/src/scss/main.scss
index 362e6b9..925cfef 100644
--- a/src/scss/main.scss
+++ b/src/scss/main.scss
@@ -114,7 +114,11 @@ html {
}
body {
- background-image: url("../img/background.png?ref=3");
+ @include background-image(
+ url("WEB_ROOT/public/img/background.png?ref=4"),
+ url("WEB_ROOT/public/img/background.webp?ref=7") type("image/webp"),
+ url("WEB_ROOT/public/img/background.png?ref=4") type("image/png")
+ );
background-repeat: repeat;
background-size: 512px;
background-color: #181818;
diff --git a/src/web/_views/bucket/main.php b/src/web/_views/bucket/main.php
index aeb6cf3..b85c773 100644
--- a/src/web/_views/bucket/main.php
+++ b/src/web/_views/bucket/main.php
@@ -1,13 +1,13 @@
<?php /* Copyright (c) 2024 Freya Murphy */ ?>
- <?php
- $root='https://webring.bucketfish.me/redirect.html?to=%s&name=' . $name;
- $this->view('head', $data);
- if ($lightmode === 'true') {
- echo $this->link_css('css/bucket_light.css');
- } else {
- echo $this->link_css('css/bucket.css');
- }
- ?>
+<?php
+ $root='https://webring.bucketfish.me/redirect.html?to=%s&name=' . $name;
+ $this->view('head', $data);
+ if ($lightmode === 'true') {
+ echo embed_css_ext('css/bucket_light.css');
+ } else {
+ echo embed_css_ext('css/bucket.css');
+ }
+?>
<base target="_parent" />
</head>
<body>
diff --git a/src/web/_views/head.php b/src/web/_views/head.php
index 1ca6954..8cd6f87 100644
--- a/src/web/_views/head.php
+++ b/src/web/_views/head.php
@@ -1,4 +1,19 @@
<?php /* Copyright (c) 2024 Freya Murphy */ ?>
+<?php
+ /* Html cache headers */
+ $current_app = ROUTER->req['app'];
+ $non_cached_apps = ['blog'];
+
+ if (ENVIRONMENT == 'production' && !in_array($current_app, $non_cached_apps)) {
+ $cache_seconds = 300;
+ if ($current_app == 'bucket') {
+ $cache_seconds = 3600;
+ }
+ header("Cache-Control: public, max-age=$cache_seconds");
+ header("Expires: " . gmdate('D, d M Y H:i:s', time() + $cache_seconds) . " UTC");
+ header("Pragma: cache");
+ }
+?>
<!DOCTYPE html>
<html lang="<?=lang('lang_short')?>">
<head>
@@ -21,10 +36,18 @@
<link rel="icon" type="image/png" sizes="512x512" href="<?=$this->get_url("public/icons/logo512.png", TRUE)?>">
<link rel="icon" type="image/png" sizes="640x640" href="<?=$this->get_url("public/icons/logo640.png", TRUE)?>">
<link rel="manifest" href="/manifest.json">
+ <?php if ($current_app != 'bucket'): ?>
+ <link rel="preload" href="<?=$this->get_url("public/font/FontStuck-Extended.woff2")?>" as="font" type="font/woff2" crossorigin>
+ <link rel="preload" href="<?=$this->get_url("public/font/CourierNew.woff2")?>" as="font" type="font/woff2" crossorigin>
+ <link rel="preconnect" href="https://john.citrons.xyz">
+ <?php else: ?>
+ <link rel="preload" href="<?=$this->get_url("public/font/Merriweather.woff2")?>" as="font" type="font/woff2" crossorigin>
+ <?php endif ?>
<?php
/* Main CSS */
- if (ROUTER->req['app'] != 'bucket')
- echo $this->link_css('css/main.css');
+ if (ROUTER->req['app'] != 'bucket') {
+ echo embed_css_ext('css/main.css');
+ }
/* IE 4-7 Styles */
echo ie($this->embed_css('css/ie/ie.css'));
diff --git a/src/web/_views/header.php b/src/web/_views/header.php
index 5eb528a..fe8e0f1 100644
--- a/src/web/_views/header.php
+++ b/src/web/_views/header.php
@@ -7,7 +7,9 @@
<?=ie('<center>')?>
<div class="center">
<div id="header" role="banner" aria-label="banner">
- <?=image('img/headerLogo', 'alt_website_logo', 'title_website_logo', size: '200')?>
+ <a href="<?=$this->get_url('')?>">
+ <?=image('img/headerLogo', 'alt_website_logo', 'title_website_logo', size: '200')?>
+ </a>
<div class="content">
<h1 class="logo-text">
<?=lang('first_name')?>
diff --git a/src/web/lib/hooks.php b/src/web/lib/hooks.php
index 70853e1..a688069 100644
--- a/src/web/lib/hooks.php
+++ b/src/web/lib/hooks.php
@@ -1,6 +1,20 @@
<?php /* Copyright (c) 2024 Freya Murphy */
+function load_htc(string $file) {
+ $file_path = PUBLIC_ROOT . '/polyfills/' . $file;
+ if (!file_exists($file_path))
+ return;
+
+ header('Content-type: text/x-component');
+ include($file_path);
+ CRIMSON_DIE();
+}
+
function CRIMSON_pre_route_hook(Router $router): void {
+ $uri_str = ROUTER->req['uri_str'] ?? '';
+ $file = basename($uri_str);
+ if (str_ends_with($file, '.htc'))
+ load_htc($file);
}
function CRIMSON_error_hook(?array $req, int $code): never {
diff --git a/src/web/lib/html.php b/src/web/lib/html.php
new file mode 100644
index 0000000..9649bf4
--- /dev/null
+++ b/src/web/lib/html.php
@@ -0,0 +1,8 @@
+<?php /* Copyright (c) 2024 Freya Murphy */
+
+
+function embed_css_ext(string $file) {
+ $css = Base::embed_css($file);
+ $web_root = Base::get_url('');
+ return str_replace("WEB_ROOT", $web_root, $css);
+}