Made the text on page more terse and hopefully clearer
This commit is contained in:
parent
8e6563b601
commit
c8a7fd5e0b
1 changed files with 19 additions and 21 deletions
40
index.php
40
index.php
|
@ -20,7 +20,7 @@ require 'lib/ckratelimit.php';
|
||||||
require 'lib/ght.php';
|
require 'lib/ght.php';
|
||||||
|
|
||||||
const SNAME='acck';
|
const SNAME='acck';
|
||||||
const SVERS='0.1.5';
|
const SVERS='0.1.6';
|
||||||
const SREPO='https://git.lattuga.net/jones/acck';
|
const SREPO='https://git.lattuga.net/jones/acck';
|
||||||
const MAXACCLEN=30+253+2;
|
const MAXACCLEN=30+253+2;
|
||||||
const MAXHOSTLEN=253;
|
const MAXHOSTLEN=253;
|
||||||
|
@ -43,11 +43,11 @@ $errors=[];
|
||||||
if (isset($_GET['acctock'])) {
|
if (isset($_GET['acctock'])) {
|
||||||
if (strlen($_GET['acctock'])>MAXACCLEN) {
|
if (strlen($_GET['acctock'])>MAXACCLEN) {
|
||||||
$_GET['acctock']='';
|
$_GET['acctock']='';
|
||||||
$errors[]='Value for “Account address” is too long';
|
$errors[]='Value for «Fediverse account address» is too long';
|
||||||
}
|
}
|
||||||
$_GET['acctock']=trim($_GET['acctock']);
|
$_GET['acctock']=trim($_GET['acctock']);
|
||||||
if ($_GET['acctock']!='' && preg_match('#^@?[0-9a-zA-Z_]+(@[a-z0-9.-]{4,253})?$#',$_GET['acctock'])!==1)// todo: make it better, like split ecc.
|
if ($_GET['acctock']!='' && preg_match('#^@?[0-9a-zA-Z_]+(@[a-z0-9.-]{4,253})?$#',$_GET['acctock'])!==1)// todo: make it better, like split ecc.
|
||||||
$errors[]='Value for “Account address” is not a valid fediverse account';
|
$errors[]='Value for «Fediverse account address» is not valid';
|
||||||
} else {
|
} else {
|
||||||
$_GET['acctock']='';
|
$_GET['acctock']='';
|
||||||
}
|
}
|
||||||
|
@ -56,11 +56,11 @@ $hostok=false;
|
||||||
if (isset($_GET['host'])) {
|
if (isset($_GET['host'])) {
|
||||||
if (strlen($_GET['host'])>MAXHOSTLEN) {
|
if (strlen($_GET['host'])>MAXHOSTLEN) {
|
||||||
$_GET['host']='';
|
$_GET['host']='';
|
||||||
$errors[]='Value for “Server domain” is too long';
|
$errors[]='Value for «Mastodon instance domain» is too long';
|
||||||
}
|
}
|
||||||
$_GET['host']=trim($_GET['host']);
|
$_GET['host']=trim($_GET['host']);
|
||||||
if ($_GET['host']!='' && !validhostname($_GET['host']))
|
if ($_GET['host']!='' && !validhostname($_GET['host']))
|
||||||
$errors[]='Value for “Server domain” is not a valid hostname';
|
$errors[]='Value for «Mastodon instance domain» is not valid';
|
||||||
else
|
else
|
||||||
$hostok=true;
|
$hostok=true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -93,7 +93,7 @@ echo "<!DOCTYPE HTML>
|
||||||
<head>
|
<head>
|
||||||
<title>{$usname}</title>
|
<title>{$usname}</title>
|
||||||
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
|
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
|
||||||
<meta name=\"description\" content=\"A tool to check if a fediverse account is moderated by a Mastodon server\">
|
<meta name=\"description\" content=\"A tool to check if a fediverse account is moderated by a Mastodon instance\">
|
||||||
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\">
|
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\">
|
||||||
<meta property=\"og:image\" content=\"imgs/ogimage.png\">
|
<meta property=\"og:image\" content=\"imgs/ogimage.png\">
|
||||||
<link rel=\"icon\" type=\"image/png\" href=\"imgs/icon-16.png\" sizes=\"16x16\">
|
<link rel=\"icon\" type=\"image/png\" href=\"imgs/icon-16.png\" sizes=\"16x16\">
|
||||||
|
@ -107,18 +107,16 @@ echo "<!DOCTYPE HTML>
|
||||||
<div id=\"main\">
|
<div id=\"main\">
|
||||||
<h1>{$usname}</h1>
|
<h1>{$usname}</h1>
|
||||||
<div class=\"normtext\">
|
<div class=\"normtext\">
|
||||||
<p class=\"firstp\">Hello, this is {$usname}, a tool to easily check if a fediverse account is moderated (<a href=\"https://docs.joinmastodon.org/admin/moderation/#limit-user\">silenced, aka “limited”</a>, and-or <a href=\"https://docs.joinmastodon.org/admin/moderation/#suspend-user\">suspended, aka “blocked”</a>) by a Mastodon server (aka “instance”).</p>
|
<p class=\"firstp\">Hello, this is {$usname}, a tool to easily check if a fediverse account is <a href=\"https://docs.joinmastodon.org/admin/moderation/#limit-user\">limited</a> (AKA «silenced») and-or <a href=\"https://docs.joinmastodon.org/admin/moderation/#suspend-user\">suspended</a> (AKA «blocked») by a Mastodon instance.</p>
|
||||||
<p>Since an account can be reported as moderated by a Mastodon server even when the server is moderating the whole account’s domain, {$usname} also tries to detect if this is the case, and tells about it.</p>
|
<p>Since an account is reported as limited and-or suspended by a Mastodon instance even when that instance has limited and-or suspended the whole account’s instance, {$usname} also tries to detect if this is the case, and tells about it.</p>
|
||||||
<p>To check if an account is moderated by the given server, {$usname} tries to use the server’s <a href=\"https://docs.joinmastodon.org/methods/accounts/#lookup\">«/api/v1/accounts/lookup» API endpoint</a>, which is public and was introduced in Mastodon v3.4.0; to check if the server is moderating the whole account’s domain, {$usname} tries to use the server’s <a href=\"https://docs.joinmastodon.org/methods/instance/#domain_blocks\">«/api/v1/instance/domain_blocks» API endpoint</a>, which is not always set to public by the server’s admins, and was introduced in Mastodon v4.0.0. If it can’t use one or both of these endpoints, it tells.</p>
|
<!-- <p>To check if an account is moderated by the given server, {$usname} tries to use the server’s <a href=\"https://docs.joinmastodon.org/methods/accounts/#lookup\">«/api/v1/accounts/lookup» API endpoint</a>, which is public and was introduced in Mastodon v3.4.0; to check if the server is moderating the whole account’s domain, {$usname} tries to use the server’s <a href=\"https://docs.joinmastodon.org/methods/instance/#domain_blocks\">«/api/v1/instance/domain_blocks» API endpoint</a>, which is not always set to public by the server’s admins, and was introduced in Mastodon v4.0.0. If it can’t use one or both of these endpoints, it tells.</p> -->
|
||||||
<p>{$usname} does not use cookies or Javascript and does not store any data about you anywhere.</p>
|
<p>{$usname} does not use cookies or Javascript and does not store any data about you anywhere.</p>
|
||||||
<p>You can find {$usname}’s code <a href=\"".SREPO."\">here</a>, and you can contact me on Mastodon <a href=\"https://puntarella.party/@j0nes\">here</a>.</p>
|
<p>You can find {$usname}’s code <a href=\"".SREPO."\">here</a>, and you can contact its developer on Mastodon <a href=\"https://puntarella.party/@j0nes\">here</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class=\"horsep\"></div>
|
|
||||||
".$errors."
|
".$errors."
|
||||||
<h2>Check</h2>
|
|
||||||
<form method=\"get\" id=\"mainform\" name=\"mainform\">
|
<form method=\"get\" id=\"mainform\" name=\"mainform\">
|
||||||
<div class=\"inputdiv\"><label for=\"acctock\">Account address</label><input type=\"text\" id=\"acctock\" name=\"acctock\" class=\"input\" placeholder=\"Example: paperino@paperopoli.net\" value=\"{$_GET['acctock']}\" maxlength=\"".MAXACCLEN."\" required></div>
|
<div class=\"inputdiv\"><label for=\"acctock\">Fediverse account address</label><input type=\"text\" id=\"acctock\" name=\"acctock\" class=\"input\" placeholder=\"Example: DonaldDuck@duckburg.social\" value=\"{$_GET['acctock']}\" maxlength=\"".MAXACCLEN."\" required></div>
|
||||||
<div class=\"inputdiv\"><label for=\"host\">Mastodon server (“instance”) domain</label><input type=\"text\" id=\"host\" name=\"host\" class=\"input\" placeholder=\"Example: topolinia.net\" value=\"{$_GET['host']}\" maxlength=\"".MAXHOSTLEN."\" required></div>
|
<div class=\"inputdiv\"><label for=\"host\">Mastodon instance domain</label><input type=\"text\" id=\"host\" name=\"host\" class=\"input\" placeholder=\"Example: mastodon.social\" value=\"{$_GET['host']}\" maxlength=\"".MAXHOSTLEN."\" required></div>
|
||||||
<div class=\"lastinputdiv\"><button type=\"submit\" id=\"button\" class=\"button\">Check</button></div>\n</form>\n";
|
<div class=\"lastinputdiv\"><button type=\"submit\" id=\"button\" class=\"button\">Check</button></div>\n</form>\n";
|
||||||
|
|
||||||
if ($errors=='' && $_GET['acctock']!='' && $_GET['host']!='') {
|
if ($errors=='' && $_GET['acctock']!='' && $_GET['host']!='') {
|
||||||
|
@ -171,7 +169,7 @@ if ($errors=='' && $_GET['acctock']!='' && $_GET['host']!='') {
|
||||||
foreach ($res as $val) {
|
foreach ($res as $val) {
|
||||||
if (isset($val['domain'],$val['severity']) && $val['domain']==$acchost) {
|
if (isset($val['domain'],$val['severity']) && $val['domain']==$acchost) {
|
||||||
if ($val['severity']=='silence')
|
if ($val['severity']=='silence')
|
||||||
$acchostck="The whole domain of the account to check, «{$acchost}», is silenced by «{$_GET['host']}».";
|
$acchostck="The whole domain of the account to check, «{$acchost}», is limited by «{$_GET['host']}».";
|
||||||
elseif ($val['severity']=='suspend')
|
elseif ($val['severity']=='suspend')
|
||||||
$acchostck="The whole domain of the account to check, «{$acchost}», is suspended by «{$_GET['host']}».";
|
$acchostck="The whole domain of the account to check, «{$acchost}», is suspended by «{$_GET['host']}».";
|
||||||
else
|
else
|
||||||
|
@ -180,9 +178,9 @@ if ($errors=='' && $_GET['acctock']!='' && $_GET['host']!='') {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($acchostck===false)
|
if ($acchostck===false)
|
||||||
$acchostck="The domain of the account to check, «{$acchost}», is not moderated (silenced or suspended) by «{$_GET['host']}».";
|
$acchostck="The domain of the account to check, «{$acchost}», is neither limited nor suspended by «{$_GET['host']}».";
|
||||||
} else {
|
} else {
|
||||||
$acchostck="{$usname} could not detect if the domain of the account to check, «{$acchost}», is moderated (silenced or suspended) by «{$_GET['host']}».";
|
$acchostck="{$usname} could not detect if the domain of the account to check, «{$acchost}», is limited or suspended by «{$_GET['host']}».";
|
||||||
}
|
}
|
||||||
$acchostck=htmlentities($acchostck);
|
$acchostck=htmlentities($acchostck);
|
||||||
$http_response_header=null;
|
$http_response_header=null;
|
||||||
|
@ -199,7 +197,7 @@ if ($errors=='' && $_GET['acctock']!='' && $_GET['host']!='') {
|
||||||
echo "<div class=\"error\">Error: «{$hurl}» returned data which could not be parsed as JSON (".json_last_error().': '.json_last_error_msg().").</div>\n";
|
echo "<div class=\"error\">Error: «{$hurl}» returned data which could not be parsed as JSON (".json_last_error().': '.json_last_error_msg().").</div>\n";
|
||||||
} elseif (isset($res['error'])) {
|
} elseif (isset($res['error'])) {
|
||||||
if ($res['error']=='Record not found')
|
if ($res['error']=='Record not found')
|
||||||
echo "<div class=\"neutral\">Server «{$hhost}» doesn’t know «{$hacctock}» account.<br><br>{$acchostck}</div>\n";
|
echo "<div class=\"neutral\">«{$hhost}» does not know «{$hacctock}» account.<br><br>{$acchostck}</div>\n";
|
||||||
else
|
else
|
||||||
echo "<div class=\"error\">Error: «{$hurl}» replied with this error message: «".htmlentities($res['error'])."».</div>\n";
|
echo "<div class=\"error\">Error: «{$hurl}» replied with this error message: «".htmlentities($res['error'])."».</div>\n";
|
||||||
} elseif (!isset($res['id'])) {
|
} elseif (!isset($res['id'])) {
|
||||||
|
@ -207,9 +205,9 @@ if ($errors=='' && $_GET['acctock']!='' && $_GET['host']!='') {
|
||||||
} else {
|
} else {
|
||||||
$out="<div class=\"neutral\">\n«{$hacctock}» ";
|
$out="<div class=\"neutral\">\n«{$hacctock}» ";
|
||||||
(isset($res['limited']) && $res['limited']) ? $out.='is' : $out.='is not';
|
(isset($res['limited']) && $res['limited']) ? $out.='is' : $out.='is not';
|
||||||
$out.=" silenced by «{$hhost}»<br>\n«{$hacctock}» ";
|
$out.=" limited by «{$hhost}».<br>\n«{$hacctock}» ";
|
||||||
(isset($res['suspended']) && $res['suspended']) ? $out.='is' : $out.='is not';
|
(isset($res['suspended']) && $res['suspended']) ? $out.='is' : $out.='is not';
|
||||||
$out.=" suspended by «{$hhost}»<br><br>\n{$acchostck}</div>\n";
|
$out.=" suspended by «{$hhost}».<br>\n<br>\n{$acchostck}</div>\n";
|
||||||
echo $out;
|
echo $out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,7 +218,7 @@ if ($errors=='' && $_GET['acctock']!='' && $_GET['host']!='') {
|
||||||
if (isset($conf['footer']))
|
if (isset($conf['footer']))
|
||||||
echo "<div id=\"almfooter\">{$conf['footer']}</div>\n";
|
echo "<div id=\"almfooter\">{$conf['footer']}</div>\n";
|
||||||
|
|
||||||
echo "<div id=\"footer\"><a href=\"".SREPO."\">".SNAME." ".SVERS."</a></div>
|
echo "<div id=\"footer\"><a href=\"".SREPO."\">{$usname} ".SVERS."</a></div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>\n";
|
</html>\n";
|
||||||
|
|
Loading…
Reference in a new issue