mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Make zmodem work again
This commit is contained in:
+1
-3
@@ -19,10 +19,8 @@
|
||||
<script src="/build/addons/fullscreen/fullscreen.js" ></script>
|
||||
<script src="/build/addons/search/search.js" ></script>
|
||||
|
||||
<!-- Edge needs this, as of late 2017 -->
|
||||
<!-- zmodem.js: Edge needs this, as of late 2017 -->
|
||||
<script src="/js/text-encoding.js"></script>
|
||||
|
||||
<script src="zmodemjs/dist/zmodem.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>xterm.js: xterm, in the browser</h1>
|
||||
|
||||
+32
-30
@@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var term,
|
||||
protocol,
|
||||
socketURL,
|
||||
@@ -109,6 +111,36 @@ function createTerminal() {
|
||||
socket.onopen = runRealTerminal;
|
||||
socket.onclose = runFakeTerminal;
|
||||
socket.onerror = runFakeTerminal;
|
||||
|
||||
term.zmodemAttach(socket);
|
||||
|
||||
term.on("zmodemRetract", () => {
|
||||
start_form.style.display = "none";
|
||||
start_form.onsubmit = null;
|
||||
});
|
||||
|
||||
term.on("zmodemDetect", (detection) => {
|
||||
start_form.style.display = "";
|
||||
start_form.onsubmit = function(e) {
|
||||
start_form.style.display = "none";
|
||||
|
||||
if (document.getElementById("zmstart_yes").checked) {
|
||||
let zsession = detection.confirm();
|
||||
|
||||
current_zsession = zsession;
|
||||
|
||||
if (zsession.type === "receive") {
|
||||
_handle_receive_session(zsession);
|
||||
}
|
||||
else {
|
||||
_handle_send_session(zsession);
|
||||
}
|
||||
}
|
||||
else {
|
||||
detection.deny();
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
}, 0);
|
||||
@@ -237,36 +269,6 @@ function abort_current_session() {
|
||||
current_zsession.abort();
|
||||
}
|
||||
|
||||
term.zmodemAttach(socket);
|
||||
|
||||
term.on("zmodemRetract", () => {
|
||||
start_form.style.display = "none";
|
||||
start_form.onsubmit = null;
|
||||
});
|
||||
|
||||
term.on("zmodemDetect", () => {
|
||||
start_form.style.display = "";
|
||||
start_form.onsubmit = function(e) {
|
||||
start_form.style.display = "none";
|
||||
|
||||
if (document.getElementById("zmstart_yes").checked) {
|
||||
let zsession = detection.confirm();
|
||||
|
||||
current_zsession = zsession;
|
||||
|
||||
if (zsession.type === "receive") {
|
||||
_handle_receive_session(zsession);
|
||||
}
|
||||
else {
|
||||
_handle_send_session(zsession);
|
||||
}
|
||||
}
|
||||
else {
|
||||
detection.deny();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
function runRealTerminal() {
|
||||
term.on("data", (d) => {
|
||||
socket.send(d);
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@
|
||||
"lint": "tslint src/*.ts src/**/*.ts",
|
||||
"test": "gulp test",
|
||||
"build:docs": "jsdoc -c jsdoc.json",
|
||||
"build": "gulp build; cd demo/zmodemjs; npm install",
|
||||
"build": "gulp build; cd src/addons/zmodem/zmodemjs; npm install",
|
||||
"prepublish": "npm run build",
|
||||
"coveralls": "gulp coveralls"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user