chore: Indent, phrasing

parent f6e98fcf
<template> <template>
<div id="app"> <div id="app">
<img alt="Vue logo" src="./assets/logo.png" /> <HelloWorld msg="Salut Menteur !"/>
<HelloWorld msg="Welcome to Menteur!" /> <ListenToSockets/>
<ListenToSockets /> </div>
</div>
</template> </template>
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import 'es6-promise/auto' // Needed for Promise polyfill import 'es6-promise/auto' // Needed for Promise polyfill
import VueSocketIO from 'vue-socket.io'
// import Game from "./components/Game";
import HelloWorld from "./components/HelloWorld";
import ListenToSockets from "./Sockets";
import VueSocketIO from 'vue-socket.io' Vue.use(Vuex);
// import Game from "./components/Game"; const store = new Vuex.Store({
import HelloWorld from "./components/HelloWorld"; state: {
import ListenToSockets from "./ListenToSockets"; count: 0
},
mutations: {
increment(state) {
state.count++
},
decrement(state) {
state.count++
}
}
// TODO: Use actions for VueX-SocketIO integration?
// actions: {
// "<ACTION_PREFIX><EVENT_NAME>"() {
// // do something
// }
// }
});
Vue.use(Vuex);
const store = new Vuex.Store({
state: {
count: 0
},
mutations: {
increment (state) {
state.count++
},
decrement (state) {
state.count++
}
}
// TODO: Use actions for VueX-SocketIO integration?
// actions: {
// "<ACTION_PREFIX><EVENT_NAME>"() {
// // do something
// }
// }
});
Vue.use(new VueSocketIO({
debug: true,
connection: 'http://localhost:9042',
vuex: {
store,
actionPrefix: 'SOCKET_',
mutationPrefix: 'SOCKET_'
},
options: {path: "/socket.io/"} //Optional options
}));
Vue.use(new VueSocketIO({
debug: true,
connection: 'http://localhost:9042',
vuex: {
store,
actionPrefix: 'SOCKET_',
mutationPrefix: 'SOCKET_'
},
options: { path: "/socket.io/" } //Optional options
}));
export default {
export default { name: "App",
name: "App", components: {
components: { HelloWorld,
HelloWorld, ListenToSockets
ListenToSockets }
} };
};
</script> </script>
<style> <style>
#app { #app {
font-family: Avenir, Helvetica, Arial, sans-serif; font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
text-align: center; text-align: center;
color: #2c3e50; color: #2c3e50;
margin-top: 60px; margin-top: 60px;
} }
</style> </style>
<template> <template>
<div class="hello"> <div class="hello">
<h1>Hello Vue! {{ msg }}</h1> <h1>{{ msg }}</h1>
<p> </div>
For a guide and recipes on how to configure / customize this project,<br />
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener"
>vue-cli documentation</a
>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li>
<a
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel"
target="_blank"
rel="noopener"
>babel</a
>
</li>
<li>
<a
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint"
target="_blank"
rel="noopener"
>eslint</a
>
</li>
</ul>
</div>
</template> </template>
<script> <script>
export default { export default {
name: "HelloWorld", name: "HelloWorld",
props: { props: {
msg: String msg: String
} }
}; };
</script> </script>
<!-- Add "scoped" attribute to limit CSS to this component only --> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped> <style scoped>
h3 { h3 {
margin: 40px 0 0; margin: 40px 0 0;
} }
ul {
list-style-type: none; ul {
padding: 0; list-style-type: none;
} padding: 0;
li { }
display: inline-block;
margin: 0 10px; li {
} display: inline-block;
a { margin: 0 10px;
color: #42b983; }
}
a {
color: #42b983;
}
</style> </style>
...@@ -3,8 +3,8 @@ from http.client import HTTPException ...@@ -3,8 +3,8 @@ from http.client import HTTPException
import socketio import socketio
from fastapi import FastAPI, APIRouter from fastapi import FastAPI, APIRouter
from fastapi.exceptions import RequestValidationError from fastapi.exceptions import RequestValidationError
from starlette.responses import PlainTextResponse
from starlette.exceptions import HTTPException from starlette.exceptions import HTTPException
from starlette.responses import PlainTextResponse
from server.model.data import Game from server.model.data import Game
# Game state # Game state
...@@ -16,6 +16,14 @@ game = Game() ...@@ -16,6 +16,14 @@ game = Game()
# Server # Server
app = FastAPI() app = FastAPI()
router = APIRouter() router = APIRouter()
#
# app.add_middleware(
# CORSMiddleware,
# allow_origins=["*"],
# allow_credentials=True,
# allow_methods=["*"],
# allow_headers=["*"],
# )
# Create and mount SocketIO app # Create and mount SocketIO app
sio_asgi_app = socketio.ASGIApp( sio_asgi_app = socketio.ASGIApp(
......
...@@ -3,9 +3,10 @@ import socketio ...@@ -3,9 +3,10 @@ import socketio
sio = socketio.AsyncServer( sio = socketio.AsyncServer(
async_mode='asgi', async_mode='asgi',
logger=True, logger=True,
cors_allowed_origins="*" # FIXME: CSRF Vulnerability cors_allowed_origins="*" # FIXME: CSRF Vulnerability
) )
@sio.event @sio.event
def connect(sid, environ): def connect(sid, environ):
print("connect ", sid, environ) print("connect ", sid, environ)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment