Compare commits

..

No commits in common. 'main' and 'v1.5.1' have entirely different histories.
main ... v1.5.1

@ -1,2 +0,0 @@
$env:NODE_OPTIONS = "--openssl-legacy-provider"
npm run electron:build

34363
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
{ {
"name": "slapdash", "name": "slapdash",
"version": "1.6.0", "version": "1.5.1",
"author": "Ayush Mukherjee", "author": "Ayush Mukherjee",
"description": "Dashboard for APL-Nuke cum APL-Boost data manager", "description": "Dashboard for APL-Nuke cum APL-Boost data manager",
"private": false, "private": false,
@ -14,26 +14,27 @@
}, },
"main": "background.js", "main": "background.js",
"dependencies": { "dependencies": {
"@tailwindcss/postcss7-compat": "^2.0.2",
"@vue/devtools": "^6.0.0-beta.6", "@vue/devtools": "^6.0.0-beta.6",
"autoprefixer": "^10", "autoprefixer": "^9",
"axios": "^1", "axios": "^0.21.1",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"postcss": "^8", "postcss": "^7",
"tailwindcss": "3.3.5", "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.2",
"vue": "^3.0.0", "vue": "^3.0.0",
"vue-router": "^4.0.0-0", "vue-router": "^4.0.0-0",
"ws": "^8" "ws": "^6.2.1"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "~5", "@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-router": "~5", "@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-service": "~5", "@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0", "@vue/compiler-sfc": "^3.0.0",
"electron": "^27.0.4", "electron": "^11.0.0",
"electron-devtools-installer": "^3.1.0", "electron-devtools-installer": "^3.1.0",
"sass": "^1.26.5", "sass": "^1.26.5",
"sass-loader": "^13", "sass-loader": "^8.0.2",
"vue-cli-plugin-electron-builder": "~2", "vue-cli-plugin-electron-builder": "~2.0.0-rc.6",
"vue-cli-plugin-tailwind": "~3" "vue-cli-plugin-tailwind": "~2.0.6"
} }
} }

@ -7,7 +7,6 @@ import path from 'path'
const isDevelopment = process.env.NODE_ENV !== 'production' const isDevelopment = process.env.NODE_ENV !== 'production'
import { start, status, stop, state, sub, sendAll } from './utils/server' import { start, status, stop, state, sub, sendAll } from './utils/server'
import { start as relayStart, status as relayStatus, stop as relayStop, state as relayState } from './utils/relay'
// Scheme must be registered before the app is ready // Scheme must be registered before the app is ready
protocol.registerSchemesAsPrivileged([ protocol.registerSchemesAsPrivileged([
@ -97,10 +96,6 @@ ipcMain.handle('status', async () => {
return status() return status()
}) })
ipcMain.handle('relayStatus', async () => {
return relayStatus()
})
ipcMain.handle('server', async (e, arg) => { ipcMain.handle('server', async (e, arg) => {
if (arg === true) { if (arg === true) {
start() start()
@ -109,14 +104,6 @@ ipcMain.handle('server', async (e, arg) => {
} }
}) })
ipcMain.handle('relay', async (e, arg) => {
if (arg === true) {
relayStart()
} else {
relayStop()
}
})
ipcMain.handle('massSend', async () => { ipcMain.handle('massSend', async () => {
console.log('Sending refreshed data') console.log('Sending refreshed data')
sendAll() sendAll()

@ -7,8 +7,6 @@
<tr> <tr>
<th class="border border-gray-400 text-left px-8 py-4">ID</th> <th class="border border-gray-400 text-left px-8 py-4">ID</th>
<th class="border border-gray-400 text-left px-8 py-4">Name</th> <th class="border border-gray-400 text-left px-8 py-4">Name</th>
<th class="border border-gray-400 text-left px-8 py-4">Name Arabic</th>
<th class="border border-gray-400 text-left px-8 py-4">Name Japanese</th>
<th class="border border-gray-400 text-left px-8 py-4">Event</th> <th class="border border-gray-400 text-left px-8 py-4">Event</th>
<th class="border border-gray-400 text-left px-8 py-4">Matches</th> <th class="border border-gray-400 text-left px-8 py-4">Matches</th>
</tr> </tr>
@ -17,8 +15,6 @@
<tr class="item" v-for="e in store.state.brackets" :key="e._id" :class="item === e._id ? 'active' : ''" @click="setItem(e)"> <tr class="item" v-for="e in store.state.brackets" :key="e._id" :class="item === e._id ? 'active' : ''" @click="setItem(e)">
<td class="border border-gray-400 text-left px-8 py-4">{{ e._id }}</td> <td class="border border-gray-400 text-left px-8 py-4">{{ e._id }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name }}</td> <td class="border border-gray-400 text-left px-8 py-4">{{ e.name }}</td>
<td class="border border-gray-400 text-left px-8 py-4" dir="rtl">{{ e.name_arabic ?? '' }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name_jpn ?? '' }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ store.state.events.filter(x => x._id === e.event)[0].name }}</td> <td class="border border-gray-400 text-left px-8 py-4">{{ store.state.events.filter(x => x._id === e.event)[0].name }}</td>
<td class="border border-gray-400 text-left"> <td class="border border-gray-400 text-left">
<table v-if="e.matches" class="border border-gray-400 border-collapse mx-auto w-full h-full"> <table v-if="e.matches" class="border border-gray-400 border-collapse mx-auto w-full h-full">
@ -34,14 +30,10 @@
</table> </table>
</div> </div>
<div> <div>
<h2 class="text-lg font-bold overflow-auto">Create / Update</h2> <h2 class="text-lg font-bold">Create / Update</h2>
<form name="form" @submit.prevent="form"> <form name="form" @submit.prevent="form">
<p class="mt-4">Bracket name</p> <p class="mt-4">Bracket name</p>
<input v-model="name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required /> <input v-model="name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required />
<p class="mt-4">Bracket name in arabic (optional)</p>
<input v-model="name_arabic" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" dir="rtl" />
<p class="mt-4">Bracket name in japanese (optional)</p>
<input v-model="name_jpn" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Event</p> <p class="mt-4">Event</p>
<select v-model="event" class="block my-4 border border-gray-500 rounded-lg bg-white w-64 h-8 px-4"> <select v-model="event" class="block my-4 border border-gray-500 rounded-lg bg-white w-64 h-8 px-4">
<option v-for="r in store.state.events" :key="r._id" :value="r._id">{{ r.name }}</option> <option v-for="r in store.state.events" :key="r._id" :value="r._id">{{ r.name }}</option>
@ -68,8 +60,6 @@ export default {
const item = ref('') const item = ref('')
const name = ref('') const name = ref('')
const name_arabic = ref('')
const name_jpn = ref('')
const event = ref('') const event = ref('')
const matches = ref([]) const matches = ref([])
@ -81,8 +71,6 @@ export default {
reset() reset()
item.value = e._id item.value = e._id
name.value = e.name name.value = e.name
name_arabic.value = e.name_arabic
name_jpn.value = e.name_jpn
event.value = e.event event.value = e.event
e.matches.forEach(m => { e.matches.forEach(m => {
if (matches.value.length !== e.matches.length) { if (matches.value.length !== e.matches.length) {
@ -94,8 +82,6 @@ export default {
const reset = () => { const reset = () => {
item.value = '' item.value = ''
name.value = '' name.value = ''
name_arabic.value = ''
name_jpn.value = ''
event.value = '' event.value = ''
matches.value = [] matches.value = []
} }
@ -104,16 +90,12 @@ export default {
if (item.value !== '') { if (item.value !== '') {
update('brackets', item.value, { update('brackets', item.value, {
name: name.value, name: name.value,
name_arabic: name_arabic.value,
name_jpn: name_jpn.value,
event: event.value, event: event.value,
matches: matches.value, matches: matches.value,
}) })
} else if (name.value !== '') { } else if (name.value !== '') {
create('brackets', { create('brackets', {
name: name.value, name: name.value,
name_arabic: name_arabic.value,
name_jpn: name_jpn.value,
event: event.value, event: event.value,
matches: matches.value, matches: matches.value,
}) })
@ -132,8 +114,6 @@ export default {
store, store,
item, item,
name, name,
name_arabic,
name_jpn,
event, event,
matches, matches,
setItem, setItem,
@ -152,4 +132,4 @@ export default {
.item.active { .item.active {
@apply bg-gray-400; @apply bg-gray-400;
} }
</style> </style>

@ -1,30 +1,24 @@
<template> <template>
<h1 class="text-2xl font-bold uppercase mb-10">casters management</h1> <h1 class="text-2xl font-bold uppercase mb-10">casters management</h1>
<div class="grid grid-cols-2 gap-x-8"> <div class="grid grid-cols-2 gap-x-8">
<div class="overflow-x-auto"> <table class="table-auto">
<table class="table-auto"> <thead>
<thead> <tr>
<tr> <th class="border border-gray-400 text-left px-8 py-4">Name Tag</th>
<th class="border border-gray-400 text-left px-8 py-4">Name Tag</th> <th class="border border-gray-400 text-left px-8 py-4">Real Name</th>
<th class="border border-gray-400 text-left px-8 py-4">Real Name</th> <th class="border border-gray-400 text-left px-8 py-4">Twitter</th>
<th class="border border-gray-400 text-left px-8 py-4">Real Name Arabic</th> <th class="border border-gray-400 text-left px-8 py-4">Image</th>
<th class="border border-gray-400 text-left px-8 py-4">Real Name Japanese</th> </tr>
<th class="border border-gray-400 text-left px-8 py-4">Twitter</th> </thead>
<th class="border border-gray-400 text-left px-8 py-4">Image</th> <tbody>
</tr> <tr class="item" :class="item === e._id ? 'active' : ''" @click="setItem(e)" v-for="e in store.state.casters" :key="e._id">
</thead> <td class="border border-gray-400 text-left px-8 py-4">{{ e.username }}</td>
<tbody> <td class="border border-gray-400 text-left px-8 py-4">{{ e.name }}</td>
<tr class="item" :class="item === e._id ? 'active' : ''" @click="setItem(e)" v-for="e in store.state.casters" :key="e._id"> <td class="border border-gray-400 text-left px-8 py-4">{{ e.twitter }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.username }}</td> <td class="border border-gray-400 text-left px-8 py-4"><img :src="e.image" :alt="e.name"></td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name }}</td> </tr>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name_arabic ?? '' }}</td> </tbody>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name_jpn ?? '' }}</td> </table>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.twitter }}</td>
<td class="border border-gray-400 text-left px-8 py-4"><img :src="e.image" :alt="e.name"></td>
</tr>
</tbody>
</table>
</div>
<div> <div>
<h2 class="text-lg font-bold">Create / Update</h2> <h2 class="text-lg font-bold">Create / Update</h2>
<form name="form" @submit.prevent="form"> <form name="form" @submit.prevent="form">
@ -32,10 +26,6 @@
<input v-model="username" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required /> <input v-model="username" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required />
<p class="mt-4">Caster real name</p> <p class="mt-4">Caster real name</p>
<input v-model="name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required /> <input v-model="name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required />
<p class="mt-4">Caster real name arabic (optional)</p>
<input v-model="name_arabic" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Caster real name japanese (optional)</p>
<input v-model="name_jpn" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Caster twitter</p> <p class="mt-4">Caster twitter</p>
<input v-model="twitter" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required /> <input v-model="twitter" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required />
<p class="mt-4">Caster image URL</p> <p class="mt-4">Caster image URL</p>
@ -58,8 +48,6 @@ export default {
const item = ref('') const item = ref('')
const username = ref('') const username = ref('')
const name = ref('') const name = ref('')
const name_arabic = ref('')
const name_jpn = ref('')
const twitter = ref('') const twitter = ref('')
const image = ref('') const image = ref('')
@ -67,8 +55,6 @@ export default {
item.value = '' item.value = ''
username.value = '' username.value = ''
name.value = '' name.value = ''
name_arabic.value = ''
name_jpn.value = ''
twitter.value = '' twitter.value = ''
image.value = '' image.value = ''
} }
@ -77,8 +63,6 @@ export default {
item.value = e._id item.value = e._id
username.value = e.username username.value = e.username
name.value = e.name name.value = e.name
name_arabic.value = e.name_arabic
name_jpn.value = e.name_jpn
twitter.value = e.twitter twitter.value = e.twitter
image.value = e.image image.value = e.image
} }
@ -88,8 +72,6 @@ export default {
update('casters', item.value, { update('casters', item.value, {
username: username.value, username: username.value,
name: name.value, name: name.value,
name_arabic: name_arabic.value,
name_jpn: name_jpn.value,
twitter: twitter.value, twitter: twitter.value,
image: image.value, image: image.value,
}) })
@ -97,8 +79,6 @@ export default {
create('casters', { create('casters', {
username: username.value, username: username.value,
name: name.value, name: name.value,
name_arabic: name_arabic.value,
name_jpn: name_jpn.value,
twitter: twitter.value, twitter: twitter.value,
image: image.value, image: image.value,
}) })
@ -118,8 +98,6 @@ export default {
item, item,
username, username,
name, name,
name_arabic,
name_jpn,
twitter, twitter,
image, image,
setItem, setItem,

@ -1,35 +1,25 @@
<template> <template>
<h1 class="text-2xl font-bold uppercase mb-10">events management</h1> <h1 class="text-2xl font-bold uppercase mb-10">events management</h1>
<div class="grid grid-cols-2 gap-x-8"> <div class="grid grid-cols-2 gap-x-8">
<div class="overflow-x-auto"> <table class="table-auto">
<table class="table-auto"> <thead>
<thead> <tr>
<tr> <th class="border border-gray-400 text-left px-8 py-4">ID</th>
<th class="border border-gray-400 text-left px-8 py-4">ID</th> <th class="border border-gray-400 text-left px-8 py-4">Name</th>
<th class="border border-gray-400 text-left px-8 py-4">Name</th> </tr>
<th class="border border-gray-400 text-left px-8 py-4">Arabic Name</th> </thead>
<th class="border border-gray-400 text-left px-8 py-4">Japanese Name</th> <tbody>
</tr> <tr class="item" :class="item === e._id ? 'active' : ''" @click="setItem(e)" v-for="e in store.state.events" :key="e._id">
</thead> <td class="border border-gray-400 text-left px-8 py-4">{{ e._id }}</td>
<tbody> <td class="border border-gray-400 text-left px-8 py-4">{{ e.name }}</td>
<tr class="item" :class="item === e._id ? 'active' : ''" @click="setItem(e)" v-for="e in store.state.events" :key="e._id"> </tr>
<td class="border border-gray-400 text-left px-8 py-4">{{ e._id }}</td> </tbody>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name }}</td> </table>
<td class="border border-gray-400 text-left px-8 py-4 rtl" dir="rtl">{{ e.name_arabic ?? '' }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name_jpn ?? '' }}</td>
</tr>
</tbody>
</table>
</div>
<div> <div>
<h2 class="text-lg font-bold">Create / Update</h2> <h2 class="text-lg font-bold">Create / Update</h2>
<form name="form" @submit.prevent="form"> <form name="form" @submit.prevent="form">
<p class="mt-4">Event name</p> <p class="mt-4">Event name</p>
<input v-model="name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required /> <input v-model="name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required />
<p class="mt-4">Event name in arabic (optional)</p>
<input v-model="name_arabic" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" dir="rtl" />
<p class="mt-4">Event name in japanese (optional)</p>
<input v-model="name_jpn" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<button class="block w-64 h-10 text-white bg-red-700 rounded-lg hover:bg-red-600">Submit</button> <button class="block w-64 h-10 text-white bg-red-700 rounded-lg hover:bg-red-600">Submit</button>
<button @click.prevent="delForm" v-if="item" class="block mt-4 w-64 h-10 text-white bg-red-700 rounded-lg hover:bg-red-600">Delete</button> <button @click.prevent="delForm" v-if="item" class="block mt-4 w-64 h-10 text-white bg-red-700 rounded-lg hover:bg-red-600">Delete</button>
</form> </form>
@ -47,14 +37,10 @@ export default {
const item = ref('') const item = ref('')
const name = ref('') const name = ref('')
const name_arabic = ref('')
const name_jpn = ref('')
const setItem = (e) => { const setItem = (e) => {
item.value = e._id item.value = e._id
name.value = e.name name.value = e.name
name_arabic.value = e.name_arabic
name_jpn.value = e.name_jpn
} }
const reset = () => { const reset = () => {
@ -66,14 +52,10 @@ export default {
if (item.value !== '') { if (item.value !== '') {
update('events', item.value, { update('events', item.value, {
name: name.value, name: name.value,
name_arabic: name_arabic.value,
name_jpn: name_jpn.value,
}) })
} else if (name.value !== '' && name_arabic.value !== '' && name_jpn.value !== '') { } else if (name.value !== '') {
create('events', { create('events', {
name: name.value, name: name.value,
name_arabic: name_arabic.value,
name_jpn: name_jpn.value,
}) })
} }
reset() reset()
@ -90,8 +72,6 @@ export default {
store, store,
item, item,
name, name,
name_arabic,
name_jpn,
setItem, setItem,
form, form,
delForm, delForm,

@ -6,8 +6,6 @@
<thead> <thead>
<tr> <tr>
<th class="border border-gray-400 text-left px-8 py-4">Round name</th> <th class="border border-gray-400 text-left px-8 py-4">Round name</th>
<th class="border border-gray-400 text-left px-8 py-4">Round arabic</th>
<th class="border border-gray-400 text-left px-8 py-4">Round japanese</th>
<th class="border border-gray-400 text-left px-8 py-4">Blue</th> <th class="border border-gray-400 text-left px-8 py-4">Blue</th>
<th class="border border-gray-400 text-left px-8 py-4">Orange</th> <th class="border border-gray-400 text-left px-8 py-4">Orange</th>
<th class="border border-gray-400 text-left px-8 py-4">Current</th> <th class="border border-gray-400 text-left px-8 py-4">Current</th>
@ -22,8 +20,6 @@
<tbody> <tbody>
<tr class="item" :class="item === e._id ? 'active' : ''" @click="setItem(e)" v-for="e in store.state.matches" :key="e._id"> <tr class="item" :class="item === e._id ? 'active' : ''" @click="setItem(e)" v-for="e in store.state.matches" :key="e._id">
<td class="border border-gray-400 text-left px-8 py-4">{{ e.type }}</td> <td class="border border-gray-400 text-left px-8 py-4">{{ e.type }}</td>
<td class="border border-gray-400 text-left px-8 py-4" dir="rtl">{{ e.type_arabic ?? '' }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.type_jpn ?? '' }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.blue.name }}</td> <td class="border border-gray-400 text-left px-8 py-4">{{ e.blue.name }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.orange.name }}</td> <td class="border border-gray-400 text-left px-8 py-4">{{ e.orange.name }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.current }}</td> <td class="border border-gray-400 text-left px-8 py-4">{{ e.current }}</td>
@ -51,10 +47,6 @@
<form name="form" @submit.prevent="form"> <form name="form" @submit.prevent="form">
<p class="mt-4">Round name</p> <p class="mt-4">Round name</p>
<input v-model="type" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required /> <input v-model="type" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required />
<p class="mt-4">Round name in arabic (optional)</p>
<input v-model="type_arabic" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" dir="rtl" />
<p class="mt-4">Round name in japanese (optional)</p>
<input v-model="type_jpn" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Blue team</p> <p class="mt-4">Blue team</p>
<select v-model="blue" class="block my-4 border border-gray-500 rounded-lg bg-white w-64 h-8 px-4"> <select v-model="blue" class="block my-4 border border-gray-500 rounded-lg bg-white w-64 h-8 px-4">
<option v-for="r in store.state.rosters" :key="r._id" :value="r._id">{{ r.name }}</option> <option v-for="r in store.state.rosters" :key="r._id" :value="r._id">{{ r.name }}</option>
@ -104,8 +96,6 @@ export default {
const item = ref('') const item = ref('')
const type = ref('') const type = ref('')
const type_arabic = ref('')
const type_jpn = ref('')
const blue = ref('') const blue = ref('')
const orange = ref('') const orange = ref('')
const current = ref(false) const current = ref(false)
@ -121,8 +111,6 @@ export default {
const setItem = (e) => { const setItem = (e) => {
item.value = e._id item.value = e._id
type.value = e.type type.value = e.type
type_arabic.value = e.type_arabic
type_jpn.value = e.type_jpn
blue.value = e.blue._id blue.value = e.blue._id
orange.value = e.orange orange.value = e.orange
current.value = e.current current.value = e.current
@ -139,8 +127,6 @@ export default {
const resetf = () => { const resetf = () => {
item.value = '' item.value = ''
type.value = '' type.value = ''
type_arabic.value = ''
type_jpn.value = ''
blue.value = '' blue.value = ''
orange.value = '' orange.value = ''
current.value = false current.value = false
@ -158,8 +144,6 @@ export default {
if (item.value !== '') { if (item.value !== '') {
update('matches', item.value, { update('matches', item.value, {
type: type.value, type: type.value,
type_arabic: type_arabic.value,
type_jpn: type_jpn.value,
blue: blue.value, blue: blue.value,
orange: orange.value, orange: orange.value,
current: current.value, current: current.value,
@ -179,8 +163,6 @@ export default {
} else if (type.value !== '') { } else if (type.value !== '') {
create('matches', { create('matches', {
type: type.value, type: type.value,
type_arabic: type_arabic.value,
type_jpn: type_jpn.value,
blue: blue.value, blue: blue.value,
orange: orange.value, orange: orange.value,
current: current.value, current: current.value,
@ -203,8 +185,6 @@ export default {
store, store,
item, item,
type, type,
type_arabic,
type_jpn,
blue, blue,
orange, orange,
blueSeries, blueSeries,

@ -1,45 +1,35 @@
<template> <template>
<h1 class="text-2xl font-bold uppercase mb-10">rosters management</h1> <h1 class="text-2xl font-bold uppercase mb-10">rosters management</h1>
<div class="grid grid-cols-2 gap-x-8"> <div class="grid grid-cols-2 gap-x-8">
<div class="overflow-x-auto"> <table class="table-auto">
<table class="table-auto"> <thead>
<thead> <tr>
<tr> <th class="border border-gray-400 text-left px-8 py-4">Name</th>
<th class="border border-gray-400 text-left px-8 py-4">Name</th> <th class="border border-gray-400 text-left px-8 py-4">Logo</th>
<th class="border border-gray-400 text-left px-8 py-4">Name Arabic</th> <th class="border border-gray-400 text-left px-8 py-4">Players</th>
<th class="border border-gray-400 text-left px-8 py-4">Name Japanese</th> </tr>
<th class="border border-gray-400 text-left px-8 py-4">Logo</th> </thead>
<th class="border border-gray-400 text-left px-8 py-4">Players</th> <tbody>
</tr> <tr class="item" :class="item === e._id ? 'active' : ''" @click="setItem(e)" v-for="e in store.state.rosters" :key="e._id">
</thead> <td class="border border-gray-400 text-left px-8 py-4">{{ e.name }}</td>
<tbody> <td class="border border-gray-400 text-left px-8 py-4"><img class="w-12 h-12" :src="e.logo" :alt="e.name"></td>
<tr class="item" :class="item === e._id ? 'active' : ''" @click="setItem(e)" v-for="e in store.state.rosters" :key="e._id"> <td class="border border-gray-400 text-left px-8 py-4">
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name }}</td> <table v-if="e.players">
<td class="border border-gray-400 text-left px-8 py-4" dir="rtl">{{ e.name_arabic ?? '' }}</td> <tbody>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name_jpn ?? '' }}</td> <tr v-for="p in e.players" :key="p._id">
<td class="border border-gray-400 text-left px-8 py-4"><img class="w-12 h-12" :src="e.logo" :alt="e.name"></td> <td>{{ p.name }}: {{ p.account }}</td>
<td class="border border-gray-400 text-left px-8 py-4"> </tr>
<table v-if="e.players"> </tbody>
<tbody> </table>
<tr v-for="p in e.players" :key="p._id"> </td>
<td>{{ p.name }}: {{ p.account }}</td> </tr>
</tr> </tbody>
</tbody> </table>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div> <div>
<h2 class="text-lg font-bold">Create / Update</h2> <h2 class="text-lg font-bold">Create / Update</h2>
<form name="form" @submit.prevent="form"> <form name="form" @submit.prevent="form">
<p class="mt-4">Roster name</p> <p class="mt-4">Roster name</p>
<input v-model="name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required /> <input v-model="name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required />
<p class="mt-4">Roster name in arabic (optional)</p>
<input v-model="name_arabic" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" dir="rtl" />
<p class="mt-4">Roster name in japanese (optional)</p>
<input v-model="name_jpn" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Roster logo</p> <p class="mt-4">Roster logo</p>
<input v-model="logo" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required /> <input v-model="logo" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required />
<fieldset v-for="(n, i) in playersLocal.length" :key="i" class="border border-gray-400 rounded px-6 my-4"> <fieldset v-for="(n, i) in playersLocal.length" :key="i" class="border border-gray-400 rounded px-6 my-4">
@ -67,8 +57,6 @@ export default {
const item = ref('') const item = ref('')
const name = ref('') const name = ref('')
const name_arabic = ref('')
const name_jpn = ref('')
const logo = ref('') const logo = ref('')
const playersLocal = ref([]) const playersLocal = ref([])
@ -77,8 +65,6 @@ export default {
const setItem = (e) => { const setItem = (e) => {
item.value = e._id item.value = e._id
name.value = e.name name.value = e.name
name_arabic.value = e.name_arabic
name_jpn.value = e.name_jpn
logo.value = e.logo logo.value = e.logo
e.players.forEach(p => { e.players.forEach(p => {
if (playersLocal.value.length !== e.players.length) { if (playersLocal.value.length !== e.players.length) {
@ -105,8 +91,6 @@ export default {
const reset = () => { const reset = () => {
item.value = '' item.value = ''
name.value = '' name.value = ''
name_arabic.value = ''
name_jpn.value = ''
logo.value = '' logo.value = ''
playersLocal.value = [] playersLocal.value = []
} }
@ -115,16 +99,12 @@ export default {
if (item.value !== '') { if (item.value !== '') {
update('rosters', item.value, { update('rosters', item.value, {
name: name.value, name: name.value,
name_arabic: name_arabic.value,
name_jpn: name_jpn.value,
logo: logo.value, logo: logo.value,
players: playersLocal.value, players: playersLocal.value,
}) })
} else if (name.value !== '') { } else if (name.value !== '') {
create('rosters', { create('rosters', {
name: name.value, name: name.value,
name_arabic: name_arabic.value,
name_jpn: name_jpn.value,
logo: logo.value, logo: logo.value,
players: playersLocal.value, players: playersLocal.value,
}) })
@ -143,8 +123,6 @@ export default {
store, store,
item, item,
name, name,
name_arabic,
name_jpn,
logo, logo,
playersLocal, playersLocal,
setItem, setItem,

@ -1,231 +0,0 @@
<template>
<h1 class="text-2xl font-bold uppercase mb-10">stats management</h1>
<div class="grid grid-cols-2 gap-x-8">
<div class="overflow-x-auto">
<table class="table-auto">
<thead>
<tr>
<th class="border border-gray-400 text-left px-8 py-4">Player Name</th>
<th class="border border-gray-400 text-left px-8 py-4">Player Name Arabic</th>
<th class="border border-gray-400 text-left px-8 py-4">Player Name Japanese</th>
<th class="border border-gray-400 text-left px-8 py-4">Image</th>
<th class="border border-gray-400 text-left px-8 py-4">Image Full?</th>
<th class="border border-gray-400 text-left px-8 py-4">Win Title</th>
<th class="border border-gray-400 text-left px-8 py-4">Win %</th>
<th class="border border-gray-400 text-left px-8 py-4">Goals Title</th>
<th class="border border-gray-400 text-left px-8 py-4">Goals</th>
<th class="border border-gray-400 text-left px-8 py-4">Shots Title</th>
<th class="border border-gray-400 text-left px-8 py-4">Shots</th>
<th class="border border-gray-400 text-left px-8 py-4">Saves Title</th>
<th class="border border-gray-400 text-left px-8 py-4">Saves</th>
<th class="border border-gray-400 text-left px-8 py-4">Assists Title</th>
<th class="border border-gray-400 text-left px-8 py-4">Assists</th>
</tr>
</thead>
<tbody>
<tr class="item" :class="item === e._id ? 'active' : ''" @click="setItem(e)" v-for="e in store.state.stats" :key="e._id">
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name }}</td>
<td class="border border-gray-400 text-left px-8 py-4" dir="rtl">{{ e.name_arabic ?? '' }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name_jpn ?? '' }}</td>
<td class="border border-gray-400 text-left px-8 py-4"><img :src="e.image" :alt="e.name"></td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.image_full }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.win_name }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.win }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.goals_name }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.goals }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.shots_name }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.shots }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.saves_name }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.saves }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.assists_name }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.assists }}</td>
</tr>
</tbody>
</table>
</div>
<div>
<h2 class="text-lg font-bold">Create / Update</h2>
<form name="form" @submit.prevent="form">
<p class="mt-4">Player Name</p>
<input v-model="name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required />
<p class="mt-4">Player name arabic (optional)</p>
<input v-model="name_arabic" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Player name japanese (optional)</p>
<input v-model="name_jpn" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Image URL</p>
<input v-model="image" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Image Full Size?</p>
<input v-model="image_full" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="checkbox" />
<p class="mt-4">Win Title</p>
<input v-model="win_name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Win %</p>
<input v-model="win" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Goals Title</p>
<input v-model="goals_name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Goals</p>
<input v-model="goals" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Shots Title</p>
<input v-model="shots_name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Shots</p>
<input v-model="shots" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Saves Title</p>
<input v-model="saves_name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Saves</p>
<input v-model="saves" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Assists Title</p>
<input v-model="assists_name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Assists</p>
<input v-model="assists" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<button class="block w-64 h-10 text-white bg-red-700 rounded-lg hover:bg-red-600">Submit</button>
<button @click.prevent="delForm" v-if="item" class="block mt-4 w-64 h-10 text-white bg-red-700 rounded-lg hover:bg-red-600">Delete</button>
</form>
</div>
</div>
</template>
<script>
import { inject, ref } from 'vue'
import { create, update, del } from '../utils/websocket'
export default {
setup() {
const store = inject('store')
const item = ref('')
const name = ref('')
const name_arabic = ref('')
const name_jpn = ref('')
const image = ref('')
const image_full = ref(false)
const win_name = ref('')
const win = ref('')
const goals_name = ref('')
const goals = ref('')
const shots_name = ref('')
const shots = ref('')
const saves_name = ref('')
const saves = ref('')
const assists_name = ref('')
const assists = ref('')
const reset = () => {
item.value = ''
name.value = ''
name_arabic.value = ''
name_jpn.value = ''
image.value = ''
image_full.value = false
win_name.value = ''
win.value = ''
goals_name.value = ''
goals.value = ''
shots_name.value = ''
shots.value = ''
saves_name.value = ''
saves.value = ''
assists_name.value = ''
assists.value = ''
}
const setItem = (e) => {
item.value = e._id
name.value = e.name
name_arabic.value = e.name_arabic
name_jpn.value = e.name_jpn
image.value = e.image
image_full.value = e.image_full
win_name.value = e.win_name
win.value = e.win
goals_name.value = e.goals_name
goals.value = e.goals
shots_name.value = e.shots
shots.value = e.shots
saves_name.value = e.saves_name
saves.value = e.saves
assists_name.value = e.assists_name
assists.value = e.assists
}
const form = () => {
if (item.value !== '') {
update('stats', item.value, {
name: name.value,
name_arabic: name_arabic.value,
name_jpn: name_jpn.value,
image: image.value,
image_full: image_full.value,
win_name: win_name.value,
win: win.value,
goals_name: goals_name.value,
goals: goals.value,
shots_name: shots_name.value,
shots: shots.value,
saves_name: saves_name.value,
saves: saves.value,
assists_name: assists_name.value,
assists: assists.value,
})
} else if (name.value !== '') {
create('stats', {
name: name.value,
name_arabic: name_arabic.value,
name_jpn: name_jpn.value,
image: image.value,
image_full: image_full.value,
win_name: win_name.value,
win: win.value,
goals_name: goals_name.value,
goals: goals.value,
shots_name: shots_name.value,
shots: shots.value,
saves_name: saves_name.value,
saves: saves.value,
assists_name: assists_name.value,
assists: assists.value,
})
}
reset()
}
const delForm = () => {
if (item.value) {
del('stats', item.value)
reset()
}
}
return {
store,
item,
name,
name_arabic,
name_jpn,
image,
image_full,
win_name,
win,
goals_name,
goals,
shots_name,
shots,
saves_name,
saves,
assists_name,
assists,
setItem,
form,
delForm,
}
},
}
</script>
<style>
.item:hover {
@apply bg-gray-300 cursor-pointer;
}
.item.active {
@apply bg-gray-400;
}
</style>

@ -7,20 +7,16 @@
<tr> <tr>
<th class="border border-gray-400 text-left px-8 py-4">ID</th> <th class="border border-gray-400 text-left px-8 py-4">ID</th>
<th class="border border-gray-400 text-left px-8 py-4">Name</th> <th class="border border-gray-400 text-left px-8 py-4">Name</th>
<th class="border border-gray-400 text-left px-8 py-4">Arabic Name</th>
<th class="border border-gray-400 text-left px-8 py-4">Japanese Name</th>
<th class="border border-gray-400 text-left px-8 py-4">Event</th> <th class="border border-gray-400 text-left px-8 py-4">Event</th>
<th class="border border-gray-400 text-left px-8 py-4">Matches</th> <th class="border border-gray-400 text-left px-8 py-4">Matches</th>
<th class="border border-gray-400 text-left px-8 py-4">Casters</th> <th class="border border-gray-400 text-left px-8 py-4">Casters</th>
<th class="border border-gray-400 text-left px-8 py-4">Stats</th> <th class="border border-gray-400 text-left px-8 py-4">Hosts</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr class="item" v-for="e in store.state.streams" :key="e._id" :class="item === e._id ? 'active' : ''" @click="setItem(e)"> <tr class="item" v-for="e in store.state.streams" :key="e._id" :class="item === e._id ? 'active' : ''" @click="setItem(e)">
<td class="border border-gray-400 text-left px-8 py-4">{{ e._id }}</td> <td class="border border-gray-400 text-left px-8 py-4">{{ e._id }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name }}</td> <td class="border border-gray-400 text-left px-8 py-4">{{ e.name }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name_arabic ?? '' }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ e.name_jpn ?? '' }}</td>
<td class="border border-gray-400 text-left px-8 py-4">{{ store.state.events.filter(x => x._id === e.event)[0].name }}</td> <td class="border border-gray-400 text-left px-8 py-4">{{ store.state.events.filter(x => x._id === e.event)[0].name }}</td>
<td class="border border-gray-400 text-left"> <td class="border border-gray-400 text-left">
<table v-if="e.matches" class="border border-gray-400 border-collapse mx-auto w-full h-full"> <table v-if="e.matches" class="border border-gray-400 border-collapse mx-auto w-full h-full">
@ -41,10 +37,10 @@
</table> </table>
</td> </td>
<td class="border border-gray-400 text-left px-8 py-4"> <td class="border border-gray-400 text-left px-8 py-4">
<table v-if="e.stats"> <table v-if="e.hosts">
<tbody> <tbody>
<tr v-for="p in e.stats" :key="p"> <tr v-for="p in e.hosts" :key="p">
<td class="border border-gray-400">{{ store.state.stats.filter(x => x._id === p)[0]?.name }}</td> <td>{{ store.state.casters.filter(x => x._id === p)[0]?.name }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -58,10 +54,6 @@
<form name="form" @submit.prevent="form"> <form name="form" @submit.prevent="form">
<p class="mt-4">Stream name</p> <p class="mt-4">Stream name</p>
<input v-model="name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required /> <input v-model="name" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" required />
<p class="mt-4">Stream name in arabic (optional)</p>
<input v-model="name_arabic" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" dir="rtl" />
<p class="mt-4">Stream name in japanese (optional)</p>
<input v-model="name_jpn" class="block my-4 border border-gray-500 rounded-lg w-64 h-8 px-4" type="text" />
<p class="mt-4">Event</p> <p class="mt-4">Event</p>
<select v-model="event" class="block my-4 border border-gray-500 rounded-lg bg-white w-64 h-8 px-4"> <select v-model="event" class="block my-4 border border-gray-500 rounded-lg bg-white w-64 h-8 px-4">
<option v-for="r in store.state.events" :key="r._id" :value="r._id">{{ r.name }}</option> <option v-for="r in store.state.events" :key="r._id" :value="r._id">{{ r.name }}</option>
@ -76,11 +68,11 @@
<option v-for="r in store.state.casters" :key="r._id" :value="r._id">{{ r.name }}</option> <option v-for="r in store.state.casters" :key="r._id" :value="r._id">{{ r.name }}</option>
</select> </select>
<button @click.prevent="addCaster()" class="block w-64 h-10 my-4 text-white bg-red-700 rounded-lg hover:bg-red-600">Add caster</button> <button @click.prevent="addCaster()" class="block w-64 h-10 my-4 text-white bg-red-700 rounded-lg hover:bg-red-600">Add caster</button>
<p class="mt-4">Stats</p> <p class="mt-4">Hosts</p>
<select v-for="(n, i) in hosts.length" :key="i" v-model="hosts[n - 1]" class="block my-4 border border-gray-500 rounded-lg bg-white w-64 h-8 px-4"> <select v-for="(n, i) in hosts.length" :key="i" v-model="hosts[n - 1]" class="block my-4 border border-gray-500 rounded-lg bg-white w-64 h-8 px-4">
<option v-for="r in store.state.stats" :key="r._id" :value="r._id" :selected="hosts[i] == r._id">{{ r.name }}</option> <option v-for="r in store.state.casters" :key="r._id" :value="r._id">{{ r.name }}</option>
</select> </select>
<button @click.prevent="addHost()" class="block w-64 h-10 my-4 text-white bg-red-700 rounded-lg hover:bg-red-600">Add Stat</button> <button @click.prevent="addHost()" class="block w-64 h-10 my-4 text-white bg-red-700 rounded-lg hover:bg-red-600">Add host</button>
<button class="block w-64 h-10 text-white bg-red-700 rounded-lg hover:bg-red-600">Submit</button> <button class="block w-64 h-10 text-white bg-red-700 rounded-lg hover:bg-red-600">Submit</button>
<button @click.prevent="delForm" v-if="item" class="block mt-4 w-64 h-10 text-white bg-red-700 rounded-lg hover:bg-red-600">Delete</button> <button @click.prevent="delForm" v-if="item" class="block mt-4 w-64 h-10 text-white bg-red-700 rounded-lg hover:bg-red-600">Delete</button>
</form> </form>
@ -98,8 +90,6 @@ export default {
const item = ref('') const item = ref('')
const name = ref('') const name = ref('')
const name_arabic = ref('')
const name_jpn = ref('')
const event = ref('') const event = ref('')
const matches = ref([]) const matches = ref([])
const casters = ref([]) const casters = ref([])
@ -121,8 +111,6 @@ export default {
reset() reset()
item.value = e._id item.value = e._id
name.value = e.name name.value = e.name
name_arabic.value = e.name_arabic
name_jpn.value = e.name_jpn
event.value = e.event event.value = e.event
e.matches.forEach(m => { e.matches.forEach(m => {
if (matches.value.length !== e.matches.length) { if (matches.value.length !== e.matches.length) {
@ -134,8 +122,8 @@ export default {
casters.value.push(m) casters.value.push(m)
} }
}) })
e.stats.forEach(m => { e.hosts.forEach(m => {
if (hosts.value.length !== e.stats.length) { if (hosts.value.length !== e.hosts.length) {
hosts.value.push(m) hosts.value.push(m)
} }
}) })
@ -144,8 +132,6 @@ export default {
const reset = () => { const reset = () => {
item.value = '' item.value = ''
name.value = '' name.value = ''
name_arabic.value = ''
name_jpn.value = ''
event.value = '' event.value = ''
matches.value = [] matches.value = []
casters.value = [] casters.value = []
@ -156,22 +142,18 @@ export default {
if (item.value !== '') { if (item.value !== '') {
update('streams', item.value, { update('streams', item.value, {
name: name.value, name: name.value,
name_arabic: name_arabic.value,
name_jpn: name_jpn.value,
event: event.value, event: event.value,
matches: matches.value, matches: matches.value,
casters: casters.value, casters: casters.value,
stats: hosts.value, hosts: hosts.value,
}) })
} else if (name.value !== '') { } else if (name.value !== '') {
create('streams', { create('streams', {
name: name.value, name: name.value,
name_arabic: name_arabic.value,
name_jpn: name_jpn.value,
event: event.value, event: event.value,
matches: matches.value, matches: matches.value,
casters: casters.value, casters: casters.value,
stats: hosts.value, hosts: hosts.value,
}) })
} }
reset() reset()
@ -188,8 +170,6 @@ export default {
store, store,
item, item,
name, name,
name_arabic,
name_jpn,
event, event,
matches, matches,
casters, casters,

@ -1,7 +1,3 @@
import { contextBridge, ipcRenderer } from 'electron' import { ipcRenderer } from 'electron'
contextBridge.exposeInMainWorld('ipcRenderer', {
invoke: (a, b = null) => ipcRenderer.invoke(a, b),
on: (a, b = null) => ipcRenderer.on(a, b),
})
window.ipcRenderer = ipcRenderer

@ -4,9 +4,7 @@ import { handleMsg, sendSub } from './utils/websocket'
const token = window.localStorage.getItem('token') const token = window.localStorage.getItem('token')
const server = process.env.VUE_APP_NUKE_URI const server = 'slap.aplesports.com:5000'
const api_proto = process.env.VUE_APP_NUKE_API_PROTO
const ws_proto = process.env.VUE_APP_NUKE_WS_PROTO
const state = reactive({ const state = reactive({
name: '', name: '',
@ -19,13 +17,11 @@ const state = reactive({
matches: [], matches: [],
casters: [], casters: [],
hosts: [], hosts: [],
stats: [],
streams: [], streams: [],
streamsFull: [], streamsFull: [],
brackets: [], brackets: [],
overlayStream: null, overlayStream: null,
server: false, server: false,
relay: false,
}) })
let interval = 0 let interval = 0
@ -34,7 +30,7 @@ const methods = {
authenticate: async (token) => { authenticate: async (token) => {
state.session = null state.session = null
window.localStorage.setItem('token', token) window.localStorage.setItem('token', token)
return axios.post(`${api_proto}://${server}/api/v1`, { return axios.post(`http://${server}/api/v1`, {
token, token,
}) })
.then((res) => { .then((res) => {
@ -46,7 +42,7 @@ const methods = {
}, },
connect: () => { connect: () => {
if (state.session !== null) { if (state.session !== null) {
state.ws = new WebSocket(`${ws_proto}://${server}/ws/${state.session}`) state.ws = new WebSocket(`ws://${server}/ws/${state.session}`)
state.ws.onopen = () => { state.ws.onopen = () => {
clearInterval(interval) clearInterval(interval)
sendSub(state.ws) sendSub(state.ws)
@ -74,4 +70,4 @@ const methods = {
export default { export default {
state, state,
methods, methods,
} }

@ -1,108 +0,0 @@
import ws from 'ws'
import { v4 } from 'uuid'
let relay = null
let rl = null
const connections = {}
export const sub = []
let overlayStream = null
export const state = (data) => {
overlayStream = data
}
export const start = () => {
console.warn('RELAY SERVER STARTED.')
relay = new ws.Server({
port: 49322,
})
relay.on('connection', handle)
rl = new ws.WebSocket('ws://localhost:49122')
rl.onopen = () => {
console.warn('RL connected at ws://localhost:49122');
}
rl.onclose = () => {
console.warn('Lost connection to RL, not retrying');
if (relay) {
stop()
}
rl = null
}
rl.on('message', (e) => {
console.warn('Received event from RL')
Object.values(connections).forEach(v => {
const d = JSON.parse(e)
v.send(JSON.stringify(d));
})
})
}
export const stop = () => {
console.log('Received relay stop')
Object.keys(connections).forEach((k) => {
delete connections[k]
})
relay.close(() => {
relay = null
})
console.warn('RELAY SERVER CLOSED')
}
export const status = () => {
if (relay !== null)
return true
return false
}
export const sendAll = () => {
Object.values(connections).forEach(v => {
sendData(v)
})
}
const handle = (w) => {
console.warn('NEW RELAY CONNECTION')
const id = v4()
connections[id] = w
sendData(w)
w.on('message', msg => console.log(msg))
w.on('close', () => {
delete connections[id]
})
}
const onMsg = (msg, id) => {
const d = JSON.parse(msg)
if (d.hasOwnProperty('event')) {
if (d.event === 'read') {
sendData(connections[id])
} else if (d.event === 'update') {
console.warn('RECEIVED UPDATE')
sub.forEach(x => {
x(d.data)
})
}
}
}
const sendData = (w) => {
console.log('SENDING DATA')
if (overlayStream !== null) {
console.log(overlayStream)
w.send(JSON.stringify({
event: 'read',
data: overlayStream,
}))
}
}

@ -1,4 +1,4 @@
import ws from 'ws' import ws from 'ws'
import { v4 } from 'uuid' import { v4 } from 'uuid'
let wss = null let wss = null

@ -13,7 +13,6 @@ const channels = [
'matches', 'matches',
'casters', 'casters',
'hosts', 'hosts',
'stats',
'streams', 'streams',
'brackets', 'brackets',
] ]
@ -94,4 +93,4 @@ export const del = (channel, id) => {
}, },
})) }))
} }
} }

@ -7,7 +7,7 @@
<p class="nav-item" @click="nav = 'rosters'" :class="nav === 'rosters' ? 'active' : ''">Rosters</p> <p class="nav-item" @click="nav = 'rosters'" :class="nav === 'rosters' ? 'active' : ''">Rosters</p>
<p class="nav-item" @click="nav = 'matches'" :class="nav === 'matches' ? 'active' : ''">Matches</p> <p class="nav-item" @click="nav = 'matches'" :class="nav === 'matches' ? 'active' : ''">Matches</p>
<p class="nav-item" @click="nav = 'casters'" :class="nav === 'casters' ? 'active' : ''">Casters / Hosts</p> <p class="nav-item" @click="nav = 'casters'" :class="nav === 'casters' ? 'active' : ''">Casters / Hosts</p>
<p class="nav-item" @click="nav = 'stats'" :class="nav === 'stats' ? 'active' : ''">Stats</p> <!-- <p class="nav-item" @click="nav = 'hosts'" :class="nav === 'hosts' ? 'active' : ''">Hosts</p> -->
<p class="nav-item" @click="nav = 'streams'" :class="nav === 'streams' ? 'active' : ''">Streams</p> <p class="nav-item" @click="nav = 'streams'" :class="nav === 'streams' ? 'active' : ''">Streams</p>
<p class="nav-item" @click="nav = 'brackets'" :class="nav === 'brackets' ? 'active' : ''">Brackets</p> <p class="nav-item" @click="nav = 'brackets'" :class="nav === 'brackets' ? 'active' : ''">Brackets</p>
<img class="block w-16 h-16 absolute bottom-10" src="https://cms.aplesports.com/storage/uploads/2020/04/23/5ea178d6570e1APL_New.png" alt="APL Logo"> <img class="block w-16 h-16 absolute bottom-10" src="https://cms.aplesports.com/storage/uploads/2020/04/23/5ea178d6570e1APL_New.png" alt="APL Logo">
@ -24,10 +24,6 @@
<span v-if="!store.state.server">Start</span> <span v-if="!store.state.server">Start</span>
overlay overlay
</button> </button>
<button @click.prevent="relayDo()" class="block mt-4 w-64 h-10 text-white bg-red-700 rounded-lg hover:bg-red-600">
<span v-if="store.state.relay">Stop Relay</span>
<span v-if="!store.state.relay">Start relay</span>
</button>
<!-- <button v-if="store.state.server" :disabled="streamid === ''" @click.prevent="serverDo" class="block mt-4 w-64 h-10 text-white bg-red-700 rounded-lg hover:bg-red-600"> <!-- <button v-if="store.state.server" :disabled="streamid === ''" @click.prevent="serverDo" class="block mt-4 w-64 h-10 text-white bg-red-700 rounded-lg hover:bg-red-600">
Stop overlay Stop overlay
</button> --> </button> -->
@ -36,7 +32,6 @@
<Rosters v-if="nav === 'rosters'" /> <Rosters v-if="nav === 'rosters'" />
<Matches v-if="nav === 'matches'" /> <Matches v-if="nav === 'matches'" />
<Casters v-if="nav === 'casters'" /> <Casters v-if="nav === 'casters'" />
<Stats v-if="nav === 'stats'" />
<Streams v-if="nav === 'streams'" /> <Streams v-if="nav === 'streams'" />
<Brackets v-if="nav === 'brackets'" /> <Brackets v-if="nav === 'brackets'" />
</div> </div>
@ -51,7 +46,6 @@ import Rosters from '@/components/Rosters.vue'
import Matches from '@/components/Matches.vue' import Matches from '@/components/Matches.vue'
import Casters from '@/components/Casters.vue' import Casters from '@/components/Casters.vue'
import Hosts from '@/components/Hosts.vue' import Hosts from '@/components/Hosts.vue'
import Stats from '@/components/Stats.vue'
import Streams from '@/components/Streams.vue' import Streams from '@/components/Streams.vue'
import Brackets from '@/components/Brackets.vue' import Brackets from '@/components/Brackets.vue'
@ -62,7 +56,6 @@ export default {
Matches, Matches,
Casters, Casters,
Hosts, Hosts,
Stats,
Streams, Streams,
Brackets, Brackets,
}, },
@ -73,13 +66,9 @@ export default {
const check = async () => { const check = async () => {
const status = await window.ipcRenderer.invoke('status') const status = await window.ipcRenderer.invoke('status')
const relayStatus = await window.ipcRenderer.invoke('relayStatus')
if (status) { if (status) {
store.state.server = true store.state.server = true
} }
if (relayStatus) {
store.state.relay = true
}
} }
check() check()
@ -135,23 +124,12 @@ export default {
} }
} }
const relayDo = () => {
if (!store.state.relay) {
window.ipcRenderer.invoke('relay', true)
store.state.relay = true
} else {
store.state.relay = false
window.ipcRenderer.invoke('relay', false);
}
}
return { return {
store, store,
nav, nav,
streamid, streamid,
serverDo, serverDo,
relayDo,
} }
}, },
} }

Loading…
Cancel
Save