mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
Created share token hook.
This commit is contained in:
parent
4119e80a9a
commit
5a73c224b7
22 changed files with 90 additions and 49 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { parse } from 'cookie';
|
||||
import { parseSecureToken, parseToken } from './crypto';
|
||||
import { AUTH_COOKIE_NAME } from './constants';
|
||||
import { AUTH_COOKIE_NAME, TOKEN_HEADER } from './constants';
|
||||
import { getWebsiteById } from './queries';
|
||||
|
||||
export async function getAuthToken(req) {
|
||||
|
|
@ -26,7 +26,8 @@ export async function isValidToken(token, validation) {
|
|||
}
|
||||
|
||||
export async function allowQuery(req, skipToken) {
|
||||
const { id, token } = req.query;
|
||||
const { id } = req.query;
|
||||
const token = req.headers[TOKEN_HEADER];
|
||||
const websiteId = +id;
|
||||
|
||||
const website = await getWebsiteById(websiteId);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ export const TIMEZONE_CONFIG = 'umami.timezone';
|
|||
export const DATE_RANGE_CONFIG = 'umami.date-range';
|
||||
export const THEME_CONFIG = 'umami.theme';
|
||||
export const VERSION_CHECK = 'umami.version-check';
|
||||
export const TOKEN_HEADER = 'x-umami-token';
|
||||
|
||||
export const THEME_COLORS = {
|
||||
light: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue