Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Tabu-Middleware
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dennis Willers
Tabu-Middleware
Commits
534553a2
Commit
534553a2
authored
Jan 03, 2021
by
Dennis Willers
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent Tabu 4 same time pressing tabu
parent
748d2225
Pipeline
#342
passed with stages
in 3 minutes and 10 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
4 deletions
+29
-4
events.js
events.js
+29
-4
No files found.
events.js
View file @
534553a2
...
...
@@ -305,8 +305,34 @@ function createRouter(db) {
}
};
const
isPoint4Card
=
function
isPoint4Card
(
req
,
res
,
next
)
{
const
spielname
=
req
.
body
.
spielname
;
const
cardID
=
req
.
body
.
cardID
;
if
(
spielname
.
match
(
/^
[
0-9a-z
]
+$/
)
!=
null
&&
!
isNaN
(
cardID
))
{
const
sql
=
'
SELECT ActiveCard FROM Gamestatus WHERE SessionID = (SELECT SessionID FROM Session WHERE SessionName =
\
"
'
+
spielname
+
'
\
");
'
;
console
.
log
(
'
isPoint4Card:
'
,
sql
);
db
.
query
(
sql
,
(
error
,
results
)
=>
{
if
(
error
)
{
console
.
log
(
error
);
res
.
header
(
'
Access-Control-Allow-Origin
'
,
"
*
"
).
status
(
500
).
json
({
status
:
'
false
'
});
}
else
{
resultCardID
=
results
[
0
].
ActiveCard
;
if
(
JSON
.
parse
(
resultCardID
)
===
JSON
.
parse
(
cardID
))
{
next
();
}
else
{
res
.
header
(
'
Access-Control-Allow-Origin
'
,
"
*
"
).
status
(
200
).
json
({
status
:
'
false
'
});
}
}
}
);
}
else
{
res
.
header
(
'
Access-Control-Allow-Origin
'
,
"
*
"
).
status
(
500
).
json
({
status
:
'
false body informal
'
});
}
};
const
addPoint
=
function
addPoint
(
req
,
res
)
{
console
.
log
(
req
.
body
);
const
spielname
=
req
.
body
.
spielname
;
const
team
=
req
.
body
.
team
;
if
(
spielname
.
match
(
/^
[
0-9a-z
]
+$/
)
!=
null
&&
team
.
match
(
/^
[
0-9a-z
]
+$/
)
!=
null
)
{
...
...
@@ -357,7 +383,6 @@ function createRouter(db) {
};
const
removePoint
=
function
removePoint
(
req
,
res
)
{
console
.
log
(
req
.
body
);
const
spielname
=
req
.
body
.
spielname
;
const
team
=
req
.
body
.
team
;
if
(
spielname
.
match
(
/^
[
0-9a-z
]
+$/
)
!=
null
&&
team
.
match
(
/^
[
0-9a-z
]
+$/
)
!=
null
)
{
...
...
@@ -465,10 +490,10 @@ function createRouter(db) {
router
.
post
(
'
/newGame
'
,
[
isSession
,
isActiveExplainer
,
newGame
]);
//Add Point
router
.
post
(
'
/addPoint
'
,
[
addPoint
]);
router
.
post
(
'
/addPoint
'
,
[
isPoint4Card
,
addPoint
]);
//Remove Point
router
.
post
(
'
/removePoint
'
,
[
removePoint
]);
router
.
post
(
'
/removePoint
'
,
[
isPoint4Card
,
removePoint
]);
//Get ActiveCard
router
.
post
(
'
/getActiveCard
'
,
[
isSession
,
getActiveCard
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment