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
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
def get(self): hardware = SESSION.get_hardware() self.set_header('Content-Type', 'application/json') self.write(json.dumps(hardware))
def get(self): hardware = SESSION.get_hardware() self.write(hardware)