This commit is contained in:
Diogo Peralta Cordeiro 2021-03-29 09:24:15 +01:00
parent 3974b1f596
commit 0a314f26db
2 changed files with 96 additions and 1 deletions

View File

@ -11,7 +11,7 @@
<aside>The free/libre software social networking platform.</aside>
<nav>
<ul>
<li><a href="v2/">Version 2</a></li>
<li><a href="https://gnusocial.network/">Version 2</a></li>
<li><a href="v3/">Version 3</a></li>
</ul>
</nav>

95
try/index.php Normal file
View File

@ -0,0 +1,95 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>GNU social &mdash; a free software social networking platform</title>
<style>
#nodes {
font-family: Helvetica, Arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
#nodes td, #nodes th {
border: 1px solid #ddd;
padding: 8px;
}
#nodes tr:nth-child(even){background-color: #f2f2f2;}
#nodes tr:hover {background-color: #ddd;}
#nodes th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #A22430;
color: white;
}
</style>
</head>
<body>
<header>
<h1>GNU social</h1>
<aside>The free/libre software social networking platform.</aside>
<nav>
<ul>
<li><a href="/">Home</a></li>
</ul>
</nav>
</header>
<body>
<?php
$query = urlencode('
{
nodes(platform: "gnusocial") {
openSignups
name
host
countryCode
}
}
');
$query_result = json_decode(file_get_contents("https://the-federation.info/graphql?query={$query}"), true);
$query_result = $query_result['data']['nodes'];
// Filter out instances with closed signups
$nodes = array_filter($query_result, function ($node) {
return $node['openSignups'];
});
// garbage collect
unset($query_result);
?>
<h2>Try GNU social</h2>
<p>Please note that the servers listed here are not run by us and we are not responsible for their operation or
their content. They are listed here as a service to the community.</p>
<h3>Public GNU social Servers</h3>
<table id="nodes">
<thead>
<tr>
<th>Name</th>
<th>Country</th>
</tr>
</thead>
<tbody>
<?php foreach ($nodes as $node): ?>
<tr>
<td>
<a href="https://<?php echo $node['host']; ?>"><?php echo $node['name']; ?></a>
</td>
<td>
<?php echo $node['countryCode']; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<p><br>This table's data comes from <a href="https://the-federation.info/">the federation - a statistics hub</a>, if
you want to be listed here, please go to https://the-federation.info/register/<yournode.tld>.
After some seconds, you should see your node added.</p>
</body>
</html>