Features: 1) Add fallback to environment variable for BASE_DOMAIN in middleware redirects; 2) Introduce new "Taskboard" link to Jazzmin settings;
Fixes: 1) Correct import of BASE_DOMAIN in DRF settings; Extra: 1) Adjust "GraphQL Docs" and "REST Docs" labels to remove translation; 2) Reorganize Jazzmin settings links for consistency.
This commit is contained in:
parent
da2403c3c5
commit
bf03534f1b
3 changed files with 6 additions and 7 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
from os import getenv
|
from os import getenv
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.contrib.auth.models import AnonymousUser
|
from django.contrib.auth.models import AnonymousUser
|
||||||
from django.core.exceptions import BadRequest, DisallowedHost, PermissionDenied, ValidationError
|
from django.core.exceptions import BadRequest, DisallowedHost, PermissionDenied, ValidationError
|
||||||
from django.http import HttpResponseForbidden
|
from django.http import HttpResponseForbidden
|
||||||
|
|
@ -21,7 +20,7 @@ class CustomCommonMiddleware(CommonMiddleware):
|
||||||
try:
|
try:
|
||||||
return super().process_request(request)
|
return super().process_request(request)
|
||||||
except DisallowedHost:
|
except DisallowedHost:
|
||||||
return redirect(f"https://api.{settings.BASE_DOMAIN}")
|
return redirect(f"https://api.{getenv("EVIBES_BASE_DOMAIN", "localhost")}")
|
||||||
|
|
||||||
|
|
||||||
class CustomLocaleMiddleware(LocaleMiddleware):
|
class CustomLocaleMiddleware(LocaleMiddleware):
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@ from os import getenv
|
||||||
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from evibes.settings import BASE_DOMAIN
|
from evibes.settings.base import DEBUG, EVIBES_VERSION, SECRET_KEY, BASE_DOMAIN
|
||||||
from evibes.settings.base import DEBUG, EVIBES_VERSION, SECRET_KEY
|
|
||||||
from evibes.settings.constance import CONSTANCE_CONFIG
|
from evibes.settings.constance import CONSTANCE_CONFIG
|
||||||
|
|
||||||
REST_FRAMEWORK: dict[str, str | int | list[str] | tuple[str, ...] | dict[str, bool]] = {
|
REST_FRAMEWORK: dict[str, str | int | list[str] | tuple[str, ...] | dict[str, bool]] = {
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,18 @@ JAZZMIN_SETTINGS = {
|
||||||
"topmenu_links": [
|
"topmenu_links": [
|
||||||
{"name": _("Home"), "url": "admin:index"},
|
{"name": _("Home"), "url": "admin:index"},
|
||||||
{"name": _("Storefront"), "url": f"https://{STOREFRONT_DOMAIN}", "new_window": True}, # type: ignore [index]
|
{"name": _("Storefront"), "url": f"https://{STOREFRONT_DOMAIN}", "new_window": True}, # type: ignore [index]
|
||||||
{"name": "GitLab", "url": "https://gitlab.com/wiseless/evibes", "new_window": True},
|
|
||||||
{
|
{
|
||||||
"name": _("GraphQL Docs"),
|
"name": "GraphQL Docs",
|
||||||
"url": f"https://api.{BASE_DOMAIN}/graphql", # type: ignore [index]
|
"url": f"https://api.{BASE_DOMAIN}/graphql", # type: ignore [index]
|
||||||
"new_window": True,
|
"new_window": True,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": _("REST Docs"),
|
"name": "REST Docs",
|
||||||
"url": f"https://api.{BASE_DOMAIN}/docs/swagger", # type: ignore [index]
|
"url": f"https://api.{BASE_DOMAIN}/docs/swagger", # type: ignore [index]
|
||||||
"new_window": True,
|
"new_window": True,
|
||||||
},
|
},
|
||||||
|
{"name": _("Taskboard"), "url": "https://gitlab.com/wiseless/evibes", "new_window": True},
|
||||||
|
{"name": "GitLab", "url": "https://gitlab.com/wiseless/evibes", "new_window": True},
|
||||||
{"name": _("Support"), "url": "https://t.me/fureunoir", "new_window": True},
|
{"name": _("Support"), "url": "https://t.me/fureunoir", "new_window": True},
|
||||||
],
|
],
|
||||||
"usermenu_links": [],
|
"usermenu_links": [],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue