diff --git a/add_to_fedilist.php b/add_to_fedilist.php index a9aff48a..d9910859 100644 --- a/add_to_fedilist.php +++ b/add_to_fedilist.php @@ -1,11 +1,8 @@ $refreshSecondMargin) { + if ($secondsLeft > 0) { $minutes = floor($secondsLeft / 60); $seconds = $secondsLeft % 60; echo "ā³ Token expires in $minutes minutes and $seconds seconds.\n"; } else { - echo "šŸ”„ Access token expired or will expire in less than $refreshSecondMargin seconds. (Seconds Left: $secondsLeft). Refreshing...\n"; + echo "šŸ”„ Access token expired. Refreshing...\n"; $refreshResponse = curlPost('https://oauth2.googleapis.com/token', [ 'client_id' => $clientId, diff --git a/update_google_token.php b/update_google_token.php index 82ed8075..d6fe5412 100755 --- a/update_google_token.php +++ b/update_google_token.php @@ -1,8 +1,6 @@ #!/usr/bin/php $clientId, @@ -99,23 +110,22 @@ while (true) { if (isset($tokenResponse['access_token'])) { $tokenResponse['expires_at'] = time() + $tokenResponse['expires_in']; - $path = __DIR__ . '/_credentials/token.json'; - file_put_contents($path, json_encode($tokenResponse)); - echo "\nāœ… Token saved as $path.\n"; + file_put_contents(__DIR__ . '/_credentials/token.json', json_encode($tokenResponse)); + echo "āœ… Token saved with expiration.\n"; break; } if (isset($tokenResponse['error']) && $tokenResponse['error'] !== 'authorization_pending') { - die("\nAuth error: " . $tokenResponse['error'] . "\n"); + die("Auth error: " . $tokenResponse['error'] . "\n"); } if (time() - $startTime > $deviceData['expires_in']) { - die("\nAuthorization timed out.\n"); + die("Authorization timed out.\n"); } } // === Step 3: Create FediList Playlist === -createPlaylist($tokenResponse['access_token']); +createPlaylist($token['access_token']); ?> diff --git a/utils.php b/utils.php deleted file mode 100644 index 39efbd04..00000000 --- a/utils.php +++ /dev/null @@ -1,21 +0,0 @@ -