mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Alert transport cleanup, no_proxy support and other proxy cleanups (#14763)
* Add no_proxy and other proxy related settings Set user agent on all http client requests Unify http client usage * Style fixes * Remove useless use statements * Correct variable, good job phpstan * Add tests fix https_proxy bug add tcp:// to the config settings format * style and lint fixes * Remove guzzle from the direct dependencies * Use built in Laravel testing functionality * update baseline
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
namespace LibreNMS\Util;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class GitHub
|
||||
{
|
||||
@@ -112,7 +111,7 @@ class GitHub
|
||||
*/
|
||||
public function getRelease($tag)
|
||||
{
|
||||
$release = Http::withHeaders($this->getHeaders())->get($this->github . "/releases/tags/$tag");
|
||||
$release = Http::client()->withHeaders($this->getHeaders())->get($this->github . "/releases/tags/$tag");
|
||||
|
||||
return $release->json();
|
||||
}
|
||||
@@ -122,7 +121,7 @@ class GitHub
|
||||
*/
|
||||
public function getPullRequest()
|
||||
{
|
||||
$pull_request = Http::withHeaders($this->getHeaders())->get($this->github . "/pulls/{$this->pr}");
|
||||
$pull_request = Http::client()->withHeaders($this->getHeaders())->get($this->github . "/pulls/{$this->pr}");
|
||||
$this->pr = $pull_request->json();
|
||||
}
|
||||
|
||||
@@ -180,7 +179,7 @@ class GitHub
|
||||
}
|
||||
GRAPHQL;
|
||||
|
||||
$prs = Http::withHeaders($this->getHeaders())->post($this->graphql, ['query' => $query]);
|
||||
$prs = Http::client()->withHeaders($this->getHeaders())->post($this->graphql, ['query' => $query]);
|
||||
$prs = $prs->json();
|
||||
if (! isset($prs['data'])) {
|
||||
var_dump($prs);
|
||||
@@ -366,7 +365,7 @@ GRAPHQL;
|
||||
$this->createChangelog(false);
|
||||
}
|
||||
|
||||
$release = Http::withHeaders($this->getHeaders())->post($this->github . '/releases', [
|
||||
$release = Http::client()->withHeaders($this->getHeaders())->post($this->github . '/releases', [
|
||||
'tag_name' => $this->tag,
|
||||
'target_commitish' => $updated_sha,
|
||||
'body' => $this->markdown,
|
||||
@@ -422,10 +421,10 @@ GRAPHQL;
|
||||
*/
|
||||
private function pushFileContents($file, $contents, $message): string
|
||||
{
|
||||
$existing = Http::withHeaders($this->getHeaders())->get($this->github . '/contents/' . $file);
|
||||
$existing = Http::client()->withHeaders($this->getHeaders())->get($this->github . '/contents/' . $file);
|
||||
$existing_sha = $existing->json()['sha'];
|
||||
|
||||
$updated = Http::withHeaders($this->getHeaders())->put($this->github . '/contents/' . $file, [
|
||||
$updated = Http::client()->withHeaders($this->getHeaders())->put($this->github . '/contents/' . $file, [
|
||||
'message' => $message,
|
||||
'content' => base64_encode($contents),
|
||||
'sha' => $existing_sha,
|
||||
|
Reference in New Issue
Block a user