mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 18:00:17 +01:00
Merge branch 'dev' into analytics
This commit is contained in:
commit
e3bf3e5dc2
@ -12,8 +12,8 @@ RUN yarn install --frozen-lockfile
|
||||
FROM node:18-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY docker/middleware.js .
|
||||
COPY . .
|
||||
COPY docker/middleware.js ./src
|
||||
|
||||
ARG DATABASE_TYPE
|
||||
ARG BASE_PATH
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { useEffect, useCallback, useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { Button, Row, Column } from 'react-basics';
|
||||
import { setItem } from 'next-basics';
|
||||
import useStore, { checkVersion } from 'store/version';
|
||||
@ -44,7 +45,7 @@ export function UpdateNotice({ user, config }) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
return createPortal(
|
||||
<Row className={styles.notice}>
|
||||
<Column variant="two" className={styles.message}>
|
||||
{formatMessage(messages.newVersionAvailable, { version: `v${latest}` })}
|
||||
@ -55,7 +56,8 @@ export function UpdateNotice({ user, config }) {
|
||||
</Button>
|
||||
<Button onClick={handleDismissClick}>{formatMessage(labels.dismiss)}</Button>
|
||||
</Column>
|
||||
</Row>
|
||||
</Row>,
|
||||
document.body,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2,13 +2,14 @@
|
||||
position: absolute;
|
||||
max-width: 800px;
|
||||
gap: 20px;
|
||||
margin: 20px auto;
|
||||
justify-self: center;
|
||||
margin: 80px auto;
|
||||
align-self: center;
|
||||
background: var(--base50);
|
||||
padding: 20px;
|
||||
border: 1px solid var(--base300);
|
||||
border-radius: var(--border-radius);
|
||||
z-index: var(--z-index-popup);
|
||||
box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.message {
|
||||
|
@ -7,7 +7,7 @@ import { getIpAddress } from 'lib/detect';
|
||||
import { useCors, useSession, useValidate } from 'lib/middleware';
|
||||
import { CollectionType, YupRequest } from 'lib/types';
|
||||
import { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { badRequest, createToken, forbidden, ok, send } from 'next-basics';
|
||||
import { badRequest, createToken, forbidden, methodNotAllowed, ok, send } from 'next-basics';
|
||||
import { saveEvent, saveSessionData } from 'queries';
|
||||
import * as yup from 'yup';
|
||||
|
||||
@ -73,16 +73,13 @@ const schema = {
|
||||
export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
||||
await useCors(req, res);
|
||||
|
||||
if (req.method === 'POST') {
|
||||
if (isbot(req.headers['user-agent']) && !process.env.DISABLE_BOT_CHECK) {
|
||||
return ok(res);
|
||||
}
|
||||
|
||||
const { type, payload } = req.body;
|
||||
|
||||
if (!type || !payload) {
|
||||
return badRequest(res);
|
||||
}
|
||||
|
||||
req.yup = schema;
|
||||
await useValidate(req, res);
|
||||
|
||||
@ -142,6 +139,9 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
||||
const token = createToken(session, secret());
|
||||
|
||||
return send(res, token);
|
||||
}
|
||||
|
||||
return methodNotAllowed(res);
|
||||
};
|
||||
|
||||
async function hasBlockedIp(req: NextApiRequestCollect) {
|
||||
|
Loading…
Reference in New Issue
Block a user