Пример #1
0
 def plugin_data(self):
     return {
         "contentCacheKey": ContentCacheKey.get_cache_key(),
         "languageGlobals": self.language_globals(),
         "oidcProviderEnabled": OIDCProviderHook().is_enabled,
         "kolibriTheme": ThemeHook().theme,
     }
Пример #2
0
def kolibri_theme():
    """
    A tag to include a theme configuration object to add custom theming to Kolibri.
    :return: An html string
    """
    template = """
    <script>
      var kolibriTheme = JSON.parse('{theme}');
    </script>
    """
    return mark_safe(template.format(theme=json.dumps(ThemeHook().theme)))
Пример #3
0
 def plugin_data(self):
     language_code = get_language()
     static_root = static("assets/fonts/noto-full")
     full_file = "{}.{}.{}.css?v={}"
     return {
         "fullCSSFileModern": full_file.format(
             static_root, language_code, "modern", kolibri.__version__
         ),
         "fullCSSFileBasic": full_file.format(
             static_root, language_code, "basic", kolibri.__version__
         ),
         "allowRemoteAccess": allow_other_browsers_to_connect()
         or not interface.enabled,
         "appCapabilities": interface.capabilities,
         "contentCacheKey": ContentCacheKey.get_cache_key(),
         "languageGlobals": self.language_globals(),
         "oidcProviderEnabled": OIDCProviderHook.is_enabled(),
         "kolibriTheme": ThemeHook.get_theme(),
     }
Пример #4
0
 def plugin_data(self):
     language_code = get_language()
     static_root = static("assets/fonts/noto-full")
     full_file = "{}.{}.{}.css?v={}"
     return {
         "fullCSSFileModern":
         full_file.format(static_root, language_code, "modern",
                          kolibri.__version__),
         "fullCSSFileBasic":
         full_file.format(static_root, language_code, "basic",
                          kolibri.__version__),
         "contentCacheKey":
         ContentCacheKey.get_cache_key(),
         "languageGlobals":
         self.language_globals(),
         "oidcProviderEnabled":
         OIDCProviderHook.is_enabled(),
         "kolibriTheme":
         ThemeHook.get_theme(),
     }
Пример #5
0
def calculate_spa_etag(*args, **kwargs):
    return hashlib.md5(
        kolibri_version.encode("utf-8")
        + str(ContentCacheKey.get_cache_key()).encode("utf-8")
        + str(ThemeHook.cacheKey()).encode("utf-8")
    ).hexdigest()