Now Threads blocking status gets set for each instance into “Threads” column in “Instances” table
This commit is contained in:
parent
142f991948
commit
3ae455a459
1 changed files with 9 additions and 3 deletions
|
@ -371,7 +371,6 @@ if ($idata['IsMastodon'] && $idata['Version']>='4.0.0') {
|
|||
eecho(2,'«'.$opts['hostname'].'»: could not fetch instance extended description from API v1: '.$buf['emsg'].'.'.N);
|
||||
}
|
||||
eecho(0,'«'.$opts['hostname'].'»: trying to fetch instance domain blocks from API v1...'.N);
|
||||
$idata['BlockListAvailable']=0;
|
||||
$buf=@gurl('https://'.$opts['hostname'].'/api/v1/instance/domain_blocks',$opts['timeout']);
|
||||
if ($buf['cont']!==false) {
|
||||
ckratelimit($buf['headers']);
|
||||
|
@ -383,7 +382,14 @@ if ($idata['IsMastodon'] && $idata['Version']>='4.0.0') {
|
|||
if (make(['domain', 'digest', 'severity', 'comment'],$block) && is_string($block['domain']) && !isempty($block['domain']) && is_string($block['digest']) && preg_match('/^[a-f0-9]{64}$/',$block['digest'])===1 && is_string($block['severity']) && in_array($block['severity'], ['silence','suspend']) && (is_null($block['comment']) || is_string($block['comment']))) {
|
||||
if (!is_null($block['comment']) && trim($block['comment'])=='') $block['comment']=null;
|
||||
$idata['blocks'][]=['dom'=>$block['domain'], 'sev'=>$block['severity'], 'comm'=>$block['comment']];
|
||||
$idata['BlockListAvailable']=1;
|
||||
if (preg_match('#^(threads.net|.*\.threads.net)$#i',$block['domain'])===1) {
|
||||
if ($block['severity']=='suspend')
|
||||
$idata['Threads']='suspended';
|
||||
elseif ($rrow['Severity']=='silence')
|
||||
$idata['Threads']='limited';
|
||||
else
|
||||
$idata['Threads']=$block['severity'];
|
||||
}
|
||||
} else {
|
||||
eecho(2,'«'.$opts['hostname'].'»: domain block '.$key.' has unexpected format.'.N);
|
||||
}
|
||||
|
@ -570,7 +576,7 @@ if (is_null($oidata)) {
|
|||
$idata['AdmURL']=$oidata['AdmURL'];
|
||||
$idata['AdmAvatar']='unavailable';
|
||||
$idata['AdmHeader']=$oidata['AdmHeader'];
|
||||
$idata['BlockListAvailable']=$oidata['BlockListAvailable'];
|
||||
$idata['Threads']=$oidata['Threads'];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue