Added display and API for SSH fingerprints

This commit is contained in:
2023-09-29 02:15:06 -04:00
parent 8649c75eac
commit 89928841bc
10 changed files with 257 additions and 148 deletions

21
send.php Normal file → Executable file
View 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();
}
?>
?>