F5 to present · Esc to exit · ← → h l j k space enter to navigate
+From 41fa7fe9ed84c4b8989f622fb532722b7f39ad72 Mon Sep 17 00:00:00 2001 From: kj_sh604 Date: Sun, 1 Mar 2026 19:07:42 -0500 Subject: refactor: src/ --- src/font.php | 44 ++++ src/fonts.php | 49 ++++ src/index.php | 693 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/upload.php | 66 +++++ src/uploads/.htaccess | 2 + 5 files changed, 854 insertions(+) create mode 100644 src/font.php create mode 100644 src/fonts.php create mode 100644 src/index.php create mode 100644 src/upload.php create mode 100644 src/uploads/.htaccess diff --git a/src/font.php b/src/font.php new file mode 100644 index 0000000..de39569 --- /dev/null +++ b/src/font.php @@ -0,0 +1,44 @@ + 'font/ttf', + 'otf' => 'font/otf', + 'woff' => 'font/woff', + 'woff2' => 'font/woff2', + default => 'application/octet-stream', +}; + +header("Content-Type: $mime"); +header('Cache-Control: public, max-age=31536000, immutable'); +header('Content-Length: ' . filesize($file)); +readfile($file); diff --git a/src/fonts.php b/src/fonts.php new file mode 100644 index 0000000..1959f51 --- /dev/null +++ b/src/fonts.php @@ -0,0 +1,49 @@ +/dev/null'); +if (!$output) { + echo json_encode([]); + exit; +} + +$lines = array_filter(explode("\n", trim($output))); +$fonts = []; +$seen = []; + +foreach ($lines as $line) { + $parts = explode('|', $line, 2); + if (count($parts) < 2) continue; + + /* take first family name (some entries are comma-separated) */ + $families = explode(',', $parts[0]); + $family = trim($families[0]); + + if (empty($family) || isset($seen[$family])) continue; + + $file = trim($parts[1]); + if (!file_exists($file)) continue; + + $seen[$family] = true; + + $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); + $format = match ($ext) { + 'ttf' => 'truetype', + 'otf' => 'opentype', + 'woff' => 'woff', + 'woff2' => 'woff2', + default => 'truetype', + }; + + $fonts[] = [ + 'family' => $family, + 'file' => base64_encode($file), + 'format' => $format, + ]; +} + +usort($fonts, fn($a, $b) => strcasecmp($a['family'], $b['family'])); +echo json_encode($fonts); diff --git a/src/index.php b/src/index.php new file mode 100644 index 0000000..062d80e --- /dev/null +++ b/src/index.php @@ -0,0 +1,693 @@ + + + + +
+ + +suckless's sent tool ported to the very sucky web world
+F5 to present · Esc to exit · ← → h l j k space enter to navigate
+