projects
/
pharext
/
pharext.org
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
fix use clause
[pharext/pharext.org]
/
app
/
Github
/
API.php
diff --git
a/app/Github/API.php
b/app/Github/API.php
index 493984dbc037f76220c556e109fa6618d49335bb..96f2cdad2d2dc3076c497d3098ee50db24218935 100644
(file)
--- a/
app/Github/API.php
+++ b/
app/Github/API.php
@@
-2,7
+2,6
@@
namespace app\Github;
namespace app\Github;
-use app\Github\API;
use app\Github\Storage;
use app\Github\Exception;
use app\Pharext;
use app\Github\Storage;
use app\Github\Exception;
use app\Pharext;
@@
-101,7
+100,14
@@
class API
}
function hasToken() {
}
function hasToken() {
- return $this->tokens->get("access_token");
+ if ($this->tokens->get("access_token", $token)) {
+ $access_token = $token->getValue();
+ if (isset($access_token)) {
+ return true;
+ }
+ $this->dropToken();
+ }
+ return false;
}
function setToken($token) {
}
function setToken($token) {
@@
-133,7
+139,7
@@
class API
"state" => $state,
"client_id" => $this->config->client->id,
"scope" => $this->config->client->scope,
"state" => $state,
"client_id" => $this->config->client->id,
"scope" => $this->config->client->scope,
- "redirect_uri" => $callback_url,
+ "redirect_uri" =>
(string)
$callback_url,
];
return new Url("https://github.com/login/oauth/authorize", [
"query" => new QueryString($param)
];
return new Url("https://github.com/login/oauth/authorize", [
"query" => new QueryString($param)
@@
-143,7
+149,7
@@
class API
function fetchToken($code, $state) {
if (!$this->tokens->get("state", $orig_state, true)) {
if (isset($orig_state)) {
function fetchToken($code, $state) {
if (!$this->tokens->get("state", $orig_state, true)) {
if (isset($orig_state)) {
- $this->logger->notice("State expired",
$orig_state
);
+ $this->logger->notice("State expired",
compact("state", "orig_state")
);
throw new Exception\StateExpired($orig_state->getLTL());
}
throw new Exception\StateNotSet;
throw new Exception\StateExpired($orig_state->getLTL());
}
throw new Exception\StateNotSet;
@@
-264,7
+270,7
@@
class API
$repo->name,
$config ?: (array) $this->checkRepoHook($repo)->config
);
$repo->name,
$config ?: (array) $this->checkRepoHook($repo)->config
);
- $name =
sprintf("%s-%s.ext.phar", $repo->name, $release->tag_name
);
+ $name =
$phar->build(
);
$url = uri_template($release->upload_url, compact("name"));
$promise = $this->createReleaseAsset($url, $phar, "application/phar");
if ($release->draft) {
$url = uri_template($release->upload_url, compact("name"));
$promise = $this->createReleaseAsset($url, $phar, "application/phar");
if ($release->draft) {