fixes #2355 implement API key management system

- Added API key get, creation, editing, and revocation methods.

- Updated the profile template to include API key management features.

- Updated the database schema to support the new API key system, including additional fields for key management.

- Added client-side JavaScript functionality to handle API key operations and display responses.

- Update tools/htm.ws with the new way to authenticate.

- Restriction of certain api methods when used with an api key

- Backward compatibility with older apps
This commit is contained in:
Linty
2025-06-09 20:35:57 +02:00
parent 2624be1c90
commit ae740ba3af
20 changed files with 1937 additions and 102 deletions
+39
View File
@@ -477,3 +477,42 @@ $lang['Choose how you want to see your gallery'] = 'Choose how you want to see y
$lang['Change your password'] = 'Change your password';
$lang['Options'] = 'Options';
$lang['Your changes have been applied.'] = 'Your changes have been applied.';
$lang['Create API Keys to secure your acount'] = 'Create API Keys to secure your account';
$lang['API Keys'] = 'API Keys';
$lang['Created at'] = 'Created at';
$lang['Last use'] = 'Last use';
$lang['Expires in'] = 'Expires in';
$lang['Expired on'] = 'Expired on';
$lang['Never'] = 'Never';
$lang['New API Key'] = 'New API Key';
$lang['Show expired keys'] = 'Show expired keys';
$lang['Hide expired keys'] = 'Hide expired keys';
$lang['Generate API Key'] = 'Generate API Key';
$lang['Create a new API key to secure your account.'] = 'Create a new API key to secure your account.';
$lang['API Key name'] = 'API Key name';
$lang['Duration'] = 'Duration';
$lang['Custom date'] = 'Custom date';
$lang['Generate key'] = 'Generate key';
$lang['Save your secret Key and ID'] = 'Save your secret Key and ID';
$lang['This will not be displayed again. You must copy it to continue.'] = 'This will not be displayed again. You must copy it to continue.';
$lang['Done'] = 'Done';
$lang['Public key copied.'] = 'Public key copied.';
$lang['Secret key copied. Keep it in a safe place.'] = 'Secret key copied. Keep it in a safe place.';
$lang['Impossible to copy automatically. Please copy manually.'] = 'Impossible to copy automatically. Please copy manually.';
$lang['The api key has been successfully created.'] = 'The API key has been successfully created.';
$lang['API Key not found'] = 'API Key not found';
$lang['Expired'] = 'Expired';
$lang['API Key has been successfully revoked.'] = 'API Key has been successfully revoked.';
$lang['API Key has been successfully edited.'] = 'API Key has been successfully edited.';
$lang['No expiration'] = 'No expiration';
$lang['must not be empty'] = 'must not be empty';
$lang['The secret key can no longer be displayed.'] = 'The secret key can no longer be displayed.';
$lang['Revoked'] = 'Revoked';
$lang['Revoke'] = 'Revoke';
$lang['The email %s will be used to notify you when your API key is about to expire.'] = 'The email %s will be used to notify you when your API key is about to expire.';
$lang['You have no email address, so you will not be notified when your API key is about to expire.'] = 'You have no email address, so you will not be notified when your API key is about to expire.';
$lang['you must choose a date'] = 'you must choose a date';
$lang['This API key was manually revoked on %s'] = 'This API key was manually revoked on %s';
$lang['Edit API Key'] = 'Edit API Key';
$lang['Do you really want to revoke the "%s" API key?'] = 'Do you really want to revoke the "%s" API key?';
$lang['To manage your API keys, please log in with your username/password.'] = 'To manage your API keys, please log in with your username/password.';
+39
View File
@@ -476,3 +476,42 @@ $lang['Choose how you want to see your gallery'] = 'Choisissez comment vous voul
$lang['Change your password'] = 'Changez votre mot de passe';
$lang['Options'] = 'Options';
$lang['Your changes have been applied.'] = 'Vos changements ont été pris en compte.';
$lang['Create API Keys to secure your acount'] = 'Créez des clés API pour sécuriser votre compte';
$lang['API Keys'] = 'Clés API';
$lang['Created at'] = 'Crée le';
$lang['Last use'] = 'Dernière utilisation';
$lang['Expires in'] = 'Expire dans';
$lang['Expired on'] = 'Expiré le';
$lang['Never'] = 'Jamais';
$lang['New API Key'] = 'Nouvelle clé API';
$lang['Show expired keys'] = 'Afficher les clés expirées';
$lang['Hide expired keys'] = 'Masquer les clés expirées';
$lang['Generate API Key'] = 'Générer une clé API';
$lang['Create a new API key to secure your account.'] = 'Créez une nouvelle clé API pour sécuriser votre compte.';
$lang['API Key name'] = 'Nom de la clé API';
$lang['Duration'] = 'Durée';
$lang['Custom date'] = 'Date personnalisée';
$lang['Generate key'] = 'Générer la clé';
$lang['Save your secret Key and ID'] = 'Enregistrez votre clé secrète et votre identifiant';
$lang['This will not be displayed again. You must copy it to continue.'] = 'La clé secrete ne sera plus affichée. Vous devez la copier pour continuer.';
$lang['Done'] = 'Terminé';
$lang['Public key copied.'] = 'Clé publique copiée.';
$lang['Secret key copied. Keep it in a safe place.'] = 'Clé secrète copiée. Gardez-la dans un endroit sûr.';
$lang['Impossible to copy automatically. Please copy manually.'] = 'Impossible de copier automatiquement. Veuillez copier manuellement.';
$lang['The api key has been successfully created.'] = 'La clé API a été créée avec succès.';
$lang['API Key not found'] = 'Clé API non trouvée';
$lang['Expired'] = 'Expirée';
$lang['API Key has been successfully revoked.'] = 'La clé API a été révoquée avec succès.';
$lang['API Key has been successfully edited.'] = 'La clé API a été modifiée avec succès.';
$lang['No expiration'] = 'Pas dexpiration';
$lang['must not be empty'] = 'ne doit pas être vide';
$lang['The secret key can no longer be displayed.'] = 'La clé secrète ne peut plus être affichée.';
$lang['Revoked'] = 'Révoqué';
$lang['Revoke'] = 'Révoquer';
$lang['The email <em>%s</em> will be used to notify you when your API key is about to expire.'] = 'L\'email <em>%s</em> sera utilisé pour vous notifier que votre clé API est sur le point d\'expirer.';
$lang['You have no email address, so you will not be notified when your API key is about to expire.'] = 'Vous n\'avez pas d\'adresse email, vous ne serez donc pas notifié lorsque votre clé API sera sur le point d\'expirer.';
$lang['you must choose a date'] = 'vous devez choisir une date';
$lang['This API key was manually revoked on %s'] = 'Cette clé API a été révoquée manuellement le %s';
$lang['Edit API Key'] = 'Modifier la clé API';
$lang['Do you really want to revoke the "%s" API key?'] = 'Voulez-vous vraiment révoquer la clé API "%s" ?';
$lang['To manage your API keys, please log in with your username/password.'] = 'Pour gérer vos clés API, veuillez vous connecter avec votre nom d\'utilisateur/mot de passe.';