Added display and API for SSH fingerprints
This commit is contained in:
21
send.php
Normal file → Executable file
21
send.php
Normal file → Executable file
@@ -8,10 +8,15 @@ $config = json_decode(file_get_contents("config.json", true));
|
||||
|
||||
session_start();
|
||||
|
||||
$origin = "https://tty.hackers.town";
|
||||
if(file_exists("/var/www/usergen/DOMAIN_OVERRIDE")){
|
||||
$origin = str_replace("\n", "", file_get_contents("/var/www/usergen/DOMAIN_OVERRIDE"));
|
||||
}
|
||||
|
||||
$provider = new Mastodon([
|
||||
'clientId' => $config.oauth.key,
|
||||
'clientSecret' => $config.oauth.secret,
|
||||
'redirectUri' => 'https://tty.hackers.town/auth',
|
||||
'redirectUri' => $origin.'/auth',
|
||||
'instance' => 'https://hackers.town',
|
||||
'scope' => 'read:accounts',
|
||||
]);
|
||||
@@ -37,17 +42,17 @@ if (!isset($_GET['code'])) {
|
||||
$token = $provider->getAccessToken('authorization_code', [
|
||||
'code' => $_GET['code']
|
||||
]);
|
||||
|
||||
|
||||
// Optional: Now you have a token you can look up a users profile data
|
||||
try {
|
||||
|
||||
|
||||
$user = $provider->getResourceOwner($token);
|
||||
|
||||
|
||||
echo $user->getName();
|
||||
|
||||
|
||||
} catch(Exception $e) {
|
||||
|
||||
|
||||
|
||||
|
||||
exit('Oh dear...');
|
||||
}
|
||||
|
||||
@@ -55,4 +60,4 @@ if (!isset($_GET['code'])) {
|
||||
echo $token->getToken();
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
Reference in New Issue
Block a user