Skip to content

Commit 30d055c

Browse files
committed
fix check for apikey and create feedback endpoint
1 parent 9b9cf04 commit 30d055c

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

backend/handlers/apikey.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function CreateApiKeyHandler (db) {
99
const users = await db.readAll('users')
1010

1111
const apiKeyExists = users.map((user) => {
12-
return user.apiKey === apikey
12+
return user.apiKey.includes(apikey)
1313
})
1414

1515
if (apiKeyExists.includes(true)) {

backend/handlers/feedbacks.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ function CreateFeedbackHandler (db) {
1111
const {
1212
type,
1313
text,
14+
apiKey,
1415
fingerprint,
1516
device,
1617
page
@@ -36,6 +37,10 @@ function CreateFeedbackHandler (db) {
3637
ctx.status = 400
3738
ctx.body = { error: 'page is empty' }
3839
}
40+
if (!apiKey) {
41+
ctx.status = 400
42+
ctx.body = { error: 'apiKey is empty' }
43+
}
3944

4045
if (!FEEDBACK_TYPES[String(type).toUpperCase()]) {
4146
ctx.status = 422
@@ -47,6 +52,7 @@ function CreateFeedbackHandler (db) {
4752
text,
4853
fingerprint,
4954
id: uuidv4(),
55+
apiKey,
5056
type: String(type).toUpperCase(),
5157
device,
5258
page,

dashboard/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM node:13-alpine as build
2+
3+
WORKDIR /
4+
5+
COPY . .
6+
7+
ENV NODE_ENV=production
8+
RUN npm install --production
9+
RUN npm run build
10+
11+
FROM nginx:1.18.0-alpine as final
12+
13+
WORKDIR /
14+
COPY --from=build ./dist /usr/share/nginx/html

0 commit comments

Comments
 (0)