Merge pull request #14 from albertoxamin/dev
fix service worker and accessibility warnings
This commit is contained in:
commit
485b169fb1
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
from typing import List
|
from typing import List
|
||||||
@ -8,7 +9,7 @@ from bang.game import Game
|
|||||||
from bang.players import Player
|
from bang.players import Player
|
||||||
|
|
||||||
sio = socketio.Server(cors_allowed_origins="*")
|
sio = socketio.Server(cors_allowed_origins="*")
|
||||||
app = socketio.WSGIApp(sio, static_files={
|
static_files={
|
||||||
'/': {'content_type': 'text/html', 'filename': 'index.html'},
|
'/': {'content_type': 'text/html', 'filename': 'index.html'},
|
||||||
'/game': {'content_type': 'text/html', 'filename': 'index.html'},
|
'/game': {'content_type': 'text/html', 'filename': 'index.html'},
|
||||||
'/robots.txt': {'content_type': 'text/html', 'filename': 'robots.txt'},
|
'/robots.txt': {'content_type': 'text/html', 'filename': 'robots.txt'},
|
||||||
@ -17,8 +18,11 @@ app = socketio.WSGIApp(sio, static_files={
|
|||||||
'/manifest.json': {'filename': 'manifest.json'},
|
'/manifest.json': {'filename': 'manifest.json'},
|
||||||
'/css': './css',
|
'/css': './css',
|
||||||
'/js': './js',
|
'/js': './js',
|
||||||
})
|
}
|
||||||
|
for file in [f for f in os.listdir('.') if '.js' in f or '.map' in f or '.html' in f]:
|
||||||
|
static_files[f'/{file}'] = f'./{file}'
|
||||||
|
|
||||||
|
app = socketio.WSGIApp(sio, static_files=static_files)
|
||||||
games: List[Game] = []
|
games: List[Game] = []
|
||||||
online_players = 0
|
online_players = 0
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<h2>{{$t("warning")}}</h2>
|
<h2>{{$t("warning")}}</h2>
|
||||||
<p>{{$t("connection_error")}}</p>
|
<p>{{$t("connection_error")}}</p>
|
||||||
</div>
|
</div>
|
||||||
<select style="position:fixed;bottom:4pt;right:4pt;" v-model="$i18n.locale" @change="storeLangPref">
|
<select id="lang" style="position:fixed;bottom:4pt;right:4pt;" v-model="$i18n.locale" @change="storeLangPref">
|
||||||
<option
|
<option
|
||||||
v-for="(lang, i) in ['it.🇮🇹.Italiano', 'en.🇬🇧.English']"
|
v-for="(lang, i) in ['it.🇮🇹.Italiano', 'en.🇬🇧.English']"
|
||||||
:key="`lang-${i}`"
|
:key="`lang-${i}`"
|
||||||
@ -15,6 +15,7 @@
|
|||||||
{{lang.split('.')[1]}} {{lang.split('.')[2]}}
|
{{lang.split('.')[1]}} {{lang.split('.')[2]}}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
<label for="lang" style="opacity:0" >Language</label>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<div v-if="!didSetUsername">
|
<div v-if="!didSetUsername">
|
||||||
<p>{{$t("choose_username")}}</p>
|
<p>{{$t("choose_username")}}</p>
|
||||||
<form @submit="setUsername">
|
<form @submit="setUsername">
|
||||||
<input v-model="username" />
|
<input id="username" v-model="username" />
|
||||||
<input type="submit" :value="$t('submit')"/>
|
<input type="submit" :value="$t('submit')"/>
|
||||||
</form>
|
</form>
|
||||||
<p>{{$t("online_players")}}{{onlinePlayers}}</p>
|
<p>{{$t("online_players")}}{{onlinePlayers}}</p>
|
||||||
@ -25,12 +25,14 @@
|
|||||||
<form @submit="createLobby">
|
<form @submit="createLobby">
|
||||||
<h2>{{$t("create_lobby")}}</h2>
|
<h2>{{$t("create_lobby")}}</h2>
|
||||||
<p>{{$t("lobby_name")}}</p>
|
<p>{{$t("lobby_name")}}</p>
|
||||||
<input v-model="lobbyName"/>
|
<input id="lobbyname" v-model="lobbyName"/>
|
||||||
<input type="submit" :value="$t('submit')"/>
|
<input type="submit" :value="$t('submit')"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<label for="username" style="opacity:0">Username</label>
|
||||||
|
<label for="lobbyname" style="opacity:0">Lobby Name</label>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const { GenerateSW } = require("workbox-webpack-plugin");
|
const { GenerateSW } = require("workbox-webpack-plugin");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
publicPath: "./",
|
||||||
pwa: {
|
pwa: {
|
||||||
name: 'PewPew!',
|
name: 'PewPew!',
|
||||||
appleMobileWebAppCache: "yes",
|
appleMobileWebAppCache: "yes",
|
||||||
@ -8,7 +9,11 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
plugins: [new GenerateSW()],
|
plugins: [new GenerateSW({
|
||||||
|
clientsClaim: true,
|
||||||
|
skipWaiting: true,
|
||||||
|
navigateFallback: 'index.html',
|
||||||
|
})],
|
||||||
output: {
|
output: {
|
||||||
crossOriginLoading: 'anonymous'
|
crossOriginLoading: 'anonymous'
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user