示例#1
0
文件: webserver.py 项目: EQ4/mod-ui
    def index(self):
        context = {}

        with open(DEFAULT_ICON_TEMPLATE, 'r') as fd:
            default_icon_template = tornado.escape.squeeze(fd.read().replace("'", "\\'"))

        with open(DEFAULT_SETTINGS_TEMPLATE, 'r') as fd:
            default_settings_template = tornado.escape.squeeze(fd.read().replace("'", "\\'"))

        context = {
            'default_icon_template': default_icon_template,
            'default_settings_template': default_settings_template,
            'cloud_url': CLOUD_HTTP_ADDRESS,
            'hardware_profile': b64encode(json.dumps(SESSION.get_hardware()).encode("utf-8")),
            'max_screenshot_width': MAX_SCREENSHOT_WIDTH,
            'max_screenshot_height': MAX_SCREENSHOT_HEIGHT,
            'package_server_address': PACKAGE_SERVER_ADDRESS or '',
            'default_package_server_port': DEFAULT_PACKAGE_SERVER_PORT,
            'package_repository': PACKAGE_REPOSITORY,
            'js_custom_channel': 'true' if JS_CUSTOM_CHANNEL else 'false',
            'auto_cloud_backup': 'true' if AUTO_CLOUD_BACKUP else 'false',
            'avatar_url': AVATAR_URL,
            'version': self.get_argument('v'),
            'bundlepath': json.dumps(SESSION.bundlepath),
            'title': json.dumps(SESSION.title),
            'fulltitle': SESSION.title or "Untitled",
            'using_app': json.dumps(APP),
            'using_desktop': json.dumps(DESKTOP),
        }
        return context
示例#2
0
    def index(self):
        context = {}

        with open(DEFAULT_ICON_TEMPLATE, 'r') as fd:
            default_icon_template = tornado.escape.squeeze(fd.read().replace(
                "'", "\\'"))

        with open(DEFAULT_SETTINGS_TEMPLATE, 'r') as fd:
            default_settings_template = tornado.escape.squeeze(
                fd.read().replace("'", "\\'"))

        context = {
            'default_icon_template':
            default_icon_template,
            'default_settings_template':
            default_settings_template,
            'cloud_url':
            CLOUD_HTTP_ADDRESS,
            'hardware_profile':
            b64encode(json.dumps(SESSION.get_hardware()).encode("utf-8")),
            'max_screenshot_width':
            MAX_SCREENSHOT_WIDTH,
            'max_screenshot_height':
            MAX_SCREENSHOT_HEIGHT,
            'package_server_address':
            PACKAGE_SERVER_ADDRESS or '',
            'default_package_server_port':
            DEFAULT_PACKAGE_SERVER_PORT,
            'package_repository':
            PACKAGE_REPOSITORY,
            'js_custom_channel':
            'true' if JS_CUSTOM_CHANNEL else 'false',
            'auto_cloud_backup':
            'true' if AUTO_CLOUD_BACKUP else 'false',
            'avatar_url':
            AVATAR_URL,
            'version':
            self.get_argument('v'),
            'bundlepath':
            json.dumps(SESSION.bundlepath),
            'title':
            json.dumps(SESSION.title),
            'fulltitle':
            SESSION.title or "Untitled",
            'using_app':
            json.dumps(APP),
            'using_desktop':
            json.dumps(DESKTOP),
        }
        return context
示例#3
0
文件: webserver.py 项目: EQ4/mod-ui
 def get(self):
     hardware = SESSION.get_hardware()
     self.set_header('Content-Type', 'application/json')
     self.write(json.dumps(hardware))
示例#4
0
文件: webserver.py 项目: ssj71/mod-ui
 def get(self):
     hardware = SESSION.get_hardware()
     self.write(hardware)
示例#5
0
 def get(self):
     hardware = SESSION.get_hardware()
     self.set_header('Content-Type', 'application/json')
     self.write(json.dumps(hardware))