Skip to content

Commit 57ddcbb

Browse files
authored
Merge pull request #39 from makermelissa/main
Fix non-standard port usage and Run Code import bugs
2 parents 7537516 + 1479c25 commit 57ddcbb

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

assets/css/style.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/style.css.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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)