From a311566232f9914b221c5ad988974598fe081b56 Mon Sep 17 00:00:00 2001 From: XtoMHA96 Date: Wed, 25 Oct 2023 09:43:44 +0100 Subject: [PATCH] v1.0.7 Add PORT config --- core/client.js | 8 ++++---- core/template/cdown/control/control.js | 2 +- core/template/cdown/view/client.js | 2 +- core/template/cdowntime/control/control.js | 2 +- core/template/cdowntime/view/client.js | 2 +- core/template/crono/control/control.js | 2 +- core/template/crono/view/client.js | 2 +- core/template/extensible/control/control.js | 2 +- core/template/extensible/viewCdown/client.js | 2 +- core/template/extensible/viewCrono/client.js | 2 +- core/template/time/control/control.js | 2 +- core/template/time/view/client.js | 2 +- package-lock.json | 4 ++-- package.json | 8 ++++---- server.js | 6 +++--- 15 files changed, 24 insertions(+), 24 deletions(-) diff --git a/core/client.js b/core/client.js index de6b5cf..51e0009 100644 --- a/core/client.js +++ b/core/client.js @@ -17,7 +17,7 @@ const titleCdowntime = document.getElementById('cdowntime-title') const titleExtensible = document.getElementById('extensible-title') const titleTime = document.getElementById('time-title') // const test = document.getElementById('test') -const socket = new WebSocket('ws://localhost:3000') +const socket = new WebSocket(`ws://localhost:${window.location.port}`) let translateElements @@ -143,7 +143,7 @@ buttonContainer.addEventListener('click', (event) => { window.open(`/${data[0]}/viewCdown`, '_blank', 'width=800,height=600') } else if (data[1] === 'copyButton') { // Get the text to copy from the "data-copy-text" attribute - const copyText = `http://localhost:3000/${data[0]}/view` + const copyText = `http://localhost:${window.location.port}/${data[0]}/view` if (copyText) { copyTextToClipboard(copyText) @@ -153,7 +153,7 @@ buttonContainer.addEventListener('click', (event) => { } } else if (data[1] === 'copyButtonCrono') { // Get the text to copy from the "data-copy-text" attribute - const copyText = `http://localhost:3000/${data[0]}/viewCrono` + const copyText = `http://localhost:${window.location.port}/${data[0]}/viewCrono` if (copyText) { copyTextToClipboard(copyText) @@ -163,7 +163,7 @@ buttonContainer.addEventListener('click', (event) => { } } else if (data[1] === 'copyButtonCdown') { // Get the text to copy from the "data-copy-text" attribute - const copyText = `http://localhost:3000/${data[0]}/viewCdown` + const copyText = `http://localhost:${window.location.port}/${data[0]}/viewCdown` if (copyText) { copyTextToClipboard(copyText) diff --git a/core/template/cdown/control/control.js b/core/template/cdown/control/control.js index 936eb13..7d44269 100644 --- a/core/template/cdown/control/control.js +++ b/core/template/cdown/control/control.js @@ -19,7 +19,7 @@ const titlePage = document.getElementById('titlePage') const selectorLang = document.getElementById('language-selector') const switchTheme = document.getElementById('switch-theme') // const test = document.getElementById('test'); -const socket = new WebSocket('ws://localhost:3000') +const socket = new WebSocket(`ws://localhost:${window.location.port}`) const classElement = window.location.href.split('/')[3] titlePage.textContent = classElement + ' - Control' diff --git a/core/template/cdown/view/client.js b/core/template/cdown/view/client.js index a57883c..3f10ae6 100644 --- a/core/template/cdown/view/client.js +++ b/core/template/cdown/view/client.js @@ -3,7 +3,7 @@ const timeElement = document.getElementById('time') const containers = document.querySelectorAll('.container') const titlePage = document.getElementById('titlePage') // const test = document.getElementById('test'); // Commented out unused variable -const socket = new WebSocket('ws://localhost:3000') +const socket = new WebSocket(`ws://localhost:${window.location.port}`) // Extract class element from URL const classElement = window.location.href.split('/')[3] diff --git a/core/template/cdowntime/control/control.js b/core/template/cdowntime/control/control.js index 7c2abeb..f952b8a 100644 --- a/core/template/cdowntime/control/control.js +++ b/core/template/cdowntime/control/control.js @@ -19,7 +19,7 @@ const titlePage = document.getElementById('titlePage') const selectorLang = document.getElementById('language-selector') const switchTheme = document.getElementById('switch-theme') // const test = document.getElementById('test'); // Commented out unused variable -const socket = new WebSocket('ws://localhost:3000') +const socket = new WebSocket(`ws://localhost:${window.location.port}`) const classElement = window.location.href.split('/')[3] titlePage.textContent = classElement + ' - Control' diff --git a/core/template/cdowntime/view/client.js b/core/template/cdowntime/view/client.js index df5c846..870390a 100644 --- a/core/template/cdowntime/view/client.js +++ b/core/template/cdowntime/view/client.js @@ -3,7 +3,7 @@ const timeElement = document.getElementById('time') const containers = document.querySelectorAll('.container') const titlePage = document.getElementById('titlePage') // const test = document.getElementById('test'); // Commented out unused variable -const socket = new WebSocket('ws://localhost:3000') +const socket = new WebSocket(`ws://localhost:${window.location.port}`) const classElement = window.location.href.split('/')[3] titlePage.textContent = classElement + ' - View' diff --git a/core/template/crono/control/control.js b/core/template/crono/control/control.js index fe0cb08..fab29c5 100644 --- a/core/template/crono/control/control.js +++ b/core/template/crono/control/control.js @@ -17,7 +17,7 @@ const titlePage = document.getElementById('titlePage') const languageSelector = document.getElementById('language-selector') const switchTheme = document.getElementById('switch-theme') // const test = document.getElementById('test') -const socket = new WebSocket('ws://localhost:3000') +const socket = new WebSocket(`ws://localhost:${window.location.port}`) const classElement = window.location.href.split('/')[3] titlePage.textContent = classElement + ' - Control' diff --git a/core/template/crono/view/client.js b/core/template/crono/view/client.js index d070a88..56737a1 100644 --- a/core/template/crono/view/client.js +++ b/core/template/crono/view/client.js @@ -2,7 +2,7 @@ const timeElement = document.getElementById('time') const containers = document.querySelectorAll('.container') const titlePage = document.getElementById('titlePage') // const test = document.getElementById('test') -const socket = new WebSocket('ws://localhost:3000') +const socket = new WebSocket(`ws://localhost:${window.location.port}`) const classElement = window.location.href.split('/')[3] titlePage.textContent = classElement + ' - View' diff --git a/core/template/extensible/control/control.js b/core/template/extensible/control/control.js index 3296250..251d1b9 100644 --- a/core/template/extensible/control/control.js +++ b/core/template/extensible/control/control.js @@ -24,7 +24,7 @@ const titlePage = document.getElementById('titlePage') const selectorLang = document.getElementById('language-selector') const switchTheme = document.getElementById('switch-theme') // const test = document.getElementById('test'); -const socket = new WebSocket('ws://localhost:3000') +const socket = new WebSocket(`ws://localhost:${window.location.port}`) const classElement = window.location.href.split('/')[3] titlePage.textContent = classElement + ' - Control' diff --git a/core/template/extensible/viewCdown/client.js b/core/template/extensible/viewCdown/client.js index c315ad0..c99f40a 100644 --- a/core/template/extensible/viewCdown/client.js +++ b/core/template/extensible/viewCdown/client.js @@ -3,7 +3,7 @@ const timeElement = document.getElementById('time') const containers = document.querySelectorAll('.container') const titlePage = document.getElementById('titlePage') // const test = document.getElementById('test'); // Commented out unused variable -const socket = new WebSocket('ws://localhost:3000') +const socket = new WebSocket(`ws://localhost:${window.location.port}`) // Extract class element from URL const classElement = window.location.href.split('/')[3] diff --git a/core/template/extensible/viewCrono/client.js b/core/template/extensible/viewCrono/client.js index 240d2e9..57e0cf0 100644 --- a/core/template/extensible/viewCrono/client.js +++ b/core/template/extensible/viewCrono/client.js @@ -2,7 +2,7 @@ const timeElement = document.getElementById('time') const containers = document.querySelectorAll('.container') const titlePage = document.getElementById('titlePage') // const test = document.getElementById('test') -const socket = new WebSocket('ws://localhost:3000') +const socket = new WebSocket(`ws://localhost:${window.location.port}`) const classElement = window.location.href.split('/')[3] titlePage.textContent = classElement + ' - View - Crono' diff --git a/core/template/time/control/control.js b/core/template/time/control/control.js index 83a2d61..e9437ae 100644 --- a/core/template/time/control/control.js +++ b/core/template/time/control/control.js @@ -15,7 +15,7 @@ const titlePage = document.getElementById('titlePage') const langSelector = document.getElementById('language-selector') const switchTheme = document.getElementById('switch-theme') // const test = document.getElementById('test'); -const socket = new WebSocket('ws://localhost:3000') +const socket = new WebSocket(`ws://localhost:${window.location.port}`) const classElement = window.location.href.split('/')[3] titlePage.textContent = classElement + ' - Control' diff --git a/core/template/time/view/client.js b/core/template/time/view/client.js index 011990f..8be31d6 100644 --- a/core/template/time/view/client.js +++ b/core/template/time/view/client.js @@ -3,7 +3,7 @@ const timeElement = document.getElementById('time') const containers = document.querySelectorAll('.container') const titlePage = document.getElementById('titlePage') // const test = document.getElementById('test'); -const socket = new WebSocket('ws://localhost:3000') +const socket = new WebSocket(`ws://localhost:${window.location.port}`) const classElement = window.location.href.split('/')[3] titlePage.textContent = classElement + ' - View' diff --git a/package-lock.json b/package-lock.json index 8b932e2..7d47a78 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "obs-timer-controller", - "version": "1.0.6", + "version": "1.0.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "obs-timer-controller", - "version": "1.0.6", + "version": "1.0.7", "license": "ISC", "dependencies": { "axios": "^1.5.1", diff --git a/package.json b/package.json index e27e3cc..0c1d72e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obs-timer-controller", - "version": "1.0.6", + "version": "1.0.7", "description": "Handling browser sources for OBS related to timers and countdowns.", "main": "server.js", "repository": { @@ -24,9 +24,9 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "node": "node . test", - "pkg-win": "electron-packager . OBS-Timer-Controller --platform=win32 --arch=x64 --app-version=1.0.6 --out=dist --overwrite --icon=icon.ico --author=\"XtoManuel\" --description=\"Handling browser sources for OBS related to timers and countdowns.\"", - "pkg-linux": "electron-packager . OBS-Timer-Controller --platform=linux --arch=x64 --app-version=1.0.6 --out=dist --overwrite --icon=icon.ico --author=\"XtoManuel\" --description=\"Handling browser sources for OBS related to timers and countdowns.\"", - "pkg-mac": "electron-packager . OBS-Timer-Controller --platform=darwin --arch=x64 --app-version=1.0.6 --out=dist --overwrite --icon=icon.icns --author=\"XtoManuel\" --description=\"Handling browser sources for OBS related to timers and countdowns.\"", + "pkg-win": "electron-packager . OBS-Timer-Controller --platform=win32 --arch=x64 --app-version=1.0.7 --out=dist --overwrite --icon=icon.ico --author=\"XtoManuel\" --description=\"Handling browser sources for OBS related to timers and countdowns.\"", + "pkg-linux": "electron-packager . OBS-Timer-Controller --platform=linux --arch=x64 --app-version=1.0.7 --out=dist --overwrite --icon=icon.ico --author=\"XtoManuel\" --description=\"Handling browser sources for OBS related to timers and countdowns.\"", + "pkg-mac": "electron-packager . OBS-Timer-Controller --platform=darwin --arch=x64 --app-version=1.0.7 --out=dist --overwrite --icon=icon.icns --author=\"XtoManuel\" --description=\"Handling browser sources for OBS related to timers and countdowns.\"", "pkg-all": "npm run pkg-win && npm run pkg-linux" }, "author": "XtoManuel", diff --git a/server.js b/server.js index c284924..57e74fc 100644 --- a/server.js +++ b/server.js @@ -448,11 +448,11 @@ function openUrlWhenConfigExists () { } } -// Start the server on port 3000 -const PORT = process.env.PORT || 3000 +// Start the server +const PORT = process.env.PORT || 5001 server.listen(PORT, () => { console.log(`Server is running on port ${PORT}`) - // Open the default browser at 'http://localhost:3000' after starting the server using 'open'. + // Open the default browser at 'http://localhost:5001' after starting the server using 'open'. openUrlWhenConfigExists() })