client caching

This commit is contained in:
trinkey 2024-12-20 21:24:37 -05:00
parent b5727508bb
commit c2961bc2ca
4 changed files with 14 additions and 10 deletions

View file

@ -5,6 +5,7 @@ from config import tCOMMON_TOKEN as SECRET_KEY # noqa: F401
BASE_DIR = Path(__file__).resolve().parent.parent
VERSION = (0, 0, 1)
STATIC_DIR = BASE_DIR / "tcommon/static"
ALLOWED_HOSTS = ["*"]

View file

@ -3,15 +3,15 @@ html { --rosewater: #f5e0dc; --flamingo: #f2cdcd; --pink: #f5c2e7; --mauve: #cba
html[data-light] { --rosewater: #dc8a78; --flamingo: #dd7878; --pink: #ea76cb; --mauve: #8839ef; --red: #d20f39; --maroon: #e64553; --peach: #fe640b; --yellow: #df8e1d; --green: #40a02b; --teal: #179299; --sky: #04a5e5; --sapphire: #209fb5; --blue: #1e66f5; --lavender: #7287fd; --text: #4c4f69; --subtext1: #5c5f77; --subtext0: #6c6f85; --overlay2: #7c7f93; --overlay1: #8c8fa1; --overlay0: #9ca0b0; --surface2: #acb0be; --surface1: #bcc0cc; --surface0: #ccd0da; --base: #eff1f5; --mantle: #e6e9ef; --crust: #dce0e8; --base-low-op: #eff1f5b0}
/* Font */
@font-face { font-family: 'DejaVu Sans'; font-style: normal; font-weight: 400; font-display: block; src: url("/static/font/DejaVuSans.ttf") format("truetype"); }
@font-face { font-family: 'DejaVu Sans'; font-style: normal; font-weight: 700; font-display: block; src: url("/static/font/DejaVuSans-Bold.ttf") format("truetype"); }
@font-face { font-family: 'DejaVu Sans'; font-style: italic; font-weight: 400; font-display: block; src: url("/static/font/DejaVuSans-Oblique.ttf") format("truetype"); }
@font-face { font-family: 'DejaVu Sans'; font-style: italic; font-weight: 700; font-display: block; src: url("/static/font/DejaVuSans-BoldOblique.ttf") format("truetype"); }
@font-face { font-family: 'DejaVu Sans'; font-style: normal; font-weight: 200; font-display: block; src: url("/static/font/DejaVuSans-ExtraLight.ttf") format("truetype"); }
@font-face { font-family: "Ubuntu Mono"; font-style: normal; font-weight: 400; font-display: block; src: url("/static/font/UbuntuMono-Regular.ttf") format("truetype"); }
@font-face { font-family: "Ubuntu Mono"; font-style: italic; font-weight: 400; font-display: block; src: url("/static/font/UbuntuMono-Italic.ttf") format("truetype"); }
@font-face { font-family: "Ubuntu Mono"; font-style: normal; font-weight: 700; font-display: block; src: url("/static/font/UbuntuMono-Bold.ttf") format("truetype"); }
@font-face { font-family: "Ubuntu Mono"; font-style: italic; font-weight: 700; font-display: block; src: url("/static/font/UbuntuMono-BoldItalic.ttf") format("truetype"); }
@font-face { font-family: 'DejaVu Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/font/DejaVuSans.ttf") format("truetype"); }
@font-face { font-family: 'DejaVu Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/font/DejaVuSans-Bold.ttf") format("truetype"); }
@font-face { font-family: 'DejaVu Sans'; font-style: italic; font-weight: 400; font-display: swap; src: url("/static/font/DejaVuSans-Oblique.ttf") format("truetype"); }
@font-face { font-family: 'DejaVu Sans'; font-style: italic; font-weight: 700; font-display: swap; src: url("/static/font/DejaVuSans-BoldOblique.ttf") format("truetype"); }
@font-face { font-family: 'DejaVu Sans'; font-style: normal; font-weight: 200; font-display: swap; src: url("/static/font/DejaVuSans-ExtraLight.ttf") format("truetype"); }
@font-face { font-family: "Ubuntu Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/font/UbuntuMono-Regular.ttf") format("truetype"); }
@font-face { font-family: "Ubuntu Mono"; font-style: italic; font-weight: 400; font-display: swap; src: url("/static/font/UbuntuMono-Italic.ttf") format("truetype"); }
@font-face { font-family: "Ubuntu Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/font/UbuntuMono-Bold.ttf") format("truetype"); }
@font-face { font-family: "Ubuntu Mono"; font-style: italic; font-weight: 700; font-display: swap; src: url("/static/font/UbuntuMono-BoldItalic.ttf") format("truetype"); }
body {
margin: 0;

View file

@ -5,6 +5,7 @@ from django.http import HttpResponse
from config import (DEBUG, ENABLED_APPLICATIONS, tCOMMON_TOKEN,
tCOMMON_URL_INTERNAL, tCOMMON_URL_PUBLIC)
from tcommon.settings import VERSION
def initialize(request: WSGIRequest) -> HttpResponse:
@ -19,6 +20,7 @@ def initialize(request: WSGIRequest) -> HttpResponse:
resp = {
"debug": DEBUG,
"version": list(VERSION),
"success": True,
"services": {
"common": {

View file

@ -1,5 +1,6 @@
from django.http import HttpResponse
from django.urls import path
from django.views.decorators.cache import cache_page
from tcommon.settings import STATIC_DIR
@ -20,7 +21,7 @@ file_associations = {
"ttf": "font/ttf"
}
urlpatterns = [path(i, get_static_serve(i, file_associations[i.split(".")[-1]])) for i in [
urlpatterns = [path(i, cache_page(60 * 60 * 24 * 30)(get_static_serve(i, file_associations[i.split(".")[-1]]))) for i in [
"css/base.css",
"js/theme.js",
"font/DejaVuSans-Bold.ttf",