diff --git a/daemon.py b/daemon.py index 72f1aaa02..e035d2860 100644 --- a/daemon.py +++ b/daemon.py @@ -6873,19 +6873,41 @@ class PubServer(BaseHTTPRequestHandler): cookie, calling_domain) self.server.postreq_busy = False - def _progressive_web_app_manifest(self, calling_domain: str, + def _progressive_web_app_manifest(self, base_dir: str, + calling_domain: str, getreq_start_time) -> None: """gets the PWA manifest """ + pwa_theme_color = 'grey' + pwa_theme_background_color = 'black' + + css_filename = base_dir + '/epicyon.css' + if os.path.isfile(css_filename): + css_str = '' + with open(css_filename, 'r') as fp_css: + css_str = fp_css.read() + if '--pwa-theme-color:' in css_str: + pwa_theme_color = css_str.split('--pwa-theme-color:')[1] + if ';' in pwa_theme_color: + pwa_theme_color = pwa_theme_color.split(';')[0].strip() + if '--pwa-theme-background-color:' in css_str: + pwa_theme_background_color = \ + css_str.split('--pwa-theme-background-color:')[1] + if ';' in pwa_theme_background_color: + pwa_theme_background_color = \ + pwa_theme_background_color.split(';')[0].strip() app1 = "https://f-droid.org/en/packages/eu.siacs.conversations" app2 = "https://staging.f-droid.org/en/packages/im.vector.app" + app3 = \ + "https://f-droid.org/en/packages/" + \ + "com.stoutner.privacybrowser.standard" manifest = { "name": "Epicyon", "short_name": "Epicyon", "start_url": "/index.html", "display": "standalone", - "background_color": "black", - "theme_color": "grey", + "background_color": pwa_theme_background_color, + "theme_color": pwa_theme_color, "orientation": "portrait-primary", "categories": ["microblog", "fediverse", "activitypub"], "screenshots": [ @@ -6960,6 +6982,10 @@ class PubServer(BaseHTTPRequestHandler): { "platform": "fdroid", "url": app2 + }, + { + "platform": "fdroid", + "url": app3 } ] } @@ -14045,7 +14071,8 @@ class PubServer(BaseHTTPRequestHandler): if '/manifest.json' in self.path: if self._has_accept(calling_domain): if not self._request_http(): - self._progressive_web_app_manifest(calling_domain, + self._progressive_web_app_manifest(self.server.base_dir, + calling_domain, getreq_start_time) return else: diff --git a/epicyon-profile.css b/epicyon-profile.css index 44c170c47..7f87a1329 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -1,6 +1,8 @@ @charset "UTF-8"; :root { + --pwa-theme-color: apple-mobile-statusbar-color; + --pwa-theme-background-color: black-translucent; --avatar-rounding: 10%; --timeline-icon-width: 50px; --timeline-icon-width-mobile: 100px; diff --git a/theme/blue/theme.json b/theme/blue/theme.json index 39bb7effd..f48cf7ace 100644 --- a/theme/blue/theme.json +++ b/theme/blue/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "newswire-publish-icon": "True", "full-width-timeline-buttons": "False", "icons-as-buttons": "False", diff --git a/theme/debian/theme.json b/theme/debian/theme.json index 7572d0b85..3dddacb11 100644 --- a/theme/debian/theme.json +++ b/theme/debian/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "#222", "dropdown-bg-color": "white", "dropdown-bg-color-hover": "lightgrey", diff --git a/theme/hacker/theme.json b/theme/hacker/theme.json index df7c28684..c6e048b45 100644 --- a/theme/hacker/theme.json +++ b/theme/hacker/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "#9ad791", "dropdown-bg-color": "#222", "dropdown-bg-color-hover": "#444", diff --git a/theme/henge/theme.json b/theme/henge/theme.json index 87a46f825..8b55b24f5 100644 --- a/theme/henge/theme.json +++ b/theme/henge/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "white", "dropdown-bg-color": "#483335", "dropdown-bg-color-hover": "#583335", diff --git a/theme/indymediaclassic/theme.json b/theme/indymediaclassic/theme.json index 86862bddc..35cbc3e89 100644 --- a/theme/indymediaclassic/theme.json +++ b/theme/indymediaclassic/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "white", "dropdown-bg-color": "#222", "dropdown-bg-color-hover": "#444", diff --git a/theme/indymediamodern/theme.json b/theme/indymediamodern/theme.json index c79d0ebb0..19468eeff 100644 --- a/theme/indymediamodern/theme.json +++ b/theme/indymediamodern/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "black", "dropdown-bg-color": "#dedede", "dropdown-bg-color-hover": "#ccc", diff --git a/theme/lcd/theme.json b/theme/lcd/theme.json index 8bae3e256..5104a5a1a 100644 --- a/theme/lcd/theme.json +++ b/theme/lcd/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "#33390d", "dropdown-bg-color": "#9fb42b", "dropdown-bg-color-hover": "#33390d", diff --git a/theme/light/theme.json b/theme/light/theme.json index 70a19a526..cd67f7f56 100644 --- a/theme/light/theme.json +++ b/theme/light/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "#2d2c37", "dropdown-bg-color": "#d6dbf0", "dropdown-bg-color-hover": "#b6bbf0", diff --git a/theme/night/theme.json b/theme/night/theme.json index d25325005..3180453ea 100644 --- a/theme/night/theme.json +++ b/theme/night/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "#0481f5", "dropdown-bg-color": "#0d0d10", "dropdown-bg-color-hover": "#0b0b10", diff --git a/theme/pixel/theme.json b/theme/pixel/theme.json index 99f362de1..93c8664ec 100644 --- a/theme/pixel/theme.json +++ b/theme/pixel/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "black", "dropdown-bg-color": "#aba0d4", "dropdown-bg-color-hover": "#cba0d4", diff --git a/theme/purple/theme.json b/theme/purple/theme.json index 8e00d48ec..1b1037ee3 100644 --- a/theme/purple/theme.json +++ b/theme/purple/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "#f98bb0", "dropdown-bg-color": "#2f152d", "dropdown-bg-color-hover": "#3f152d", diff --git a/theme/rc3/theme.json b/theme/rc3/theme.json index afacf7d65..2c23e7597 100644 --- a/theme/rc3/theme.json +++ b/theme/rc3/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "white", "dropdown-bg-color": "#002a3a", "dropdown-bg-color-hover": "#025d84", diff --git a/theme/solidaric/theme.json b/theme/solidaric/theme.json index 8291f050e..6a94546bb 100644 --- a/theme/solidaric/theme.json +++ b/theme/solidaric/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "#2d2c37", "dropdown-bg-color": "#ddd", "dropdown-bg-color-hover": "#ccc", diff --git a/theme/starlight/theme.json b/theme/starlight/theme.json index eb01692f2..22959c723 100644 --- a/theme/starlight/theme.json +++ b/theme/starlight/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "#ffc4bc", "dropdown-bg-color": "#1f0d10", "dropdown-bg-color-hover": "#222", diff --git a/theme/zen/theme.json b/theme/zen/theme.json index 3241c5e32..aef8ab9ca 100644 --- a/theme/zen/theme.json +++ b/theme/zen/theme.json @@ -1,4 +1,6 @@ { + "pwa-theme-color": "apple-mobile-statusbar-color", + "pwa-theme-background-color": "black-translucent", "dropdown-fg-color": "#d5c7b7", "dropdown-bg-color": "#4c4e41", "dropdown-bg-color-hover": "#3c4e41",