BTHLABS-66: Prepping for public release: Take five

AKA "Using Apple reviewers as QA for your project". Thanks, y'all! :)
This commit is contained in:
2025-11-27 17:51:19 +01:00
parent cca49f2292
commit 55126f4af6
26 changed files with 386 additions and 97 deletions

View File

@@ -38,3 +38,5 @@ class PSettings(typing.Protocol):
UI_PAGE_HEAD_INCLUDES: list
UI_PAGE_SCRIPT_INCLUDES: list
OPERATOR_EMAIL: str | None

View File

@@ -100,3 +100,9 @@ def page_includes(request: HttpRequest) -> dict:
'script': settings.UI_PAGE_SCRIPT_INCLUDES,
},
}
def operator_email(request: HttpRequest) -> dict:
return {
'OPERATOR_EMAIL': settings.OPERATOR_EMAIL,
}

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import annotations
import uuid
import pydantic
class SavesCreateOut(pydantic.BaseModel):
id: uuid.UUID
target_uuid: uuid.UUID
url: pydantic.AnyHttpUrl
def to_rpc(self) -> dict:
return {
'id': self.id,
'target_uuid': self.target_uuid,
'url': str(self.url),
}

View File

@@ -3,19 +3,28 @@ from __future__ import annotations
from bthlabs_jsonrpc_core import register_method
from django.http import HttpRequest
from django.urls import reverse
from hotpocket_backend.apps.core.rpc import wrap_soa_errors
from hotpocket_backend.apps.ui.dto.rpc import SavesCreateOut
from hotpocket_backend.apps.ui.services.workflows import CreateSaveWorkflow
from hotpocket_soa.dto.associations import AssociationOut
@register_method(method='saves.create')
@wrap_soa_errors
def create(request: HttpRequest, url: str) -> AssociationOut:
def create(request: HttpRequest, url: str) -> SavesCreateOut:
association = CreateSaveWorkflow().run_rpc(
request=request,
account=request.user,
url=url,
)
return association
result = SavesCreateOut.model_validate({
'id': association.pk,
'target_uuid': association.target_uuid,
'url': request.build_absolute_uri(reverse(
'ui.associations.view', args=(association.pk,),
)),
})
return result

View File

@@ -36,6 +36,12 @@
{% blocktranslate %}Log in with {{ HOTPOCKET_OIDC_DISPLAY_NAME }}{% endblocktranslate %}
</a>
{% endif %}
{% if OPERATOR_EMAIL %}
<p class="my-0 mt-2 text-center">
<small>{% blocktranslate %}For support with your account, contact the <a href="mailto:{{ OPERATOR_EMAIL }}">instance operator</a>.{% endblocktranslate %}</small>
</p>
{% endif %}
</div>
</div>
{% include "ui/ui/partials/uname.html" %}

View File

@@ -72,6 +72,7 @@ TEMPLATES = [
'hotpocket_backend.apps.ui.context_processors.debug',
'hotpocket_backend.apps.ui.context_processors.version',
'hotpocket_backend.apps.ui.context_processors.appearance_settings',
'hotpocket_backend.apps.ui.context_processors.operator_email',
],
},
},
@@ -295,3 +296,5 @@ SAVES_ASSOCIATION_ADAPTER = os.environ.get(
UPLOADS_PATH = None
SITE_SHORT_TITLE = 'HotPocket'
OPERATOR_EMAIL = os.environ.get('HOTPOCKET_BACKEND_OPERATOR_EMAIL', None)