From 1a136ee1e9aba83f17fcb6b2ab03dbc2a8790193 Mon Sep 17 00:00:00 2001 From: Oolonk Date: Sun, 21 May 2023 20:20:04 +0200 Subject: [PATCH] bugfix --- app/electron.js | 4 ++-- js/database-entry-player.js | 7 ++++--- js2/database-entry-player.js | 7 ++++--- scoreboard.json | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/electron.js b/app/electron.js index 3227d84..228d849 100644 --- a/app/electron.js +++ b/app/electron.js @@ -89,7 +89,7 @@ async function createMainWindow() { show: false, icon: path.join(__dirname, 'logo.png'), autoHideMenuBar: true, - webPreferences: { devTools: _debug, experimentalFeatures: true, nodeIntegration: true, contextIsolation: false, enableRemoteModule: true } + webPreferences: { devTools: _debug, nodeIntegration: true, contextIsolation: false, enableRemoteModule: true } }); require("@electron/remote/main").enable(mainWin.webContents); mainWin.webContents.openDevTools(); @@ -142,7 +142,7 @@ function createWindow(event, arg) { modal: arg.dialog || false, autoHideMenuBar: true, parent: arg.dialog ? BrowserWindow.fromWebContents(event.sender) : null, - webPreferences: { devTools: _debug, experimentalFeatures: true, nodeIntegration: true, contextIsolation: false, enableRemoteModule: true } + webPreferences: { devTools: _debug, nodeIntegration: true, contextIsolation: false, enableRemoteModule: true } }); require("@electron/remote/main").enable(win.webContents); let windowFile = `window/${arg.name}.html`; diff --git a/js/database-entry-player.js b/js/database-entry-player.js index b3a9407..92b2741 100644 --- a/js/database-entry-player.js +++ b/js/database-entry-player.js @@ -14,7 +14,7 @@ var smashggIgnore = {}; ipcRenderer.on("returnchannel", (event, data) => _returnChannel = data); -ipcRenderer.on("data", (event, data) => { +ipcRenderer.on("data", async (event, data) => { dbName = data.db; id = data.id; if (data.entry) { @@ -24,13 +24,14 @@ ipcRenderer.on("data", (event, data) => { if (id == null) { dataset = db.createStruct(dbName); } + await startFunction(); }); smashgg.on("fetch-error", (e) => { console.error(e); }); -window.addEventListener("load", async () => { +async function startFunction() { await ipcRenderer.invoke("get", "smashgg-token").then(token => smashgg.Token = token); await ipcRenderer.invoke("get", "smashgg").then(data => smashgg.SelectedTournament = data.tournament); @@ -47,7 +48,7 @@ window.addEventListener("load", async () => { for (let infoEl of document.querySelectorAll("#info > div")) { infoEl.onclick = () => clipboard.writeText(infoEl.innerText, 'selection'); } -}); +}; async function downloadPhotoFromSmashgg() { let smashggId = parseInt(document.getElementById('field-smashgg').value); diff --git a/js2/database-entry-player.js b/js2/database-entry-player.js index b3a9407..92b2741 100644 --- a/js2/database-entry-player.js +++ b/js2/database-entry-player.js @@ -14,7 +14,7 @@ var smashggIgnore = {}; ipcRenderer.on("returnchannel", (event, data) => _returnChannel = data); -ipcRenderer.on("data", (event, data) => { +ipcRenderer.on("data", async (event, data) => { dbName = data.db; id = data.id; if (data.entry) { @@ -24,13 +24,14 @@ ipcRenderer.on("data", (event, data) => { if (id == null) { dataset = db.createStruct(dbName); } + await startFunction(); }); smashgg.on("fetch-error", (e) => { console.error(e); }); -window.addEventListener("load", async () => { +async function startFunction() { await ipcRenderer.invoke("get", "smashgg-token").then(token => smashgg.Token = token); await ipcRenderer.invoke("get", "smashgg").then(data => smashgg.SelectedTournament = data.tournament); @@ -47,7 +48,7 @@ window.addEventListener("load", async () => { for (let infoEl of document.querySelectorAll("#info > div")) { infoEl.onclick = () => clipboard.writeText(infoEl.innerText, 'selection'); } -}); +}; async function downloadPhotoFromSmashgg() { let smashggId = parseInt(document.getElementById('field-smashgg').value); diff --git a/scoreboard.json b/scoreboard.json index 80364f3..663fd75 100644 --- a/scoreboard.json +++ b/scoreboard.json @@ -1 +1 @@ -{"id":"1YGtQJ2bpB77lv5i","teams":{"1":{"name":"test2","players":[{"_id":"","name":"test2","displayname":"","firstname":"","lastname":"","birthday":null,"pronoun":"","twitter":"","twitch":"","steam":"","slippicode":"","country":"","city":null,"team":[],"smashgg":3180370,"smashggIgnore":{},"lastActivity":null}],"characters":[],"state":0,"score":0,"selected":null,"out":[]},"2":{"name":"test1","players":[{"_id":"","name":"test1","displayname":"","firstname":"","lastname":"","birthday":null,"pronoun":"","twitter":"","twitch":"","steam":"","slippicode":"","country":"","city":null,"team":[],"smashgg":3180369,"smashggIgnore":{},"lastActivity":null}],"characters":[],"state":0,"score":0,"selected":null,"out":[]}},"caster":[{"_id":"07zHIqjsXuHPUqPS","name":"Blackoser","displayname":"","firstname":"Marvin","lastname":"M.","birthday":null,"pronoun":"","twitter":"","twitch":"therealblackoser","steam":"","slippicode":"","country":"wvKcVbVeCJRw7shL","city":"Hamburg","team":[],"smashgg":"959740","smashggIgnore":{"country":null},"lastActivity":"2022-12-18T15:35:11.278Z"},{"_id":"07zHIqjsXuHPUqPS","name":"Blackoser","displayname":"","firstname":"Marvin","lastname":"M.","birthday":null,"pronoun":"","twitter":"","twitch":"therealblackoser","steam":"","slippicode":"","country":"wvKcVbVeCJRw7shL","city":"Hamburg","team":[],"smashgg":"959740","smashggIgnore":{"country":null},"lastActivity":"2022-12-18T15:35:11.278Z"}],"seatorder":[[1,0],[2,0]],"ports":[],"fields":{"round":{"enabled":true,"value":"Winners Final"},"bo":{"value":"freeplay","enabled":true},"tournamentname":{"value":"Deleted","enabled":true},"location":{"value":"","enabled":true},"smashgg":{"value":"testslug","enabled":true},"countdown":{"value":"","enabled":false},"switchtostart":{"value":"","enabled":true},"switchtoend":{"value":"","enabled":true},"bottombar":{"value":"standing","enabled":true},"hashtag":{"value":"TestHashtag","enabled":true},"freetext":{"value":"","enabled":true}},"game":"SDQXva74lQfZPTes","startgg":{"set":55315656,"event":834071,"phaseGroup":1948508,"phase":1270965},"smashggtoken":"17975f78257ff3d9cbca6eab679d6777","streamlist":[{"id":55315656,"slots":[{"entrant":{"name":"test2"}},{"entrant":{"name":"test1"}}],"fullRoundText":"Winners Final","identifier":"A","round":1}],"type":null,"_D":"2023-05-21T14:55:35.485Z","showcaster":null,"smashgg":null,"all":null} \ No newline at end of file +{"id":"1YGtQJ2bpB77lv5i","teams":{"1":{"name":"test2","players":[{"_id":"","name":"test2","displayname":"","firstname":"","lastname":"","birthday":null,"pronoun":"","twitter":"","twitch":"","steam":"","slippicode":"","country":"","city":null,"team":[],"smashgg":3180370,"smashggIgnore":{},"lastActivity":null}],"characters":[],"state":0,"score":0,"selected":null,"out":[]},"2":{"name":"test1","players":[{"_id":"AGjMiqQb0S3JaLUe","name":"3rd","displayname":"","firstname":"Jan","lastname":"K.","birthday":null,"pronoun":"he/him","twitter":"","twitch":"pepethebiggiraffe","steam":"","slippicode":"","country":"wvKcVbVeCJRw7shL","city":"Berlin","team":["DKHmmBRM3H80kiek"],"smashgg":"859325","smashggIgnore":{"country":null},"lastActivity":"2023-05-21T15:56:04.226Z"}],"characters":[],"state":0,"score":0,"selected":null,"out":[]}},"caster":[{"_id":"07zHIqjsXuHPUqPS","name":"Blackoser","displayname":"","firstname":"Marvin","lastname":"M.","birthday":null,"pronoun":"","twitter":"","twitch":"therealblackoser","steam":"","slippicode":"","country":"wvKcVbVeCJRw7shL","city":"Hamburg","team":[],"smashgg":"959740","smashggIgnore":{"country":null},"lastActivity":"2022-12-18T15:35:11.278Z"},{"_id":"07zHIqjsXuHPUqPS","name":"Blackoser","displayname":"","firstname":"Marvin","lastname":"M.","birthday":null,"pronoun":"","twitter":"","twitch":"therealblackoser","steam":"","slippicode":"","country":"wvKcVbVeCJRw7shL","city":"Hamburg","team":[],"smashgg":"959740","smashggIgnore":{"country":null},"lastActivity":"2022-12-18T15:35:11.278Z"}],"seatorder":[[1,0],[2,0]],"ports":[],"fields":{"round":{"enabled":true,"value":"Winners Final"},"bo":{"value":"freeplay","enabled":true},"tournamentname":{"value":"Deleted","enabled":true},"location":{"value":"","enabled":true},"smashgg":{"value":"testslug","enabled":true},"countdown":{"value":"","enabled":false},"switchtostart":{"value":"","enabled":true},"switchtoend":{"value":"","enabled":true},"bottombar":{"value":"standing","enabled":true},"hashtag":{"value":"TestHashtag","enabled":true},"freetext":{"value":"","enabled":true}},"game":"SDQXva74lQfZPTes","startgg":{"set":55315656,"event":834071,"phaseGroup":1948508,"phase":1270965},"smashggtoken":"17975f78257ff3d9cbca6eab679d6777","streamlist":[{"id":55315656,"slots":[{"entrant":{"name":"test2"}},{"entrant":{"name":"test1"}}],"fullRoundText":"Winners Final","identifier":"A","round":1}],"type":null,"_D":"2023-05-21T18:18:28.313Z","showcaster":null,"smashgg":null,"all":null} \ No newline at end of file