mirror of https://github.com/midoks/mdserver-web
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.3 KiB
40 lines
1.3 KiB
6 months ago
|
# coding:utf-8
|
||
|
|
||
|
# ---------------------------------------------------------------------------------
|
||
|
# MW-Linux面板
|
||
|
# ---------------------------------------------------------------------------------
|
||
|
# copyright (c) 2018-∞(https://github.com/midoks/mdserver-web) All rights reserved.
|
||
|
# ---------------------------------------------------------------------------------
|
||
|
# Author: midoks <midoks@163.com>
|
||
|
# ---------------------------------------------------------------------------------
|
||
|
|
||
|
|
||
|
from flask_socketio import SocketIO, emit, send
|
||
|
from flask import request
|
||
|
|
||
|
from admin import app,socketio
|
||
|
from .common import isLogined
|
||
|
|
||
|
def websshRun():
|
||
|
@socketio.on('webssh_websocketio')
|
||
|
def webssh_websocketio(data):
|
||
|
if not isLogined():
|
||
|
emit('server_response', {'data': '会话丢失,请重新登陆面板!\r\n'})
|
||
|
return
|
||
|
import utils.ssh.ssh_terminal as ssh_terminal
|
||
|
shell_client = ssh_terminal.ssh_terminal.instance()
|
||
|
shell_client.run(request.sid, data)
|
||
|
return
|
||
|
|
||
|
|
||
|
@socketio.on('webssh')
|
||
|
def webssh(data):
|
||
|
if not isLogined():
|
||
|
emit('server_response', {'data': '会话丢失,请重新登陆面板!\r\n'})
|
||
|
return None
|
||
|
|
||
|
import utils.ssh.ssh_local as ssh_local
|
||
|
shell = ssh_local.ssh_local.instance()
|
||
|
shell.run(data)
|
||
|
return
|