gnusocial.rocks/communities/index.php

96 lines
2.8 KiB
PHP

<!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>