mirror of
https://github.com/vastsa/FileCodeBox.git
synced 2026-11-25 16:51:08 +08:00
feat: expose background in public config for 2024 theme (#546)
This commit is contained in:
1 parent
8d3e4ad904
commit
f9cc16c805
2 files changed
+17
No files matched your search
@@ -45,6 +45,7 @@ def build_public_config() -> dict:
|
||||
"notify_content": settings.notify_content,
|
||||
"show_admin_address": normalize_public_flag(settings.show_admin_addr),
|
||||
"max_save_seconds": settings.max_save_seconds,
|
||||
"background": str(settings.background or ""),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,3 +24,19 @@ class AdminAddressPublicConfigTests(unittest.TestCase):
|
||||
self.assertIs(type(public_value), int)
|
||||
self.assertEqual(public_value, expected_value)
|
||||
self.assertIs(feature_value, bool(expected_value))
|
||||
|
||||
|
||||
class BackgroundPublicConfigTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self._original_user_config = dict(settings.user_config)
|
||||
|
||||
def tearDown(self):
|
||||
settings.user_config = self._original_user_config
|
||||
|
||||
def test_background_is_exposed_for_themes(self):
|
||||
settings.background = "https://example.com/bg.jpg"
|
||||
self.assertEqual(build_public_config()["background"], "https://example.com/bg.jpg")
|
||||
|
||||
def test_empty_background_is_string(self):
|
||||
settings.background = None
|
||||
self.assertEqual(build_public_config()["background"], "")
|
||||
Reference in new issue
Block a user