dev_forum
parent
743ff88d01
commit
f2e7ebb376
File diff suppressed because it is too large
Load Diff
@ -1,74 +1,75 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
|
||||||
export function loadSshScript(callback) {
|
export function loadSshScript(callback) {
|
||||||
let _url_origin = ``;
|
let _url_origin = ``;
|
||||||
let prefix = 'react/build'
|
let prefix = 'react/build'
|
||||||
if (window.location.port == 3007) {
|
if (window.location.port == 3007) {
|
||||||
prefix = ''
|
prefix = ''
|
||||||
} else {
|
} else {
|
||||||
_url_origin = `https://testeduplus2.educoder.net/`;
|
// _url_origin = `https://testeduplus2.educoder.net/`;
|
||||||
}
|
_url_origin = 'http://47.96.87.25:48080';
|
||||||
const $ = window.$;
|
}
|
||||||
// 未加载过
|
const $ = window.$;
|
||||||
if (!window['Terminal']) {
|
// 未加载过
|
||||||
// /js/js_min_all.
|
if (!window['Terminal']) {
|
||||||
$('head').append($('<link rel="stylesheet" type="text/css" />')
|
// /js/js_min_all.
|
||||||
.attr('href', `${_url_origin}${prefix}/js/xterm/xterm.css`));
|
$('head').append($('<link rel="stylesheet" type="text/css" />')
|
||||||
|
.attr('href', `${_url_origin}${prefix}/js/xterm/xterm.css`));
|
||||||
// $.getScript(
|
|
||||||
// `${_url_origin}${prefix}/js/xterm/xterm.js`,
|
// $.getScript(
|
||||||
// (data, textStatus, jqxhr) => {
|
// `${_url_origin}${prefix}/js/xterm/xterm.js`,
|
||||||
// });
|
// (data, textStatus, jqxhr) => {
|
||||||
// $.getScript(
|
// });
|
||||||
// `${_url_origin}${prefix}/js/jsFromMiddleLayer/base64.js`,
|
// $.getScript(
|
||||||
// (data, textStatus, jqxhr) => {
|
// `${_url_origin}${prefix}/js/jsFromMiddleLayer/base64.js`,
|
||||||
// });
|
// (data, textStatus, jqxhr) => {
|
||||||
// $.getScript(
|
// });
|
||||||
// `${_url_origin}${prefix}/js/jsFromMiddleLayer/ws.js`,
|
// $.getScript(
|
||||||
// (data, textStatus, jqxhr) => {
|
// `${_url_origin}${prefix}/js/jsFromMiddleLayer/ws.js`,
|
||||||
// $.getScript(
|
// (data, textStatus, jqxhr) => {
|
||||||
// `${_url_origin}${prefix}/js/jsFromMiddleLayer/main.js`,
|
// $.getScript(
|
||||||
// (data, textStatus, jqxhr) => {
|
// `${_url_origin}${prefix}/js/jsFromMiddleLayer/main.js`,
|
||||||
// callback && callback()
|
// (data, textStatus, jqxhr) => {
|
||||||
// });
|
// callback && callback()
|
||||||
// });
|
// });
|
||||||
|
// });
|
||||||
$.when(
|
|
||||||
$.getScript( `${_url_origin}${prefix}/js/xterm/xterm.js` ),
|
$.when(
|
||||||
$.getScript( `${_url_origin}${prefix}/js/jsFromMiddleLayer/base64.js` ),
|
$.getScript( `${_url_origin}${prefix}/js/xterm/xterm.js` ),
|
||||||
$.getScript( `${_url_origin}${prefix}/js/jsFromMiddleLayer/ws.js` ),
|
$.getScript( `${_url_origin}${prefix}/js/jsFromMiddleLayer/base64.js` ),
|
||||||
$.getScript( `${_url_origin}${prefix}/js/jsFromMiddleLayer/main.js` ),
|
$.getScript( `${_url_origin}${prefix}/js/jsFromMiddleLayer/ws.js` ),
|
||||||
$.Deferred(function( deferred ){
|
$.getScript( `${_url_origin}${prefix}/js/jsFromMiddleLayer/main.js` ),
|
||||||
$( deferred.resolve );
|
$.Deferred(function( deferred ){
|
||||||
})
|
$( deferred.resolve );
|
||||||
).done(function(){
|
})
|
||||||
//place your code here, the scripts are all loaded
|
).done(function(){
|
||||||
callback && callback()
|
//place your code here, the scripts are all loaded
|
||||||
});
|
callback && callback()
|
||||||
} else {
|
});
|
||||||
callback && callback()
|
} else {
|
||||||
}
|
callback && callback()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
export function openTerminal(props, parentDomId) {
|
|
||||||
const { game_id, host, password, port, username, webssh_url, ws_url,
|
export function openTerminal(props, parentDomId) {
|
||||||
rows, cols, width, height} = props;
|
const { game_id, host, password, port, username, webssh_url, ws_url,
|
||||||
|
rows, cols, width, height} = props;
|
||||||
var options = {
|
|
||||||
host: host,
|
var options = {
|
||||||
port: port,
|
host: host,
|
||||||
username: username,
|
port: port,
|
||||||
secret: password,
|
username: username,
|
||||||
gameid: game_id,
|
secret: password,
|
||||||
rows: rows,
|
gameid: game_id,
|
||||||
columns: cols,
|
rows: rows,
|
||||||
width,
|
columns: cols,
|
||||||
height,
|
width,
|
||||||
parentDomId,
|
height,
|
||||||
// tab: $("#terminalTab").val(),
|
parentDomId,
|
||||||
}
|
// tab: $("#terminalTab").val(),
|
||||||
window.g_websocket_url = ws_url;
|
}
|
||||||
// TODO 加一个parentDomId 来做多ssh tab
|
window.g_websocket_url = ws_url;
|
||||||
window.openTerminal(options)
|
// TODO 加一个parentDomId 来做多ssh tab
|
||||||
}
|
window.openTerminal(options)
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in new issue