This commit is contained in:
gtlsgamr 2022-08-18 15:18:58 +05:30
parent 8f82a1a1bd
commit d25587afad
9 changed files with 259 additions and 109 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*bak

15
header.php Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/static/css/writ.css">
<body>
<header>
<h1><a href="/">~Tildevarsh</a></h1>
<nav>
<ul>
<li><a href="funds.html">funding info</a></li>
<li><a href="register.php">register</a></li>
</ul>
</nav>
</header>

View File

@ -4,17 +4,21 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/static/css/writ.css">
<title>~varsh<?php - $pagetitle ?></title>
<?php if(isset($pagetitle)): ?>
<title>~varsh<?php echo " - $pagetitle"; ?></title>
<?php else: ?>
<title>~varsh</title>
<?php endif; ?>
</head>
<body>
<header>
<h1><a href="/">~Tildevarsh</a></h1>
<nav>
<ul>
<li><a href="/funds">funding info</a></li>
<li><a href="/funds">funding_info</a></li>
<li><a href="/roadmap">roadmap</a></li>
<li><a href="/voting">voting</a></li>
<li><a href="/register">REGISTER</a></li>
<li><a href="/register">register</a></li>
</ul>
</nav>
</header>

127
index.php
View File

@ -1,65 +1,76 @@
<?php include("./includes/header.php")?>
<main>
<h3>Bharatvarsh, the year is 2022.&nbsp; &nbsp;<img src="/static/indiaflag.gif"/>
</h3>
<hr>
Everyone is connected via the internet, and yet something is lacking. Something that we all know isn't there and yet somehow have collectively forgotten.
<br><br>
<b><h4>Welcome, to ~tildevarsh.</h4></b>
<br>
<h6>Bharatvarsh is the land of Bharat (India, or the king who ruled the Indian subcontinent). This is where the name of this tilde comes from.</h6>
<br> An India-based shared unix system which focuses on mutual development of skills and sharing of ideas. Services are secondary in this tilde, community is prime.
<br><br>
<main>
<h3>Bharatvarsh, the year is 2022.&nbsp; &nbsp;<img src="/static/indiaflag.gif"/></h3>
Everyone is connected via the internet, and yet something is lacking. Something that we all know isn't there and yet somehow have collectively forgotten.
<br><br><hr>
<b><h4>Welcome, to ~tildevarsh.</h4></b><br><br>
An India-based shared unix system which focuses on mutual development of skills and sharing of ideas. Services are secondary in this tilde, community is prime.<br><br>
<b>Still confused?</b><br>
<br><b><a href="https://yewtu.be/watch?v=qK1mInnbfrU">(Video) What is a tilde?</a></b>
<br><b><a href="https://scribe.citizen4.eu/message/tilde-club-i-had-a-couple-drinks-and-woke-up-with-1-000-nerds-a8904f0a2ebf">(Text) The story of tilde.club</a></b>
<h5>Contact</h5>
<ul>
<li><b>#tildevarsh</b> on irc.libera.chat<br></li>
<li><b>#tildevarsh:matrix.org</b> on matrix<br></li>
</ul>
<h5>Services that we provide</h5>
<ul>
<li>A public html hosting for static website @ yourusername.tildevarsh.in (dynamic coming soon) </li>
<li>Free email at yourusername@tildevarsh.in</li>
<li>A shell to play around with!</li>
<li>IRC bouncer -- coming soon</li>
<li>XMPP server -- coming soon</li>
<li>Last but not least, a sense of belonging. (hopefully).</li>
</ul>
<div class="row">
<div class="col-6">
<h5>users</h5>
<div class="index-container">
<div class="index-item">
<h5>Services that we provide</h5>
<ul>
<li>A public html hosting for static website @ yourusername.tildevarsh.in (dynamic port for services or cgi will be opened on request) </li>
<li>Free email at yourusername@tildevarsh.in</li>
<li>A shell to play around with!</li>
<li>IRC bouncer -- coming soon</li>
<li>XMPP server -- coming soon</li>
<li>Last but not least, a sense of belonging. (hopefully).</li>
</ul>
<ul>
<?php
$usercount = 0;
foreach (glob("/home/*/public_html", GLOB_ONLYDIR) as $user):
if (
(
// make sure we have an index page
!is_file("$user/index.html")
&& !is_file("$user/index.htm")
&& !is_file("$user/index.cgi")
&& !is_file("$user/index.php")
)
) continue;
$user = basename(dirname($user));
$usercount++; ?>
<li><a href="https://<?=$user?>.tildevarsh.in" class="list-group-item col-xs-6 col-sm-4 col-md-2">~<?=$user?></a></li>
<?php endforeach; ?>
</ul>
</div>
<div class="col-6">
<h5>news</h5>
<ul>
<li>Registrations are now open for tildevarsh.</li>
<li> We now have a new <a href="/voting">voting</a> system in place. </li>
<li>Play nethack and try to beat others' highscore! run `nethack` to start.</li>
</ul>
</div>
</div>
</main>
</div>
<div class="index-item">
<h5>Contact</h5>
<ul>
<li><b>#tildevarsh</b> on irc.libera.chat<br></li>
<li><b>#tildevarsh:matrix.org</b> on matrix<br></li>
</ul>
</div>
<div class="index-item">
<h5>news</h5>
<ul>
<li>A new vote is in progress! Should we host an XMPP server for the tilde?</li>
<li>Play nethack and try to beat others' <a href="/nethack_scores">highscores!</a> run `nethack` to start.</li>
<li> We now have a new <a href="/voting">voting</a> system in place. </li>
<li>Registrations are now open for tildevarsh.</li>
</ul>
</div>
<div class="index-item users">
<h5>users</h5>
<ul>
<?php
$usercount = 0;
foreach (glob("/home/*/public_html", GLOB_ONLYDIR) as $user):
if (
(
// make sure we have an index page
!is_file("$user/index.html")
&& !is_file("$user/index.htm")
&& !is_file("$user/index.cgi")
&& !is_file("$user/index.php")
)
) continue;
$user = basename(dirname($user));
$usercount++; ?>
<li><a href="https://<?=$user?>.tildevarsh.in" class="list-group-item col-xs-6 col-sm-4 col-md-2">~<?=$user?></a></li>
<?php endforeach; ?>
</ul>
</div>
</div>
</main>
<style>
.index-container {
display: flex;
flex-flow: row wrap;
}
.index-item {
max-width: 400px;
}
</style>
<?php include("./includes/footer.php")?>

114
nethack_scores.php Normal file
View File

@ -0,0 +1,114 @@
<script>
let v = 0;
function togglescore(){
a = document.getElementsByClassName('hidden');
if(v==0){
[...a].forEach(el => el.style.display= "revert");
document.getElementById('showall').style.display = "none";
document.getElementById('showtop').style.display = "revert";
v=1;
}
else{
[...a].forEach(el => el.style.display= "none");
document.getElementById('showall').style.display = "revert";
document.getElementById('showtop').style.display = "none";
v=0;
}
}
</script>
<?php
echo "<title>Nethack Scores | tildevarsh.in</title>";
echo "<style>
*{
font-family: monospace;
font-size: 1.05em;
}
.hidden{
display:none;
}
#showtop{
display:none;
}
table {
text-align: left;
position: relative;
margin-left: auto;
margin-right: auto;
border-collapse: collapse;
background-color: #f6f6f6;
}/* Spacing */
td, th {
border: 1px solid #999;
padding: 20px;
}
th {
background: brown;
color: white;
border-radius: 0;
position: sticky;
top: 0;
padding: 10px;
}
.primary{
background-color: #000000
}
tfoot > tr {
background: black;
color: white;
}
tbody > tr:hover {
background-color: #ffc107;
}</style>";
$dungeons= array("0"=>"The Dungeons of Doom", "1"=>"Gehennom", "2"=>"The Gnomish Mines", "3"=>"The Quest", "4"=>"Sokoban", "5"=>"Fort Ludios", "6"=>"Vlad's Tower", "7"=>"Elemental Planes. The dungeon level -field denotes the plane.", "-5"=>"Astral Plane", "-4"=>"Plane of Water", "-3"=>"Plane of Fire", "-2"=>"Plane of Air", "-1"=>"Plane of Earth");
$finaldata = array();
if (($handle = fopen("/var/games/nethack/record", "r")) !== FALSE) {
echo '<center><h4>nethack highscores on <a href="https://tildevarsh.in">tildevarsh</a></h4></center>';
echo '<center><h3>NOTE: Only highest score per user is shown to avoid clutter. <button id="showall" onClick="togglescore()">Show all</button><button id="showtop" onClick="togglescore()">Show Top Only</button></h3></center>';
echo "<table title='Nethack Highscores'>";
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$killed=$data[1];
$other=explode(" ",$data[0]);
$finaldata[$other[1]] = $other;
array_push($finaldata[$other[1]],$killed);
}
$row = 1;
$tracker = array();
echo "<tr><th>No.</th><th>Score</th><th>Player</th><th>HP</th><th>Max HP</th><th>Dungeon</th></tr>";
foreach($finaldata as $x => $x_value) {
/* Now we will be able move through those in loop */
if($tracker[$x_value[15]]!=1){
$tracker[$x_value[15]]=1;
echo "<tr>";
echo "<td>".$row."</td>";
echo "<td>".$x."</td>";
echo "<td>".$x_value[11]."-".$x_value[12]."-".$x_value[13]."-".$x_value[14]." <b>".$x_value[15]."</b>, ".$x_value[16]."</td>";
$d=($x_value[5]<0)?"-":$x_value[5];
echo "<td>".$d."</td>";
echo "<td>".$x_value[6]."</td>";
echo "<td>".$dungeons[$x_value[2]].", lvl ".$x_value[3]."</td>";
$row++;
}
else{
echo "<tr class='hidden'>";
echo "<td>".$row."</td>";
echo "<td>".$x."</td>";
echo "<td>".$x_value[11]."-".$x_value[12]."-".$x_value[13]."-".$x_value[14]." <b>".$x_value[15]."</b>, ".$x_value[16]."</td>";
$d=($x_value[5]<0)?"-":$x_value[5];
echo "<td>".$d."</td>";
echo "<td>".$x_value[6]."</td>";
echo "<td>".$dungeons[$x_value[2]].", lvl ".$x_value[3]."</td>";
$row++;
}
}
echo "</table>";
fclose($handle);
}
?>

View File

@ -33,7 +33,7 @@ if($_SERVER['REQUEST_METHOD']=="POST"){
<form method="POST" action="">
<div class="container">
<div class="row">
<div class="col-6">Your name: </div>
<div class="col-6">Username: </div>
<div class="col-6"><input type="text" name="name" required/><br></div>
</div>
<br>
@ -43,7 +43,7 @@ if($_SERVER['REQUEST_METHOD']=="POST"){
</div>
<br>
<div class="row">
<div class="col-6">Your SSH key(Need one so can login to the server):</div>
<div class="col-6">Your <b>Public</b> SSH key(Need one so can login to the server):</div>
<div class="col-6"> <textarea name="ssh" rows="5" style="height:max-content; width:80%;" required></textarea></div>
</div>
<div class="row">

View File

@ -6,13 +6,16 @@ $pagetitle = 'roadmap';
Here is a brief roadmap for this tilde:
<ul>
<li>A logo.</li>
<li>An actual website, not this placeholder. --- DONE </li>
<li>A way to enforce community participation.</li>
<li>Switch to our own VPS provider and not this free oracle instance. We have funds that will last us three months, but we will start using them once we are fully fleshed out. --- DONE</li>
<li>Central communication channel. (Not telegram) --- DONE</li>
<li>Fully functional tilde with public_html sites for the users, subdomains, and an easy way to register. --- DONE</li>
<li>A git instance. (Or we could use tildegit.org)</li>
<li>An internal voting system to facilitate decision making for the tilde. ---DONE</li>
<li>A way to enforce community participation.</li>
</ul>
<hr>
<ul style="text-decoration:strike;">
<li><s>Switch to our own VPS provider and not this free oracle instance. We have funds that will last us three months, but we will start using them once we are fully fleshed out. </s>--- DONE</li>
<li><s>Central communication channel. (Not telegram) </s>--- DONE</li>
<li><s>Fully functional tilde with public_html sites for the users, subdomains, and an easy way to register.</s> --- DONE</li>
<li><s>An internal voting system to facilitate decision making for the tilde.</s> ---DONE</li>
<li><s>An actual website, not this placeholder.</s> --- DONE </li>
</ul>
</main>
<?php include("./includes/footer.php")?>

View File

@ -8,9 +8,10 @@
/* Fonts, sizes & vertical rhythm */
html {
font-family: Palatino, Georgia, Lucida Bright, Book Antiqua, serif;
font-family:monospace;
font-size: 16px;
line-height: 1.5rem;
overflow-wrap:break-word;
}
@ -38,11 +39,6 @@ p, ul, ol, dl, table, blockquote, pre, h1, h2, h3, h4, h5, h6 {
}
ul ul, ol ol, ul ol, ol ul { margin: 0; }
hr {
margin: 0;
border: none;
padding: 1.5rem 0 0;
}
/* Accounting for borders */
table {
@ -58,10 +54,22 @@ pre {
body { color: #222; }
code, pre, samp, kbd { color: #111; }
a, header nav a:visited, a code { color: #00e; }
a:visited, a:visited code { color: #60b; }
mark { color: inherit; }
a:link {
color: #91ccee;
}
a:visited {
color: #8daabb;
}
a:focus,
a:hover {
color: #b0dffb;
}
a:hover{
color:black;
}
a, a code { color: #91ccee; }
code, pre, samp, thead, tfoot { background-color: rgba(0, 0, 0, 0.05); }
mark { background-color: #fe0; }
@ -292,3 +300,9 @@ header > h1 > a:visited, a:hover, a:focus, a:active{
text-decoration:none;
}
}
.row{
padding:0.2em;
}
.col-1,.col-2,.col-3,.col-4,.col-6,.col-7,.col-8,.col-9,.col-10,.col-11,.col-12{
padding: 1.2em;
}

View File

@ -1,41 +1,29 @@
<?php
$votefile = "/home/*/.vote";
$yes = 0;
$no = 0;
foreach (glob($votefile) as $vote){
if(!is_file($vote) || gettype(fgets(fopen($vote,'r'))=='boolean')){
continue;
}
else{
$file = fopen($vote,'r');
$line = fgets($file);
if($line=='1'){
$yes+=1;
}
if($line=='0'){
$no+=1;
}
fclose($file);
}
}
$z = shell_exec('sudo /usr/local/bin/poll-votes 2>/dev/null');
$votes = explode("\n",$z);
include ('includes/header.php');
?>
<main>
<h3>Voting</h3>
<p>Welcome to tildevarsh's voting system. Currently it is a unique feature
of tildevarsh where users will be able to vote into important decisions related
to the tilde. This page will show past and ongoing motions that were / are
being voted to. Users can vote by editing a single file `.vote` in
their home directories. To vote 'yes', change the first line to just 1. To vote
no, make it a 0. This is a very rudimentary system and will be changed to allow
different options in the future.</p>
to the tilde. This page will show ongoing motions that are
being voted to. </p>
<p>
Users can vote by running <code>vote</code> in their shell.
</p>
<hr>
<h4>Ongoing motions:</h4>
<?php
foreach($votes as $votearr){
$vote = explode("|",$votearr);
if(!empty($votearr)){
echo "<p>".$vote[0].") ".$vote[1]."<br>"."\n";
echo "Votes:".$vote[3].". Yes:".$vote[2].". No:".((int)$vote[3]-(int)$vote[2])."</p>";
}
}
?>
<h4>Current Motion: <b>none<b></h4>
<h5>
Results:
<br>
Yes - <?php echo $yes ?>
<br>
No - <?php echo $no ?>
</main>