mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-23 23:17:58 +00:00
Compare commits
1 commit
36d2ae733c
...
87ed4e6fad
Author | SHA1 | Date | |
---|---|---|---|
87ed4e6fad |
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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 {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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')
|
|
||||||
|
|
Loading…
Reference in a new issue