Skip to content

Commit 1479c25

Browse files
committed
Fix non-standard port and import bugs
1 parent 077266f commit 1479c25

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

assets/js/workflows/web.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,11 @@ class WebWorkflow extends Workflow {
102102
} else {
103103
return Error("You are connected with localhost, but didn't supply the device hostname.");
104104
}
105-
} else if (isMdns()) {
106-
this.host = location.hostname;
107-
} else if (isIp()) {
105+
} else if (isMdns() || isIp()) {
108106
this.host = location.hostname;
107+
if (location.port != 80) {
108+
this.host += ":" + location.port;
109+
}
109110
}
110111

111112
if (this.host != null) {

assets/js/workflows/workflow.js

+15-13
Original file line numberDiff line numberDiff line change
@@ -205,22 +205,24 @@ class Workflow {
205205

206206
if (path == "/code.py") {
207207
await this.serialTransmit(CHAR_CTRL_D);
208-
}
208+
} else {
209209

210-
let extension = path.split('.').pop();
211-
if (extension === null) {
212-
console.log("Extension not found");
213-
return false;
214-
}
215-
if (String(extension).toLowerCase() != "py") {
216-
console.log("Extension not py, twas " + String(extension).toLowerCase());
217-
return false;
218-
}
219-
path = path.slice(0, -3);
220-
path = path.replace(/\//g, ".");
210+
let extension = path.split('.').pop();
211+
if (extension === null) {
212+
console.log("Extension not found");
213+
return false;
214+
}
215+
if (String(extension).toLowerCase() != "py") {
216+
console.log("Extension not py, it was " + String(extension).toLowerCase());
217+
return false;
218+
}
221219

220+
path = path.slice(1, -3);
221+
path = path.replace(/\//g, ".");
222+
223+
await this.serialTransmit(CHAR_CTRL_C + "import " + path + CHAR_CRLF);
224+
}
222225
await this._changeMode(MODE_SERIAL);
223-
await this.serialTransmit(CHAR_CTRL_C + "import " + path + CHAR_CRLF);
224226
}
225227

226228
async checkSaved() {

0 commit comments

Comments
 (0)