new feature: webring

This commit is contained in:
2026-05-25 12:39:40 +02:00
parent ea5e654c65
commit 169a1c1c4d
5 changed files with 86 additions and 0 deletions

View File

@@ -2,6 +2,16 @@
<h1>> Niusy </h1>
<article id="content">
<h2> 2026/05/25 </h2>
<p>
Uruchomiliśmy webring, każdy użytkownik jest do niego dodany domyślnie, więcej informacji na <a href="/wiki/">wiki</a>.
</p>
<h2> 2026/04/18 </h2>
<p>
Rozrastamy się :) Mamy już 28 użytkowników, na IRC rozmowy trwają. Z ostatnich zmian, zostały dodane lepsze statystki pod <a href="https://tylda.org/stats.php">Statystyki</a>. Planów i pomysłów coraz więcej.
</p>
<h2> 2025/10/09 </h2>
<p>
<ul>

BIN
stats.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

40
webring/index.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
$members = require 'members.php';
$count = count($members);
$action = $_GET['action'] ?? '';
$ref = $_SERVER['HTTP_REFERER'];
if (preg_match('/https\:\/\/tylda\.org\/\~[a-zA-Z0-9\-\_]+.*/', $ref)) {
$site = substr(explode('/', $ref)[3], 1);
} else {
$site = $_GET['site'] ?? '';
}
$index = array_search($site, array_column($members, 'name'));
if ($index === false) {
http_response_code(404);
die('Nieznana strona!');
}
switch ($action) {
case 'prev':
$target = $members[($index - 1 + $count) % $count];
break;
case 'next':
$target = $members[($index + 1) % $count];
break;
case 'random':
$r = rand(0, $count - 1);
$target = $members[$r];
break;
default:
http_response_code(400);
die('Brak akcji (prev/next/random)');
}
header('Location: ' . $target['url']);
exit;
?>

19
webring/members.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
$members = [];
foreach (scandir("/home/") as $user) {
if (in_array($user, array('.', '..'))) continue;
$webring_file = "/home/$user/public_html/.webring";
if (is_file($webring_file)) {
array_push($members, ['name' => $user, 'url' => 'https://tylda.org/~'.$user]);
}
}
return $members;
?>

View File

@@ -39,7 +39,24 @@ include '../header.php';
<p>Dodatkowo dla każdego jest również uruchomiona kapsuła gemini dostępna pod linkiem: <b>gemini://tylda.org/~username</b>. Pliki kapsuły są dla ciebie dostępne w katalogu domowym pod <i>public_gemini</i>.</p><br /><br />
<h2>Git</h2>
<p>Na ten moment publiczna rejestracja na gitea jest wyłączona, boty się rejestrowały. Natomiast każdemu, kto chce założyć swoje repo lub wspomóc nas przy tworzeniu projektu zachęcam do kontaktu na mail/IRC z <b>v0id1st</b> lub <b>smoorg</b>, założymy bez problemu.</p>
<h2>Webring</h2>
<p>Webring jest prostym mechanizmem "skakania" po stronach użytkowników tylda.org. Każde konto jest domyślnie dodane do webringa, jeśli chcesz usunąć swoje to skaskuj plik <b>.webring</b> w swoim katalogu <b>public_html</b>.</p>
<p>Żeby dodać nawigację webring na swoją stronę, można przykładowo dorzucić taki HTML:</p>
<pre>
<?php
echo htmlspecialchars('
<nav class="webring">
<a href="https://tylda.org/webring/?action=prev">← poprzedni</a>
<a href="https://tylda.org/webring/?action=random">losowy</a>
<a href="https://tylda.org/webring/?action=next">następny →</a>
</nav>
');
?>
</pre>
<p>Linki będą działały automatycznie.</p>
</article>
<?php
include '../footer.php';