Make zmodem work again

This commit is contained in:
Felipe Gasper
2017-10-16 15:26:09 +01:00
parent 73b804f42d
commit 6fa08d3cc0
3 changed files with 34 additions and 34 deletions
+1 -3
View File
@@ -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
View File
@@ -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
View File
@@ -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"
},