Skip to content

Commit

Permalink
Fix typo with WebSocketPort raised by @MitchBradley
Browse files Browse the repository at this point in the history
  • Loading branch information
luc-github committed Jan 7, 2022
1 parent 4d2370f commit 35af0ed
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 35 deletions.
Binary file modified dist/grbl/debug/index.html.gz
Binary file not shown.
Binary file modified dist/grbl/languages/fr.json.gz
Binary file not shown.
Binary file modified dist/grbl/languages/zh_cn.json.gz
Binary file not shown.
Binary file modified dist/grbl/production/index.html.gz
Binary file not shown.
Binary file modified dist/printer/debug/index.html.gz
Binary file not shown.
Binary file modified dist/printer/languages/fr.json.gz
Binary file not shown.
Binary file modified dist/printer/languages/zh_cn.json.gz
Binary file not shown.
Binary file modified dist/printer/production/index.html.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions src/components/settings/webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,11 @@ function loadConfigSuccess(responseText) {
try {
data = JSON.parse(responseText)
applyConfig(data)
if (data.WebSocketIP && data.WebCommunication && data.WebSocketport) {
if (data.WebSocketIP && data.WebCommunication && data.WebSocketPort) {
setupWebSocket(
data.WebCommunication,
document.location.hostname,
data.WebSocketport
data.WebSocketPort
)
}
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
*/
import { h } from "preact"

export const Esp3dVersion = () => <span>3.0.0.86</span>
export const Esp3dVersion = () => <span>3.0.0.87</span>
2 changes: 1 addition & 1 deletion src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ app.get("/command", function (req, res) {
Authentication: "Disabled",
WebCommunication: "Synchronous",
WebSocketIP: "localhost",
WebSocketport: "81",
WebSocketPort: "81",
Hostname: "esp3d",
WiFiMode: "STA",
WebUpdate: "Enabled",
Expand Down
63 changes: 32 additions & 31 deletions src/server/indexgrbl.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function sendStatus() {
nbqueries++
}
}
app.get("/command", function(req, res) {
app.get("/command", function (req, res) {
var url = req.originalUrl
console.log(url)
if (url.indexOf("cmd=%3F") != -1) {
Expand Down Expand Up @@ -132,7 +132,7 @@ app.get("/command", function(req, res) {
Authentication: "Disabled",
WebCommunication: "Synchronous",
WebSocketIP: "localhost",
WebSocketport: "81",
WebSocketPort: "81",
Hostname: "esp3d",
WiFiMode: "STA",
WebUpdate: "Enabled",
Expand Down Expand Up @@ -314,20 +314,20 @@ app.get("/command", function(req, res) {
V: "11",
H: "channel",
O: [
{ "1": "1" },
{ "2": "2" },
{ "3": "3" },
{ "4": "4" },
{ "5": "5" },
{ "6": "6" },
{ "7": "7" },
{ "8": "8" },
{ "9": "9" },
{ "10": "10" },
{ "11": "11" },
{ "12": "12" },
{ "13": "13" },
{ "14": "14" },
{ 1: "1" },
{ 2: "2" },
{ 3: "3" },
{ 4: "4" },
{ 5: "5" },
{ 6: "6" },
{ 7: "7" },
{ 8: "8" },
{ 9: "9" },
{ 10: "10" },
{ 11: "11" },
{ 12: "12" },
{ 13: "13" },
{ 14: "14" },
],
},
{
Expand Down Expand Up @@ -479,7 +479,7 @@ function filesList(mypath) {
let nb = 0
let totalused = getTotalSize(__dirname + "/public")
let total = 1.31 * 1024 * 1024
fs.readdirSync(__dirname + "/public" + mypath).forEach(fileelement => {
fs.readdirSync(__dirname + "/public" + mypath).forEach((fileelement) => {
let fst = fs.statSync(__dirname + "/public" + mypath + fileelement)
let fsize = -1

Expand All @@ -503,12 +503,12 @@ function filesList(mypath) {
return res
}

const getAllFiles = function(dirPath, arrayOfFiles) {
const getAllFiles = function (dirPath, arrayOfFiles) {
let files = fs.readdirSync(dirPath)

arrayOfFiles = arrayOfFiles || []

files.forEach(function(file) {
files.forEach(function (file) {
if (fs.statSync(dirPath + "/" + file).isDirectory()) {
arrayOfFiles = getAllFiles(dirPath + "/" + file, arrayOfFiles)
} else {
Expand All @@ -519,23 +519,23 @@ const getAllFiles = function(dirPath, arrayOfFiles) {
return arrayOfFiles
}

const getTotalSize = function(directoryPath) {
const getTotalSize = function (directoryPath) {
const arrayOfFiles = getAllFiles(directoryPath)

let totalSize = 0

arrayOfFiles.forEach(function(filePath) {
arrayOfFiles.forEach(function (filePath) {
totalSize += fs.statSync(filePath).size
})

return totalSize
}

app.all("/updatefw", function(req, res) {
app.all("/updatefw", function (req, res) {
res.send("ok")
})

app.all("/files", function(req, res) {
app.all("/files", function (req, res) {
let mypath = req.query.path
if (typeof mypath == "undefined") mypath = "/"
if (!req.files || Object.keys(req.files).length === 0) {
Expand All @@ -545,17 +545,18 @@ app.all("/files", function(req, res) {

if (typeof myFile.length == "undefined") {
console.log("one files")
myFile.mv(__dirname + "/public" + mypath + myFile.name, function(err) {
myFile.mv(__dirname + "/public" + mypath + myFile.name, function (err) {
if (err) return res.status(500).send(err)
})
} else {
console.log(myFile.length + " files")
for (let i = 0; i < myFile.length; i++) {
myFile[i].mv(__dirname + "/public/" + myFile[i].name, function(
err
) {
if (err) return res.status(500).send(err)
})
myFile[i].mv(
__dirname + "/public/" + myFile[i].name,
function (err) {
if (err) return res.status(500).send(err)
}
)
}
}
res.send(filesList(mypath))
Expand All @@ -565,7 +566,7 @@ app.listen(process.env.PORT || 8080, () =>
console.log(`Listening on port ${process.env.PORT || 8080}!`)
)

wss.on("connection", function(ws) {
wss.on("connection", function (ws) {
console.log("New connection")
ws.send(`currentID:${currentID}`)
wss.clients.forEach(function each(client) {
Expand All @@ -574,7 +575,7 @@ wss.on("connection", function(ws) {
}
})
currentID++
ws.on("message", function(message) {
ws.on("message", function (message) {
console.log("received: %s", message)
})
})

0 comments on commit 35af0ed

Please sign in to comment.