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;