Created share token hook.

This commit is contained in:
Mike Cao 2020-10-11 02:29:55 -07:00
parent 4119e80a9a
commit 5a73c224b7
22 changed files with 90 additions and 49 deletions

View file

@ -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);

View file

@ -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: {