app_terminal.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:django-gateone 作者: jimmy201602 项目源码 文件源码
def send_client_files(self):
        """
        Sends the client our standard CSS and JS.
        """
        # Render and send the client our terminal.css
        terminal_css = resource_filename(
            'applications', '/templates/terminal.css')
        #terminal_css = os.path.join(getsettings('BASE_DIR'), 'static', 'templates', 'terminal.css')
        self.render_and_send_css(terminal_css, element_id="terminal.css")
        # Send the client our JavaScript files
        js_files = resource_listdir('applications', '/static/')
        #js_files = os.listdir(os.path.join(getsettings('BASE_DIR'), 'static', 'terminal'))
        js_files.sort()
        for fname in js_files:
            if fname.endswith('.js'):
                js_file_path = resource_filename(
                    'applications', '/static/%s' % fname)
                #js_file_path = os.path.join(os.path.join(getsettings('BASE_DIR'), 'static', 'terminal'),fname)
                if fname == 'terminal.js':
                    self.ws.send_js(js_file_path, requires=["terminal.css"])
                elif fname == 'terminal_input.js':
                    self.ws.send_js(js_file_path, requires="terminal.js")
                else:
                    self.ws.send_js(js_file_path, requires='terminal_input.js')
        self.ws.send_plugin_static_files(
            'go_terminal_plugins',
            requires=["terminal_input.js"])
        # Send the client the 256-color style information and our printing CSS
        self.send_256_colors()
        self.send_print_stylesheet()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号