Skip to content

Commit

Permalink
Merge pull request #221 from Noita-Together/next
Browse files Browse the repository at this point in the history
Minor changes to disconnect message
  • Loading branch information
SkyeOfBreeze authored Dec 8, 2024
2 parents 8091cff + 6495834 commit 91f3ea4
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion nt-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nt-app",
"version": "0.11.5",
"version": "0.11.6",
"author": "Noita-Together",
"description": "Allows you to play noita with friends...",
"repository": "https://github.com/Noita-Together/noita-together",
Expand Down
6 changes: 4 additions & 2 deletions nt-app/src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ const loginserv = http.createServer(function (req, res) {
}

res.writeHead(200, { "Content-Type": "text/html" })
res.end("You can close this.")
//loginserv.close()
res.end("You can close this. " +
"<br/><a href='https://noitatogether.com/'>Noita Together Website</a>" +
"<br/><a href='https://github.com/Noita-Together/noita-together/wiki/FAQ'>FAQ</a>")
loginserv.close()
})

autoUpdater.on("update-downloaded", (info) => {
Expand Down
7 changes: 7 additions & 0 deletions nt-app/src/components/vFooter.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<template>
<div class="footer">
<span id="app-version">v{{version}}</span>
<span class="donate" @click="ShowHelpInBrowser">
<span>FAQ <i slot="icon" class="fas fa-link"></i></span>
</span>
<div class="donate" @click="OpenContributors">
<span title="Github">Click to see contributors <i slot="icon" class="fas fa-wrench"></i></span>
</div>
Expand All @@ -17,13 +20,17 @@ export default {
data() {
return {
contributorUrl: "https://github.com/Noita-Together/noita-together/",
faqUrl: "https://github.com/Noita-Together/noita-together/wiki/FAQ",
version: "0"
}
},
methods: {
OpenContributors() {
shell.openExternal(this.contributorUrl);
},
ShowHelpInBrowser() {
shell.openExternal(this.faqUrl);
},
}
};
</script>
Expand Down
2 changes: 1 addition & 1 deletion nt-app/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ const ipcPlugin = (ipc) => {
ipc.on("CONNECTION_LOST", (event, data) => {
store.dispatch("errDialog", {
title: "Disconnected from server",
body: `Received status code of ${data} when disconnected`,
body: `Received status code of ${data.code} when disconnected (${data.reason})`,
canClose: false
})
})
Expand Down
18 changes: 14 additions & 4 deletions nt-app/src/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,17 @@ module.exports = (data) => {
appEvent("CONNECTED", data)
})

client.on("close", (code) => {
client.addEventListener("close", (event) => {
clearInterval(timer)
timer = undefined
const reason = event.reason ? event.reason : "no_reason_supplied"
//codes https://github.com/Luka967/websocket-close-codes
console.log(`CONNECTION_LOST with a code of ${code}. Send a message to https://stat.moistmob.com/disconnected/${code}`)
console.log('addEventListener: WS had an error :(')
console.log(event)
const url = `https://stat.moistmob.com/disconnected/${event.code}/${encodeURI(reason.toString().slice(0, 200))}`
console.log(`CONNECTION_LOST with a code of ${event.code}. Send a message to ${url}`)
const req = net.request({
url: `https://stat.moistmob.com/disconnected/${code}`,
url: url,
method: 'GET'
})
req.on('response', (response)=> {
Expand All @@ -128,13 +132,19 @@ module.exports = (data) => {
});
})
req.on('error', (error) => {
console.log('failed to send status. probably an internet issue')
console.log(error)
})
req.end()
appEvent("CONNECTION_LOST", {code: event.code, reason: reason})
noita.clientDisconnected()
appEvent("CONNECTION_LOST", code)
client.terminate()
client = null
});

client.on('error', (err) => {
console.log('WS had an error :(')
console.log(err)
})

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "noita-together",
"private": true,
"version": "0.11.5",
"version": "0.11.6",
"packageManager": "yarn@3.5.1",
"workspaces": [
"nt-app/",
Expand Down

0 comments on commit 91f3ea4

Please sign in to comment.