From ec48a4e3250e9cefc481b339a90e6ceea6f1ec2b Mon Sep 17 00:00:00 2001 From: Guy Goldenberg Date: Wed, 26 Jul 2023 14:36:58 +0300 Subject: [PATCH 1/3] Change verification call to `canUpdateWebsite` --- pages/api/websites/[id]/reset.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/api/websites/[id]/reset.ts b/pages/api/websites/[id]/reset.ts index dc98c591..23b5305d 100644 --- a/pages/api/websites/[id]/reset.ts +++ b/pages/api/websites/[id]/reset.ts @@ -1,5 +1,5 @@ import { NextApiRequestQueryBody } from 'lib/types'; -import { canViewWebsite } from 'lib/auth'; +import { canUpdateWebsite } from 'lib/auth'; import { useAuth, useCors } from 'lib/middleware'; import { NextApiResponse } from 'next'; import { methodNotAllowed, ok, unauthorized } from 'next-basics'; @@ -19,7 +19,7 @@ export default async ( const { id: websiteId } = req.query; if (req.method === 'POST') { - if (!(await canViewWebsite(req.auth, websiteId))) { + if (!(await canUpdateWebsite(req.auth, websiteId))) { return unauthorized(res); } From eeae168df1b61acef536332a57f17fe33fb9a1f3 Mon Sep 17 00:00:00 2001 From: Leonardo Humbert Date: Thu, 27 Jul 2023 20:03:58 -0300 Subject: [PATCH 2/3] Feat: Add default_lang enviroment variable --- lib/constants.ts | 2 +- next.config.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/constants.ts b/lib/constants.ts index 209a97b6..72209ddb 100644 --- a/lib/constants.ts +++ b/lib/constants.ts @@ -13,7 +13,7 @@ export const REPO_URL = 'https://github.com/umami-software/umami'; export const UPDATES_URL = 'https://api.umami.is/v1/updates'; export const TELEMETRY_PIXEL = 'https://i.umami.is/a.png'; -export const DEFAULT_LOCALE = 'en-US'; +export const DEFAULT_LOCALE = process.env.defaultLang ?? 'en-US'; export const DEFAULT_THEME = 'light'; export const DEFAULT_ANIMATION_DURATION = 300; export const DEFAULT_DATE_RANGE = '24hour'; diff --git a/next.config.js b/next.config.js index 0778f979..18eb54c4 100644 --- a/next.config.js +++ b/next.config.js @@ -74,6 +74,7 @@ if (process.env.CLOUD_MODE && process.env.CLOUD_URL && process.env.DISABLE_LOGIN const config = { env: { currentVersion: pkg.version, + defaultLang: process.env.DEFAULT_LANG, isProduction: process.env.NODE_ENV === 'production', }, basePath: process.env.BASE_PATH, From a9413c586a2a266091c337ddfc5f2b78edfa94b2 Mon Sep 17 00:00:00 2001 From: Leonardo Humbert Date: Fri, 28 Jul 2023 10:18:48 -0300 Subject: [PATCH 3/3] refactor: Change the name of the environment variable --- lib/constants.ts | 2 +- next.config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/constants.ts b/lib/constants.ts index 72209ddb..175f2ecc 100644 --- a/lib/constants.ts +++ b/lib/constants.ts @@ -13,7 +13,7 @@ export const REPO_URL = 'https://github.com/umami-software/umami'; export const UPDATES_URL = 'https://api.umami.is/v1/updates'; export const TELEMETRY_PIXEL = 'https://i.umami.is/a.png'; -export const DEFAULT_LOCALE = process.env.defaultLang ?? 'en-US'; +export const DEFAULT_LOCALE = process.env.defaultLocale ?? 'en-US'; export const DEFAULT_THEME = 'light'; export const DEFAULT_ANIMATION_DURATION = 300; export const DEFAULT_DATE_RANGE = '24hour'; diff --git a/next.config.js b/next.config.js index 18eb54c4..2165a6e0 100644 --- a/next.config.js +++ b/next.config.js @@ -74,7 +74,7 @@ if (process.env.CLOUD_MODE && process.env.CLOUD_URL && process.env.DISABLE_LOGIN const config = { env: { currentVersion: pkg.version, - defaultLang: process.env.DEFAULT_LANG, + defaultLocale: process.env.DEFAULT_LOCALE, isProduction: process.env.NODE_ENV === 'production', }, basePath: process.env.BASE_PATH,