Deployment fix

This commit is contained in:
Thomas
2020-09-01 15:03:44 +02:00
parent d8ce1001cb
commit e5469b7ad5
17 changed files with 91 additions and 48 deletions

2
.gitignore vendored
View File

@@ -20,3 +20,5 @@ pnpm-debug.log*
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
tronio.jar

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -3,7 +3,7 @@
<Game v-if="isLoggedIn"/> <Game v-if="isLoggedIn"/>
<div v-else class="container mainMenu"> <div v-else class="container mainMenu">
<img src="./assets/logo.png" alt="TronIo logo" width="150px"/> <img src="./assets/logo.png" alt="TronIo logo" width="150px"/>
<h1 class="title">Tron.io</h1> <h1 class="title">tron.io</h1>
<b-button @click="loginPrompt">Start</b-button> <b-button @click="loginPrompt">Start</b-button>
</div> </div>
<b-loading v-model="isLoading"/> <b-loading v-model="isLoading"/>
@@ -34,7 +34,6 @@ export default {
this.$buefy.dialog.prompt({ this.$buefy.dialog.prompt({
message: 'Choose a name', message: 'Choose a name',
trapFocus: true, trapFocus: true,
canCancel: false,
inputAttrs: { inputAttrs: {
placeholder: 'pedro', placeholder: 'pedro',
minlength: 3, minlength: 3,

View File

@@ -68,11 +68,10 @@ export default {
this.canvas.height = window.innerHeight this.canvas.height = window.innerHeight
this.canvas.addEventListener('mousemove', this.mouseEvent) this.canvas.addEventListener('mousemove', this.mouseEvent)
this.canvas.addEventListener('touchmove', this.touchEvent) this.canvas.addEventListener('touchmove', this.touchEvent)
this.renderTimer = setInterval(this.render, 1000 / 60) this.renderTimer = setInterval(this.render, 1000 / 120)
}, },
methods: { methods: {
render () { render () {
this.stats.lastFrame = performance.now()
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height) this.context.clearRect(0, 0, this.canvas.width, this.canvas.height)
this.renderBorders() this.renderBorders()
@@ -99,6 +98,8 @@ export default {
this.renderMouse() this.renderMouse()
this.renderDebug() this.renderDebug()
this.stats.lastFrame = performance.now()
}, },
renderBorders () { renderBorders () {
this.context.strokeStyle = 'white' this.context.strokeStyle = 'white'
@@ -138,11 +139,11 @@ export default {
this.context.fillStyle = 'white' this.context.fillStyle = 'white'
this.context.textAlign = 'start' this.context.textAlign = 'start'
this.context.fillText('camera x: ' + this.camera.x + ' y:' + this.camera.y, 10, 12) this.context.fillText('camera x: ' + this.camera.x + ' y:' + this.camera.y, 10, 12)
// this.context.fillText('a:' + player.angle + ' a_t' + player.targetAngle, 10, 24) this.context.fillText('mouse x: ' + this.mouse.x + ' y:' + this.mouse.y, 10, 24)
this.context.fillText('canvasX: ' + canvasX + ' canvasY: ' + canvasY, 10, 36) this.context.fillText('canvasX: ' + canvasX + ' canvasY: ' + canvasY, 10, 36)
this.context.fillText('Total walls: ' + this.stats.totalWalls, 10, 48) this.context.fillText('Total walls: ' + this.stats.totalWalls, 10, 48)
this.context.fillText('Last update: ' + this.stats.lastUpdateTime, 10, 60) this.context.fillText('Last update: ' + this.stats.lastUpdateTime, 10, 60)
const fps = (performance.now() - this.stats.lastFrame) * 60 const fps = 1000 / (performance.now() - this.stats.lastFrame)
this.context.fillText('FPS: ' + fps, 10, 72) this.context.fillText('FPS: ' + fps, 10, 72)
}, },
renderMouse () { renderMouse () {

View File

@@ -1,6 +1,7 @@
/* eslint-disable no-console */ /* eslint-disable no-console */
import { register } from 'register-service-worker' import { register } from 'register-service-worker'
import { ToastProgrammatic as Toast } from 'buefy'
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
register(`${process.env.BASE_URL}service-worker.js`, { register(`${process.env.BASE_URL}service-worker.js`, {
@@ -18,12 +19,16 @@ if (process.env.NODE_ENV === 'production') {
}, },
updatefound () { updatefound () {
console.log('New content is downloading.') console.log('New content is downloading.')
Toast.open('Update found, downloading...')
}, },
updated () { updated () {
console.log('New content is available; please refresh.') console.log('New content is available; please refresh.')
window.location.reload(true)
Toast.open('App updated !')
}, },
offline () { offline () {
console.log('No internet connection found. App is running in offline mode.') console.log('No internet connection found. App is running in offline mode.')
Toast.open('No internet connection !')
}, },
error (error) { error (error) {
console.error('Error during service worker registration:', error) console.error('Error during service worker registration:', error)

View File

@@ -1,7 +1,7 @@
import { ToastProgrammatic as Toast } from 'buefy' import { ToastProgrammatic as Toast } from 'buefy'
const connection = new WebSocket('ws://localhost:8181/socket') // const connection = new WebSocket('ws://localhost:8181/socket')
// const connection = new WebSocket('wss://tronio.gltronic.ovh/socket') const connection = new WebSocket('wss://tronio.gltronic.ovh/socket')
export default function createSocketPlugin () { export default function createSocketPlugin () {
return store => { return store => {

33
server/.gitignore vendored Normal file
View File

@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

View File

@@ -1,4 +1,4 @@
package gltronic.voozik; package gltronic.tronio;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;

View File

@@ -1,3 +1,3 @@
artifactId=voozik artifactId=tronio
groupId=gltronic groupId=gltronic
version=0.0.1-SNAPSHOT version=0.0.1-SNAPSHOT

View File

@@ -1,7 +1,12 @@
/home/thomsb/Projets/web/voozik/server/src/main/java/gltronic/voozik/web/SocketHandler.java /home/thomsb/Projets/web/tronio/server/src/main/java/gltronic/tronio/TronIoApplication.java
/home/thomsb/Projets/web/voozik/server/src/main/java/gltronic/voozik/business/IYTSearch.java /home/thomsb/Projets/web/tronio/server/src/main/java/gltronic/tronio/model/Game.java
/home/thomsb/Projets/web/voozik/server/src/main/java/gltronic/voozik/business/RoomManager.java /home/thomsb/Projets/web/tronio/server/src/main/java/gltronic/tronio/model/BiMap.java
/home/thomsb/Projets/web/voozik/server/src/main/java/gltronic/voozik/business/IRoomManager.java /home/thomsb/Projets/web/tronio/server/src/main/java/gltronic/tronio/business/IGameManager.java
/home/thomsb/Projets/web/voozik/server/src/main/java/gltronic/voozik/web/WebSocketConfiguration.java /home/thomsb/Projets/web/tronio/server/src/main/java/gltronic/tronio/business/GameManager.java
/home/thomsb/Projets/web/voozik/server/src/main/java/gltronic/voozik/VoozikApplication.java /home/thomsb/Projets/web/tronio/server/src/main/java/gltronic/tronio/model/Player.java
/home/thomsb/Projets/web/voozik/server/src/main/java/gltronic/voozik/model/BiMap.java /home/thomsb/Projets/web/tronio/server/src/main/java/gltronic/tronio/model/GameUpdate.java
/home/thomsb/Projets/web/tronio/server/src/main/java/gltronic/tronio/model/GameSettings.java
/home/thomsb/Projets/web/tronio/server/src/main/java/gltronic/tronio/business/SocketUtils.java
/home/thomsb/Projets/web/tronio/server/src/main/java/gltronic/tronio/model/Wall.java
/home/thomsb/Projets/web/tronio/server/src/main/java/gltronic/tronio/web/WebSocketConfiguration.java
/home/thomsb/Projets/web/tronio/server/src/main/java/gltronic/tronio/web/SocketHandler.java

View File

@@ -0,0 +1 @@
gltronic/tronio/DemoApplicationTests.class

View File

@@ -1 +1 @@
/home/thomsb/Projets/web/voozik/server/src/test/java/gltronic/voozik/DemoApplicationTests.java /home/thomsb/Projets/web/tronio/server/src/test/java/gltronic/tronio/DemoApplicationTests.java

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,7 @@
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Test set: gltronic.voozik.DemoApplicationTests Test set: gltronic.voozik.DemoApplicationTests
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.292 s - in gltronic.voozik.DemoApplicationTests Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.013 s <<< FAILURE! - in gltronic.voozik.DemoApplicationTests
gltronic.voozik.DemoApplicationTests Time elapsed: 0.013 s <<< ERROR!
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

View File

@@ -1,19 +0,0 @@
{
"type":"gameUpdate",
"message": [
{
"color":"#0deeff",
"x":361.69764869823257,
"y":427.9410817135364,
"angle":0.0,
"targetAngle":0.0,
"walls":[
{"x":323.69764869823257,"y":427.9410817135364},
{"x":335.69764869823257,"y":427.9410817135364},
{"x":347.69764869823257,"y":427.9410817135364},
{"x":359.69764869823257,"y":427.9410817135364}
],
"lastWall":0
}
]
}