Example #1
0
 def server_js_config(self):
     content = "window.ui_config = {'login_mode':'standard'}"
     if EndpointResolver:
         content = EndpointResolver.Instance().get_ui_config()
     return Response(response=content,
                     status=200,
                     mimetype="text/javascript")
Example #2
0
    def serve_i18n_file(self):
        s = ''
        from pydio.utils.i18n import get_languages
        import json
        languages = get_languages()
        short_lang = []
        for l in languages:
            lang_part = l.split('_')[0]
            if lang_part:
                short_lang.append(lang_part)

        with open(str(self.real_static_folder / 'i18n.js')) as js:
            for line in js:
                s += line

        if EndpointResolver:
            additional_strings = EndpointResolver.Instance(
            ).load_additional_strings()
            if additional_strings:
                s += '\nvar PydioAdditionalStrings = ' + json.dumps(
                    additional_strings) + ';'
                s += '\nwindow.PydioLangs = merge(PydioAdditionalStrings, PydioLangs);'

        s += '\n'
        s += 'window.PydioEnvLanguages = ' + json.dumps(short_lang) + ';'
        return Response(response=s, status=200, mimetype="text/javascript")
Example #3
0
 def serve_dynamic_css(self):
     content = ''
     if EndpointResolver:
         content = EndpointResolver.Instance().load_css()
     return Response(response=content,
                     status=200,
                     mimetype="text/css")
Example #4
0
 def serve_about_content(self):
     content = ''
     if EndpointResolver:
         content = EndpointResolver.Instance().load_about_content()
     else:
         about_file = str(self.real_static_folder / 'about.html')
         with open(about_file, 'r') as handle:
             content = handle.read()
     return Response(response=content, status=200, mimetype="text/html")
Example #5
0
 def get(self, client_id):
     try:
         return EndpointResolver.Instance().get_customer_endpoints(
             client_id)
     except EndpointException as e:
         return {'message': e.message, 'code': e.error_id}, 500
Example #6
0
 def serve_dynamic_image(self):
     # This is called only if there is a resolved.
     return Response(
         response=EndpointResolver.Instance().load_image_content(),
         status=200,
         mimetype="image/png")