1
0
Fork 0

Add hostname to the OAuth app name

pull/1191/merge
Jordi Boggiano 2012-10-18 17:08:34 +02:00
parent a9811c4e40
commit 32282e7461
1 changed files with 11 additions and 1 deletions

View File

@ -355,11 +355,21 @@ class GitHubDriver extends VcsDriver
$password = $this->io->askAndHideAnswer('Password: ');
$this->io->setAuthorization($this->originUrl, $username, $password);
// build up OAuth app name
$appName = 'Composer';
if (0 === $this->process->execute('hostname', $output)) {
$appName .= ' on ' . trim($output);
}
$contents = JsonFile::parseJson($this->remoteFilesystem->getContents($this->originUrl, 'https://api.github.com/authorizations', false, array(
'http' => array(
'method' => 'POST',
'header' => "Content-Type: application/json\r\n",
'content' => '{"scopes":["repo"],"note":"Composer","note_url":"https://getcomposer.org/"}',
'content' => json_encode(array(
'scopes' => array('repo'),
'note' => $appName,
'note_url' => 'https://getcomposer.org/',
)),
)
)));
} catch (TransportException $e) {