From: Mischa POSLAWSKY Date: Wed, 22 May 2019 21:59:55 +0000 (+0200) Subject: rerequest clans from previous profile data X-Git-Tag: v0.4^0 X-Git-Url: http://git.shiar.nl/sc2-widget/commitdiff_plain/4d46f04b5ec1a9a7fbf8a5701fe7332f56080232 rerequest clans from previous profile data Transfer ids from include to override, so only a baseline needs to be given on setup and it will automatically remember and supplement found members. --- diff --git a/widget.php b/widget.php index 78f0ab2..d1b3b88 100644 --- a/widget.php +++ b/widget.php @@ -26,11 +26,14 @@ if ($last < time() - 3600) { if (is_numeric($request)) { $recipe = $request; } - elseif ($request == 'inno') { - #TODO: get ids from existing data - $recipe = "$request 2138280 6531490"; + elseif ($last) { + if ($data = json_decode(file_get_contents($target), true)) { + $profiles = array_column($data['members'], 'profileId'); + #TODO: reduce profiles by checking ladder presence + $recipe = join(' ', array_merge([$request], $profiles)); + } } - elseif (!$last) { + else { error("Unknown profile request $request", 400); }