Skip to content

Commit

Permalink
FEAT: ADDED LOCAL THEME COOKIE
Browse files Browse the repository at this point in the history
added local theme cookie, to be compatible with cdn and local
deployment.
  • Loading branch information
nsosnsos committed Dec 3, 2023
1 parent 8111f9b commit 2f07537
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11,747 deletions.
9 changes: 5 additions & 4 deletions hallelujah/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def _get_themes(static_dir, is_local):
with open(bootswatch_cfg_file, 'r') as f:
bootswatch_cfg = json.load(f)
cdn_prefix = r'https://cdn.jsdelivr.net/npm/[email protected]/'
themes = {theme['name']: theme['cssCdn'].replace(cdn_prefix, 'plugins/bootswatch/') for theme in bootswatch_cfg['themes']}
themes = {theme['name']: theme['cssCdn'].replace(cdn_prefix, 'plugins/bootswatch/')
for theme in bootswatch_cfg['themes']}
else:
bootswatch_cfg_obj = requests.get('https://bootswatch.com/api/5.json')
themes = {theme['name']: theme['cssCdn'] for theme in json.loads(bootswatch_cfg_obj.text)['themes']}
Expand Down Expand Up @@ -68,10 +69,10 @@ class Config:
SYS_MEDIA_EXCLUDES = 'public,private'
SYS_REGISTER = False
SYS_MARIADB = True
SYS_LOCAL_DEPLOY = True
SYS_LOCAL_DEPLOY = False
SYS_THEMES = _get_themes(SYS_STATIC, SYS_LOCAL_DEPLOY)
SYS_THEME_DAY = SYS_THEMES.get('United')
SYS_THEME_NIGHT = SYS_THEMES.get('Darkly')
SYS_THEME_DAY = 'United'
SYS_THEME_NIGHT = 'Darkly'

# BLUEMAP
AUTH_URL_PREFIX = '/auth'
Expand Down
2 changes: 1 addition & 1 deletion hallelujah/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,6 @@ def theme_choose(theme_name):
if theme_name not in themes.keys():
abort(404)
response = make_response(redirect_back())
response.set_cookie('theme', themes[theme_name])
response.set_cookie('theme', theme_name)
return response

Loading

0 comments on commit 2f07537

Please sign in to comment.