2022-12-11 05:03:14 +01:00
|
|
|
from django.conf import settings
|
|
|
|
|
|
|
|
from activities.models import Post
|
|
|
|
from core.models import Config
|
|
|
|
from takahe import __version__
|
|
|
|
from users.models import Domain, Identity
|
|
|
|
|
2022-12-11 19:22:06 +01:00
|
|
|
from .base import api_router
|
2022-12-11 05:03:14 +01:00
|
|
|
|
|
|
|
|
2022-12-11 19:22:06 +01:00
|
|
|
@api_router.get("/v1/instance")
|
2022-12-11 05:03:14 +01:00
|
|
|
def instance_info(request):
|
|
|
|
return {
|
|
|
|
"uri": request.headers.get("host", settings.SETUP.MAIN_DOMAIN),
|
|
|
|
"title": Config.system.site_name,
|
|
|
|
"short_description": "",
|
|
|
|
"description": "",
|
|
|
|
"email": "",
|
2022-12-11 19:22:06 +01:00
|
|
|
"version": f"takahe/{__version__}",
|
2022-12-11 05:03:14 +01:00
|
|
|
"urls": {},
|
|
|
|
"stats": {
|
|
|
|
"user_count": Identity.objects.filter(local=True).count(),
|
|
|
|
"status_count": Post.objects.filter(local=True).count(),
|
|
|
|
"domain_count": Domain.objects.count(),
|
|
|
|
},
|
|
|
|
"thumbnail": Config.system.site_banner,
|
|
|
|
"languages": ["en"],
|
|
|
|
"registrations": (
|
|
|
|
Config.system.signup_allowed and not Config.system.signup_invite_only
|
|
|
|
),
|
|
|
|
"approval_required": False,
|
|
|
|
"invites_enabled": False,
|
|
|
|
"configuration": {
|
|
|
|
"accounts": {},
|
|
|
|
"statuses": {
|
|
|
|
"max_characters": Config.system.post_length,
|
|
|
|
"max_media_attachments": 4,
|
|
|
|
"characters_reserved_per_url": 23,
|
|
|
|
},
|
|
|
|
"media_attachments": {
|
|
|
|
"supported_mime_types": [
|
|
|
|
"image/apng",
|
|
|
|
"image/avif",
|
|
|
|
"image/gif",
|
|
|
|
"image/jpeg",
|
|
|
|
"image/png",
|
|
|
|
"image/webp",
|
|
|
|
],
|
|
|
|
"image_size_limit": (1024**2) * 10,
|
|
|
|
"image_matrix_limit": 2000 * 2000,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"contact_account": None,
|
|
|
|
"rules": [],
|
|
|
|
}
|