From ec7bc92497eb4b472df963833c3d52bf086a46ef Mon Sep 17 00:00:00 2001 From: akashrajpurohit_postman Date: Sun, 21 Aug 2022 17:00:40 +0530 Subject: [PATCH 1/2] feat: :sparkles: customize theme and locale based on query params --- hooks/useLocale.js | 9 +++++++++ hooks/useTheme.js | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/hooks/useLocale.js b/hooks/useLocale.js index fdce6d91..339ff4ba 100644 --- a/hooks/useLocale.js +++ b/hooks/useLocale.js @@ -48,5 +48,14 @@ export default function useLocale() { } }, [locale]); + useEffect(() => { + const url = new URL(window.location.href); + const locale = url.searchParams.get('locale'); + + if (locale) { + saveLocale(locale); + } + }, []); + return { locale, saveLocale, messages, dir, dateLocale }; } diff --git a/hooks/useTheme.js b/hooks/useTheme.js index cc02631e..47ac31dd 100644 --- a/hooks/useTheme.js +++ b/hooks/useTheme.js @@ -23,5 +23,14 @@ export default function useTheme() { document.body.setAttribute('data-theme', theme); }, [theme]); + useEffect(() => { + const url = new URL(window.location.href); + const theme = url.searchParams.get('theme'); + + if (['light', 'dark'].includes(theme)) { + saveTheme(theme); + } + }, []); + return [theme, saveTheme]; } From 8234b4264ca80998155c9226fc870212fb4f1c26 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 25 Aug 2022 00:49:47 -0700 Subject: [PATCH 2/2] Skip database check during CI. --- .github/workflows/ci.yml | 1 + package.json | 2 +- scripts/check-db.js | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80db33c6..c24c2e6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ on: [push] env: DATABASE_TYPE: postgresql + SKIP_DB_CHECK: 1 jobs: build: diff --git a/package.json b/package.json index b0ee7429..6142816a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "umami", - "version": "1.37.0", + "version": "1.38.0-beta.1", "description": "A simple, fast, privacy-focused alternative to Google Analytics.", "author": "Mike Cao ", "license": "MIT", diff --git a/scripts/check-db.js b/scripts/check-db.js index 821e7f74..4de18a89 100644 --- a/scripts/check-db.js +++ b/scripts/check-db.js @@ -4,6 +4,11 @@ const chalk = require('chalk'); const spawn = require('cross-spawn'); const { execSync } = require('child_process'); +if (process.env.SKIP_DB_CHECK) { + console.log('Skipping database check.'); + process.exit(0); +} + const prisma = new PrismaClient(); function success(msg) {