Commit 0f99bcbe authored by dmorley's avatar dmorley

Merge branch 'json-fixes' into 'develop'

fix for bad nodeinfo

See merge request diasporg/Poduptime!253
parents 14d342cc c6d9c079
Pipeline #4120 failed with stage
in 4 seconds
...@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic ...@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog] and this project adheres to [Semantic
### Deprecated ### Deprecated
### Removed ### Removed
### Fixed ### Fixed
- nodeinfo that does not follow the spec will lower score
### Security ### Security
## [2.6.3] ## [2.6.3]
......
...@@ -146,11 +146,15 @@ foreach ($pods as $pod) { ...@@ -146,11 +146,15 @@ foreach ($pods as $pod) {
$jsonssl = json_decode($outputssl ?: ''); $jsonssl = json_decode($outputssl ?: '');
if ($jsonssl !== null) { if ($jsonssl !== null) {
$version = $jsonssl->software->version ?? 0; $version = $jsonssl->software->version ?? '999.999.999';
if ($version == '999.999.999') {
//if nodeinfo has no version info then mark invalid
$score -= 2;
}
preg_match_all('((?:\d(.|-)?)+(\.)\d+\.*)', $version, $sversion); preg_match_all('((?:\d(.|-)?)+(\.)\d+\.*)', $version, $sversion);
$shortversion = $sversion[0][0] ?? '0.0.0.0'; $shortversion = $sversion[0][0] ?? '0.0.0.0';
$signup = ($jsonssl->openRegistrations ?? false) === true; $signup = ($jsonssl->openRegistrations ?? false) === true;
$softwarename = strtolower($jsonssl->software->name) ?? 'unknown'; $softwarename = $jsonssl->software->name ? strtolower($jsonssl->software->name) : 'unknown';
$name = $jsonssl->metadata->nodeName ?? $softwarename; $name = $jsonssl->metadata->nodeName ?? $softwarename;
//dirty hack for badnodeinfo, this complains a lot, not a good fix. //dirty hack for badnodeinfo, this complains a lot, not a good fix.
$total_users = isset($jsonssl->usage->users->total) ? $jsonssl->usage->users->total : 0; $total_users = isset($jsonssl->usage->users->total) ? $jsonssl->usage->users->total : 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment