From dbb2de5f5076e1ca327e5ae1a09e9ff0d10eb4dc Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sat, 27 Aug 2022 16:22:16 +0800 Subject: [PATCH] fix: depl state ERROR, app ID not found --- platform/Vercel.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/platform/Vercel.php b/platform/Vercel.php index 9b9c66b..a8b55e8 100644 --- a/platform/Vercel.php +++ b/platform/Vercel.php @@ -176,9 +176,15 @@ function install() $header["Content-Type"] = "application/json"; $aliases = json_decode(curl("GET", "https://api.vercel.com/v3/now/aliases", "", $header)['body'], true); $host = splitfirst($_SERVER["host"], "//")[1]; + $aliases1 = []; foreach ($aliases["aliases"] as $key => $aliase) { + $aliases1[] = $aliase["alias"]; if ($host==$aliase["alias"]) $projectId = $aliase["projectId"]; } + if (!$projectId) { + $html = 'Please visit from: ' . json_encode($aliases1); + return message($html, 'Error', 400); + } $tmp['HerokuappId'] = $projectId; $response = json_decode(setVercelConfig($tmp, $projectId, $APIKey), true); @@ -258,12 +264,12 @@ language:
'; return message($html, $title, 201); } - if (substr($_SERVER["host"], -10)=="vercel.app") { + //if (substr($_SERVER["host"], -10)=="vercel.app") { $html .= '' . getconstStr('ClickInstall') . ', ' . getconstStr('LogintoBind'); $html .= "
Remember: you MUST wait 30-60s after each operate / do some change, that make sure Vercel has done the building
" ; - } else { - $html.= "Please visit form *.vercel.app"; - } + //} else { + // $html.= "Please visit form *.vercel.app"; + //} $title = 'Install'; return message($html, $title, 201); } @@ -340,7 +346,7 @@ function checkBuilding($projectId, $token) //echo json_encode($response, JSON_PRETTY_PRINT) . " ,res
"; $result = json_decode($response["body"], true); foreach ( $result['deployments'] as $deployment ) { - if ($deployment['state']!=="READY") $r++; + if ($deployment['state']!=="READY" && $deployment['state']!=="ERROR") $r++; } return $r; //if ($r===0) return true;