Compare commits

..

1 commit

Author SHA1 Message Date
Izalia Mae 87ed4e6fad Merge branch 'dev' into 'master'
Draft: 0.3.0

See merge request pleroma/relay!57
2024-03-04 10:39:35 +00:00
5 changed files with 22 additions and 22 deletions

View file

@ -263,12 +263,11 @@ async def handle_response_headers(request: web.Request, handler: Coroutine) -> R
resp = await handler(request) resp = await handler(request)
resp.headers['Server'] = 'ActivityRelay' resp.headers['Server'] = 'ActivityRelay'
if not request.app['dev'] and request.path.endswith(('.css', '.js')): # if not request.app['dev'] and request.path.endswith(('.css', '.js')):
# cache for 2 weeks # resp.headers['Cache-Control'] = 'public,max-age=2628000,immutable'
resp.headers['Cache-Control'] = 'public,max-age=1209600,immutable'
else: # else:
resp.headers['Cache-Control'] = 'no-store' # resp.headers['Cache-Control'] = 'no-store'
return resp return resp

View file

@ -11,7 +11,6 @@
%title << {{config.name}}: {{page}} %title << {{config.name}}: {{page}}
%meta(charset="UTF-8") %meta(charset="UTF-8")
%meta(name="viewport" content="width=device-width, initial-scale=1") %meta(name="viewport" content="width=device-width, initial-scale=1")
%link(rel="stylesheet" type="text/css" href="/theme/{{theme_name}}.css")
%link(rel="stylesheet" type="text/css" href="/style.css") %link(rel="stylesheet" type="text/css" href="/style.css")
-block head -block head

View file

@ -1,3 +1,20 @@
:root {
--text: {{theme["text"]}};
--background: {{theme["background"]}};
--primary: {{theme["primary"]}};
--primary-hover: {{theme["primary-hover"]}};
--section-background: {{theme["section-background"]}};
--table-background: {{theme["table-background"]}};
--border: {{theme["border"]}};
--message-text: {{theme["message-text"]}};
--message-background: {{theme["message-background"]}};
--message-border: {{theme["message-border"]}};
--error-text: {{theme["error-text"]}};
--error-background: {{theme["error-background"]}};
--error-border: {{theme["error-border"]}};
--spacing: 10px;
}
a { a {
color: var(--primary); color: var(--primary);
text-decoration: none; text-decoration: none;

View file

@ -44,7 +44,7 @@ class Template(Environment):
'domain': self.app.config.domain, 'domain': self.app.config.domain,
'version': __version__, 'version': __version__,
'config': config, 'config': config,
'theme_name': config['theme'] or 'Default', 'theme': THEMES.get(config['theme'], THEMES['default']),
**(context or {}) **(context or {})
} }

View file

@ -445,18 +445,3 @@ class StyleCss(View):
async def get(self, request: Request) -> Response: async def get(self, request: Request) -> Response:
data = self.template.render('style.css', self) data = self.template.render('style.css', self)
return Response.new(data, ctype = 'css') return Response.new(data, ctype = 'css')
@register_route('/theme/{theme}.css')
class ThemeCss(View):
async def get(self, request: Request, theme: str) -> Response:
try:
context = {
'theme': THEMES[theme]
}
except KeyError:
return Response.new('Invalid theme', 404)
data = self.template.render('variables.css', self, **context)
return Response.new(data, ctype = 'css')