@@ -39,6 +39,52 @@ def presenter_route(self, request: Request) -> RouteResponse:
3939 self .logger .debug ("Presenter request finished successfully. Send response now." )
4040 return presenter_response , access_token
4141
42+ @route ("theme" , method = "GET" , json = False )
43+ def theme_route (self , request : Request ) -> RouteResponse :
44+ with get_new_os_conn () as conn :
45+ with conn .cursor () as curs :
46+ curs .execute (
47+ "SELECT theme_id FROM organization_t WHERE id = 1"
48+ )
49+ row = curs .fetchone ()
50+ if not row or not row ["theme_id" ]:
51+ from ..http_exceptions import NotFound
52+
53+ raise NotFound ()
54+
55+ theme_id = row ["theme_id" ]
56+
57+ color_fields = [
58+ "primary_50" , "primary_100" , "primary_200" , "primary_300" ,
59+ "primary_400" , "primary_500" , "primary_600" , "primary_700" ,
60+ "primary_800" , "primary_900" ,
61+ "primary_a100" , "primary_a200" , "primary_a400" , "primary_a700" ,
62+ "accent_50" , "accent_100" , "accent_200" , "accent_300" ,
63+ "accent_400" , "accent_500" , "accent_600" , "accent_700" ,
64+ "accent_800" , "accent_900" ,
65+ "accent_a100" , "accent_a200" , "accent_a400" , "accent_a700" ,
66+ "warn_50" , "warn_100" , "warn_200" , "warn_300" ,
67+ "warn_400" , "warn_500" , "warn_600" , "warn_700" ,
68+ "warn_800" , "warn_900" ,
69+ "warn_a100" , "warn_a200" , "warn_a400" , "warn_a700" ,
70+ "headbar" , "yes" , "no" , "abstain" ,
71+ ]
72+ columns = ", " .join (color_fields )
73+ curs .execute (
74+ f"SELECT { columns } FROM theme_t WHERE id = %s" ,
75+ (theme_id ,),
76+ )
77+ theme_row = curs .fetchone ()
78+ if not theme_row :
79+ from ..http_exceptions import NotFound
80+
81+ raise NotFound ()
82+
83+ result = {
84+ k : v for k , v in theme_row .items () if v is not None
85+ }
86+ return result , None
87+
4288 @route ("health" , method = "GET" , json = False )
4389 def health_route (self , request : Request ) -> RouteResponse :
4490 return {"status" : "running" }, None
0 commit comments