Initial commit

This commit is contained in:
Grizzly 2022-03-20 10:26:55 +01:00
commit cccebbc780
12 changed files with 942 additions and 0 deletions

2
blog/.config Executable file
View File

@ -0,0 +1,2 @@
global_title="my tildelog"
global_description="a blog about tildes"

4
blog/index.html Executable file
View File

@ -0,0 +1,4 @@
<html>
<pre>cd</pre> to your <pre>~/public_html/blog/</pre> folder and run <pre>bb post</pre>
</html>

68
botany.bak.php Normal file
View File

@ -0,0 +1,68 @@
<?php
$json = file_get_contents("/home/grizzly/.botany/grizzly_plant_data.json");
$data = json_decode($json, true);
$art = file_get_contents("/srv/botany/botany/art/" . $data['stage'] . ".txt");
// https://github.com/jifunks/botany/blob/master/menu_screen.py#L233
function water_gauge($last) {
$water_left_pct = 1 - ((time() - $last)/86400);
# don't allow negative value
$water_left_pct = max(0, $water_left_pct);
$water_left = intval(ceil($water_left_pct * 10));
//$water_string = "(" . (")" * $water_left) . ("." * (10 - $water_left)) . ") " . strval(intval($water_left_pct * 100)) . "% ";
$water_string = strval(intval($water_left_pct * 100)) . "% ";
return $water_string;
}
?>
<div class="plant">
<div class="status <?php echo $data['is_dead'] ? "dead" : "alive" ?>"><?php echo $data['is_dead'] ? "Dead 💀" : "Alive 👍" ?></div>
<div class="stats">
plant: <?=$data['stage']?><br />
score: <?=$data['score']?><br />
age: <?=$data['age']?><br />
generation: <?=$data['generation']?><br />
water: <?=water_gauge($data['last_watered'])?>
<em class="description"><?=$data['description']?></em>
</div>
<div class="ascii">
<pre><?=$art?></pre>
</div>
</div>
<style>
.plant {
display: flex;
width: 420px;
border: 4px dotted greenyellow;
padding: 10px;
border-radius: 1rem;
background-color: beige;
position: relative;
}
.stats {
display: flex;
flex-direction: column;
align-items: center;
width: 50%;
}
.ascii {
width: 50%;
}
em.description {
margin-top: 10px;
}
.status {
position: absolute;
top: 0;
right: 0;
padding: 10px;
}
.alive {
color: green;
}
.dead {
color: red;
}
</style>

120
botany.php Normal file
View File

@ -0,0 +1,120 @@
<?php
$json = file_get_contents("/home/grizzly/.botany/grizzly_plant_data.json");
$data = json_decode($json, true);
$art = file_get_contents("/srv/botany/botany/art/" . $data['stage'] . ".txt");
// https://github.com/jifunks/botany/blob/master/menu_screen.py#L233
function water_gauge($last) {
$water_left_pct = 1 - ((time() - $last)/86400);
# don't allow negative value
$water_left_pct = max(0, $water_left_pct);
$water_left = intval(ceil($water_left_pct * 10));
//$water_string = "(" . (")" * $water_left) . ("." * (10 - $water_left)) . ") " . strval(intval($water_left_pct * 100)) . "% ";
$water_string = strval(intval($water_left_pct * 100)) . "% ";
return $water_string;
}
?>
<div class="plant">
<div class="status <?php echo $data['is_dead'] ? "dead" : "alive" ?>"><?php echo $data['is_dead'] ? "Dead 💀" : "Alive 👍" ?></div>
<div class="stats">
plant: <?=$data['stage']?><br />
score: <?=$data['score']?><br />
age: <?=$data['age']?><br />
generation: <?=$data['generation']?><br />
water: <?=water_gauge($data['last_watered'])?>
<em class="description"><?=$data['description']?></em>
</div>
<div class="ascii">
<pre><?=getArt($data['stage'], $data['species'], $data['is_dead'])?></pre>
</div>
</div>
<style>
.plant {
display: flex;
width: 450px;
border: 4px dotted greenyellow;
padding: 10px;
border-radius: 1rem;
background-color: beige;
position: relative;
}
.stats {
display: flex;
flex-direction: column;
align-items: center;
width: 35%;
}
.ascii {
width: 65%;
}
em.description {
margin-top: 10px;
}
.status {
position: absolute;
top: 0;
right: 0;
padding: 10px;
}
.alive {
color: green;
}
.dead {
color: red;
}
</style>
<?php
function getArt($stage, $species, $is_dead) {
$stage_list = [
'seed',
'seedling',
'young',
'mature',
'flowering',
'seed-bearing',
];
$stage = array_keys($stage_list, $stage)[0] + 1;
if ($is_dead) {
echo ascii_render('rip.txt');
} else if (date("m", time()) == 10 and date("d", time()) == 31) {
echo ascii_render('jackolantern.txt');
} else if ($stage == 0) {
echo ascii_render('seed.txt');
} else if ($stage == 1) {
echo ascii_render('seedling.txt');
} else if ($stage == 2) {
$this_filename = $species . '1.txt';
echo ascii_render($this_filename);
} else if ($stage == 3 or $stage == 5) {
$this_filename = $species . '2.txt';
echo ascii_render($this_filename);
} else if ($stage == 4) {
$this_filename = $species . '3.txt';
echo ascii_render($this_filename);
} else {
}
}
function ascii_render($art) {
return file_get_contents("/srv/botany/botany/art/" . $art);
}
?>

32
browser/get.php Normal file
View File

@ -0,0 +1,32 @@
<?php
require_once('/home/grizzly/store/browser/db.php');
$member = $_GET['member'];
//$member = cleanText($_GET['member']);
if (isset($_GET["random"]) || !isset($member)) {
$stmt = $db->prepare("SELECT * FROM `websites` ORDER BY RANDOM() LIMIT 1;");
$stmt->execute();
$row = $stmt->fetch();
die(header("Location: https://tilde.team/~grizzly/browser/?member=" . $row['login_name']));
} else {
$stmt = $db->prepare("SELECT * FROM `websites` WHERE login_name = :login_name;");
$stmt->execute(array(':login_name' => $member));
$row = $stmt->fetch();
$stmt = $db->prepare("SELECT login_name FROM `websites` WHERE id > :id;");
$stmt->execute(array(':id' => $row['id']));
$next = $stmt->fetch();
$stmt = $db->prepare("SELECT login_name FROM `websites` WHERE id < :id;");
$stmt->execute(array(':id' => $row['id']));
$prev = $stmt->fetch();
}
$current = $row["login_name"];
$next = $next["login_name"] ? $next["login_name"] : null;
$prev = $prev["login_name"] ? $prev["login_name"] : null;
?>

88
browser/index.php Normal file
View File

@ -0,0 +1,88 @@
<?php require_once ('get.php');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Members websites on tilde.team</title>
</head>
<body>
<div class="app">
<div class="view">
<iframe
src="https://tilde.team/~<?=$current?>"
frameborder="0"
></iframe>
</div>
<div class="control">
<div>
you are viewing
<a href="https://tilde.team/~<?=$current?>" target="_blank"
><?=$current?></a
>
site
</div>
<div>
<?php if (1==0) { ?>
<?php //if (isset($prev)) { ?>
<a href="https://tilde.team/~grizzly/browser/?member=<?=$prev?>"
>[previous]</a
>
<?php } ?>
<a href="https://tilde.team/~grizzly/browser/?random">[random]</a>
<?php if (isset($next)) { ?>
<a href="https://tilde.team/~grizzly/browser/?member=<?=$next?>"
>[next]</a
>
<?php } ?>
</div>
<div class="cache">user list cache is updated once a day</div>
</div>
</div>
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
font-family: "lucida sans unicode", "lucida grande", sans-serif;
line-height: 1.7;
font-size: 14px;
background-color: #0e0e0e;
}
.app {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.view {
display: flex;
flex-direction: column;
flex-grow: 1;
border: 5px dotted #3ee77b;
}
iframe {
flex-grow: 1;
background-color: #cecece;
}
.control {
display: flex;
flex-direction: column;
border-top: 5px dotted #3ee77b;
padding: 10px;
color: #3ee77b;
align-items: center;
}
.control a {
color: #99f2b9;
}
.cache {
font-size: 10px;
margin-top: 5px;
}
</style>
</body>
</html>

8
cgi-bin/ip.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
echo "Content-type: text/plain"
echo ""
echo $REMOTE_ADDR
exit 0

41
comments/index.php Executable file
View File

@ -0,0 +1,41 @@
<?php
//error_reporting(E_ALL);
//ini_set('display_errors', '1');
require_once ('/home/grizzly/store/comments/db.php');
function cleanText($value) {
$value = strip_tags($value);
$value = htmlentities($value, ENT_QUOTES, "UTF-8");
$value = trim($value);
$value = stripslashes($value);
$value = strval($value);
// $value = mysql_real_escape_string($value);
return $value;
}
if(isset($_POST['save'])) {
$login_name = cleanText($_POST['login_name']);
$auth = cleanText($_POST['auth_key']);
$comment = cleanText($_POST['comment']);
$time = time();
$auth_file = "/home/" . $login_name . "/.auth_key.grizzly";
$pageUrl = "https://tilde.team/~grizzly";
if (!file_exists($auth_file) || !is_file($auth_file)) { die(header("Location: " . $pageUrl . "/?error=auth_file_not_readable")); } $auth_key = file_get_contents($auth_file);
if (cleanText($auth_key) != $auth) { die(header("Location: " . $pageUrl . "/?error=not_valid_auth_key")); }
if (strlen($comment) < 1 || strlen($login_name) < 1) { die(header("Location: " . $pageUrl . "/?error=fill_all_inputs")); }
if (strlen($comment) > 240) { die(header("Location: " . $pageUrl . "/?error=max_240_characters")); }
$query = "INSERT INTO `comments` (login_name, post_time, comment) VALUES(:login_name, :post_time, :comment)";
$stmt = $db->prepare($query);
$stmt->bindParam(':login_name', $login_name);
$stmt->bindParam(':post_time', $time);
$stmt->bindParam(':comment', $comment);
$stmt->execute();
$db = null;
header("Location: " . $pageUrl . "/?success=posted");
}
?>

1
favicon.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><rect fill="#5300be" width="24" height="24"/></g><g><path fill="#fff" d="M3.74,3.74H20.26V20.26H16.72v-13h-13Z" /><path fill-rule="evenodd" fill="#fff" d="M9.64,20.26a5.9,5.9,0,1,0-5.9-5.9A5.9,5.9,0,0,0,9.64,20.26Zm0-3.54a2.36,2.36,0,1,0-2.36-2.36A2.36,2.36,0,0,0,9.64,16.72Z" /></g></svg>

After

Width:  |  Height:  |  Size: 353 B

400
index.php Normal file
View File

@ -0,0 +1,400 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="https://tilde.team/~grizzly/favicon.svg" />
<title>Grizzlys Space</title>
</head>
<body>
<div class="app">
<header>
<span> ~team </span>
<span class="quote">Security does not exist, no system is save</span>
<span><a href="https://tilde.team/">&lt;- back to tilde.team</a></span>
</header>
<main>
<div class="container">
<div class="content">
<div class="left">
<h2>Hi, I'm Grizzly!</h2>
Have a great day! :)
<div class="widgets">
<pre>
_________________
< Hello, everyone >
-----------------
\
\
___
{~._.~}
( Y )
()~*~()
(_)-(_)
</pre
>
<div class="botany">
<h3>botany: my plant</h3>
<?php require_once("botany.php"); ?>
</div>
</div>
<div class="more">
<div class="links">
<div>
<p>
contact
</p>
<div style="margin-left: 10px;">
<div style="display: flex;">
<div style="width: 50px;">
mail:
</div>
<div>
grizzly <em>at</em> ttm.sh
</div>
</div>
<div style="display: flex;">
<div style="width: 50px;">|---</div>
<div>
grizzly <em>at</em> tilde.club
</div>
</div>
<div style="display: flex;">
<div style="width: 50px;">|---</div>
<div>
grizzly <em>at</em> tilde.team
</div>
</div>
<div style="display: flex;">
<div style="width: 50px;">|---</div>
<div>
grizzly <em>at</em> envs.net
</div>
</div>
<div style="display: flex;">
<div style="width: 50px;">
xmpp:
</div>
<div>
grizzly <em>at</em> tilde.team
</div>
</div>
</div>
</div>
<div>
<p>
me
</p>
<ul>
<li>
<a href="https://grizzly.ttm.sh/twtxt.txt">twtxt</a>
</li>
<li>
<a href="https://tilde.team/~grizzly/">tilde.team/~grizzly</a>,
<small>
(<a href="https://grizzly.ttm.sh/">grizzly.ttm.sh</a>)
</small>
</li>
<li>
<a href="https://tilde.club/~grizzly/">tilde.club/~grizzly</a>
</li>
<li>
<a href="https://envs.net/~grizzly/">envs.net/~grizzly</a>
</li>
<li>
<a href="http://rw.rs/~grizzly/">rw.rs/~grizzly</a>
</li>
<li>
<a href="gemini://tilde.team/~grizzly/">gemini://tilde.team/~grizzly</a>
</li>
</ul>
</div>
<div>
<p>projects</p>
<ul>
<li>
members site roulette at:
- <a href="https://tilde.club/~grizzly/browser/" target="_blank">tilde.club</a>
- <a href="https://tilde.team/~grizzly/browser/" target="_blank">tilde.team</a>
- <a href="https://envs.net/~grizzly/browser/" target="_blank">envs.net</a>
</li>
</ul>
</div>
<div>
<p>interesting links</p>
<ul>
<li>
awesome tuis: <a href="https://github.com/rothgar/awesome-tuis" target="_blank">github.com/rothgar/awesome-tuis</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="right">
<div class="comments">
<?php
require_once('/home/grizzly/store/comments/db.php');
$query = $db->prepare("SELECT * FROM `comments` ORDER BY id DESC;");
$query->execute();
while($fetch = $query->fetch()) {
?>
<div class="comment">
<div class="meta">
<span><?=$fetch['login_name']?></span>
<span><?=date("Y/m/d H:i:s", $fetch['post_time'])?></span>
</div>
<div class="comment"><?=$fetch['comment']?></div>
</div>
<?php } ?>
</div>
<div class="form">
<?php if (@$_GET['success'] == 'posted') { echo '<span style="color: green;font-size: 10px">Posted, thanks for comment!</span>'; } ?>
<?php if (@$_GET['error'] == 'not_valid_auth_key') { echo '<span style="color: red;font-size: 10px">Not valid auth key</span>'; }?>
<?php if (@$_GET['error'] == 'fill_all_inputs') { echo '<span style="color: red;font-size: 10px">Fill all inputs</span>'; }?>
<?php if (@$_GET['error'] == 'max_240_characters') { echo '<span style="color: red;font-size: 10px">Maximum 240 characters</span>'; }?>
<?php if (@$_GET['error'] == 'auth_file_not_readable') { echo '<span style="color: red;font-size: 10px">Auth file not readable</span>'; }?>
<div style="font-size: 10px;">Leave a message :)</div>
<form action="https://tilde.team/~grizzly/comments/" method="post">
<input type="text" placeholder="your tilde login" name="login_name" />
<input type="text" placeholder="your auth key" name="auth_key" />
<textarea
name="comment"
placeholder="your comment"
maxlength="240"
></textarea>
<input type="submit" name="save" value="post" />
</form>
<div class="howto">
<details>
<summary>
How to post comment
</summary>
Only tilde.team members can post comments here, if you are a tilde.team member, please add to your home directory a file with a random string which will be your auth key.
<pre>
touch ~/.auth_key.grizzly;
echo "password"\
> ~/.auth_key.grizzly</pre>
</details>
</div>
</div>
</div>
</div>
</div>
</main>
<footer>
<!-- tilde.team ring fragment-->
<div class="newring">
[<a href="https://tilde.team/ring/?action=prev&me=grizzly">previous</a
>] [<a href="https://tilde.team/ring/?action=random&me=grizzly"
>random</a
>] [<a href="https://tilde.team/ring/?action=next&me=grizzly">next</a
>]
<br />
<a href="https://tilde.team/ring/">how to join this webring</a>
</div>
<div>copyleft 2137</div>
</footer>
</div>
<style>
.widgets {
display: flex;
flex-direction: row;
align-items: center;
}
@media (max-width: 45rem) {
.widgets,
.content {
flex-direction: column;
}
.right {
position: static !important;
width: 100vw !important;
border: 0px !important;
}
.left {
display: flex;
align-items: center;
}
}
.content {
display: flex;
flex-direction: column;
}
.left {
display: flex;
flex-direction: column;
margin: 20px;
/* align-items: center;
justify-content: center;
align-self: center;
align-content: center; */
}
.right {
display: flex;
flex-direction: column;
background-color: #e7e5eb;
border-left: 1px solid #2a0061;
position: absolute;
right: 0;
top: 0;
width: 200px;
height: 100%;
padding: 10px;
}
.comments {
overflow-y: scroll;
overflow-x: hidden;
flex-grow: 1;
}
.comment {
font-size: 10px;
border-bottom: 1px dotted #2a0061;
}
.form {
border-top: 1px solid #2a0061;
padding: 10px;
}
.form input,
.form textarea {
width: 160px;
display: block;
margin: 3px;
}
.form input {
height: 20px;
}
.form textarea {
height: 40px;
}
.howto {
font-size: 10px;
}
.howto summary {
cursor: pointer;
}
.howto pre {
margin-top: 5px;
}
.comment .meta span {
font-size: smaller;
}
.links {
margin-top: 10px;
}
.links ul {
margin-left: 20px;
}
.links p {
font-weight: 600;
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
font-family: "lucida sans unicode", "lucida grande", sans-serif;
line-height: 1.7;
font-size: 14px;
}
.app {
display: flex;
flex-direction: column;
min-height: 100vh;
background-color: #f5f5f5;
}
.container {
display: flex;
flex-direction: column;
/* align-items: center; TODO */
background-color: #f5f5f5;
/* margin: 20px; */
flex-grow: 1;
}
.more {
margin-top: 20px;
}
.mail {
margin-bottom: 10px;
}
.quote {
font-weight: 300;
text-align: center;
}
.botany {
transform: scale(0.8);
transition: all 0.2s ease-in-out;
}
.botany:hover {
transform: scale(1);
}
.botany h3 {
color: green;
}
header {
padding: 10px;
border-bottom: 3px solid #2a0061;
background-color: #5300be;
font-weight: 800;
color: #eee;
display: flex;
align-items: center;
}
header span {
width: 33%;
}
header span a {
color: #eee;
float: right;
}
main {
position: relative;
flex-grow: 1;
}
footer {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
background-color: #eeeeee;
}
footer div {
margin: 10px;
}
.newring a {
color: #777;
}
.newring a:hover {
color: #525252;
}
.newring {
text-align: center;
}
</style>
</body>
</html>

164
index_v1.php Normal file
View File

@ -0,0 +1,164 @@
<?php /* echo `whoami`; */ ?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="/favicon.svg" />
<title>Grizzlys Space</title>
</head>
<body>
<div class="app">
<header>
<span> ~team </span>
<span class="quote">Security does not exist, no system is save</span>
<span><a href="https://tilde.team/">&lt;- back to tilde.team</a></span>
</header>
<main>
<div class="container">
<h2>Hi, I'm Grizzly!</h2>
Have a great day! :)
<div class="content">
<pre>
_________________
< Hello, everyone >
-----------------
\
\
___
{~._.~}
( Y )
()~*~()
(_)-(_)
</pre
>
<div class="botany">
<h3>botany: my plant</h3>
<?php require_once("botany.php"); ?>
</div>
</div>
<div class="more">
<p class="mail">mail/xmpp: grizzly /at/ this domain</p>
<p>
<a href="https://grizzly.tilde.team/">grizzly.tilde.team</a> |
<a href="https://tilde.team/~grizzly">tilde.team/~grizzly</a>
</p>
<p>
<a href="gemini://grizzly.flounder.online/"
>gemini://grizzly.flounder.online/</a
>
</p>
</div>
</div>
</main>
<footer>
<!-- tilde.team ring fragment-->
<div class="newring">
[<a href="https://tilde.team/ring/?action=prev&me=grizzly">previous</a
>] [<a href="https://tilde.team/ring/?action=random&me=grizzly"
>random</a
>] [<a href="https://tilde.team/ring/?action=next&me=grizzly">next</a
>]
<br />
<a href="https://tilde.team/ring/">how to join this webring</a>
</div>
<div>copyleft 2137</div>
</footer>
</div>
<style>
.content {
display: flex;
flex-direction: row;
align-items: center;
}
@media (max-width: 40rem) {
.content {
flex-direction: column;
}
}
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
font-family: "lucida sans unicode", "lucida grande", sans-serif;
line-height: 1.7;
font-size: 14px;
}
.app {
display: flex;
flex-direction: column;
min-height: 100vh;
background-color: #f5f5f5;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
background-color: #f5f5f5;
margin: 10px;
}
.more {
margin-top: 20px;
}
.mail {
margin-bottom: 10px;
}
.quote {
font-weight: 300;
text-align: center;
}
.botany {
transform: scale(0.8);
transition: all 0.2s ease-in-out;
}
.botany:hover {
transform: scale(1);
}
header {
margin-bottom: 10px;
padding: 10px;
border-bottom: 3px solid #2a0061;
background-color: #5300be;
font-weight: 800;
color: #eee;
display: flex;
align-items: center;
}
header span {
width: 33%;
}
header span a {
color: #eee;
float: right;
}
main {
flex-grow: 1;
}
footer {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
background-color: #eeeeee;
}
footer div {
margin: 10px;
}
.newring a {
color: #777;
}
.newring a:hover {
color: #525252;
}
.newring {
text-align: center;
}
</style>
</body>
</html>

14
twtxt.txt Normal file
View File

@ -0,0 +1,14 @@
# _ _
# __ _ _ __(_)_______| |_ _
# / _` | '__| |_ /_ / | | | |
# | (_| | | | |/ / / /| | |_| |
# \__, |_| |_/___/___|_|\__, |
# |___/ |___/
#
# nick = grizzly
# email: grizzly@ttm.sh
#
# web: https://grizzly.ttm.sh/
# gemini: gemini://tilde.team/~grizzly
2022-03-17T17:39:04+01:00 Hey, this is my first twtxt! :)