Backend: - User model gains e621_username / e621_api_key / e621_base_url - GET/PUT /api/auth/e621/ for the owner's credentials; /me exposes only the username and a configured flag, never the key Frontend: - e621 client core: Basic auth, _client param (browsers cannot set a User-Agent), serialized queue throttled to 1 request/second, readable error mapping - Account screen (/account): username, API key with reveal toggle, base URL (e621 / e926 / custom), Save + Test connection - Credentials are fetched from the backend and held in memory only, cleared on logout
15 lines
511 B
Python
15 lines
511 B
Python
from django.contrib.auth.models import AbstractUser
|
|
from django.db import models
|
|
|
|
|
|
class User(AbstractUser):
|
|
"""Project user with optional e621 API credentials."""
|
|
|
|
e621_username = models.CharField(max_length=100, blank=True, default="")
|
|
e621_api_key = models.CharField(max_length=100, blank=True, default="")
|
|
e621_base_url = models.CharField(max_length=200, default="https://e621.net")
|
|
|
|
@property
|
|
def e621_configured(self):
|
|
return bool(self.e621_username and self.e621_api_key)
|