Compare commits

..

No commits in common. "5398cd89fe7d4d27efc8d96a720e1d217954a43e" and "eb3cfbfa884f3003b786a17f785899861f83ecf1" have entirely different histories.

5 changed files with 25 additions and 22 deletions

View file

@ -42,7 +42,7 @@ RUN set -x \
&& apk add --no-cache curl
# Script dependencies
RUN pnpm add npm-run-all dotenv chalk semver prisma@6.18.0 @prisma/adapter-pg@6.18.0
RUN pnpm add npm-run-all dotenv chalk semver prisma@6.16.3 @prisma/adapter-pg@6.16.3
# Permissions for prisma
RUN chown -R nextjs:nodejs node_modules/.pnpm/

View file

@ -36,7 +36,7 @@ A detailed getting started guide can be found at [umami.is/docs](https://umami.i
### Requirements
- A server with Node.js version 18.18 or newer
- A database. Umami supports [PostgreSQL](https://www.postgresql.org/) (minimum v12.14) databases.
- A database. Umami supports [MariaDB](https://www.mariadb.org/) (minimum v10.5), [MySQL](https://www.mysql.com/) (minimum v8.0) and [PostgreSQL](https://www.postgresql.org/) (minimum v12.14) databases.
### Get the Source Code and Install Packages
@ -58,6 +58,7 @@ The connection URL format:
```bash
postgresql://username:mypassword@localhost:5432/mydb
mysql://username:mypassword@localhost:3306/mydb
```
### Build the Application
@ -92,6 +93,12 @@ Alternatively, to pull just the Umami Docker image with PostgreSQL support:
docker pull docker.umami.is/umami-software/umami:postgresql-latest
```
Or with MySQL support:
```bash
docker pull docker.umami.is/umami-software/umami:mysql-latest
```
---
## 🔄 Getting Updates

View file

@ -1,5 +1,6 @@
export const PRISMA = 'prisma';
export const POSTGRESQL = 'postgresql';
export const MYSQL = 'mysql';
export const CLICKHOUSE = 'clickhouse';
export const KAFKA = 'kafka';
export const KAFKA_PRODUCER = 'kafka-producer';
@ -30,7 +31,7 @@ export async function runQuery(queries: any) {
const db = getDatabaseType();
if (db === POSTGRESQL) {
if (db === POSTGRESQL || db === MYSQL) {
return queries[PRISMA]();
}
}

View file

@ -30,18 +30,10 @@ const PROVIDER_HEADERS = [
},
];
export function getDevice(userAgent: string, screen: string = '') {
export function getDevice(userAgent: string) {
const { device } = UAParser(userAgent);
const [width] = screen.split('x');
const type = device?.type || 'desktop';
if (type === 'desktop' && screen && +width <= 1920) {
return 'laptop';
}
return type;
return device?.type || 'desktop';
}
function getRegionCode(country: string, region: string) {
@ -116,7 +108,7 @@ export async function getClientInfo(request: Request, payload: Record<string, an
const city = safeDecodeURIComponent(location?.city);
const browser = browserName(userAgent);
const os = detectOS(userAgent) as string;
const device = getDevice(userAgent, payload?.screen);
const device = getDevice(userAgent);
return { userAgent, browser, os, ip, country, region, city, device };
}

View file

@ -1,16 +1,19 @@
// The order here is important and influences how IPs are detected by lib/detect.ts
// Please do not change the order unless you know exactly what you're doing - read https://developers.cloudflare.com/fundamentals/reference/http-headers/
export const IP_ADDRESS_HEADERS = [
'true-client-ip', // CDN
'x-real-ip', // Reverse proxy
'x-forwarded-for',
'cf-connecting-ip', // Cloudflare
'fastly-client-ip', // Fastly
'x-nf-client-connection-ip', // Netlify
'do-connecting-ip', // Digital Ocean
'x-appengine-user-ip', // Google App Ending
'x-client-ip',
'x-forwarded-for',
'cf-connecting-ip', // This should be *after* x-forwarded-for, so that x-forwarded-for is respected if present
'do-connecting-ip',
'fastly-client-ip',
'true-client-ip',
'x-real-ip',
'x-cluster-client-ip',
'x-forwarded',
'forwarded',
'x-appengine-user-ip',
'x-nf-client-connection-ip',
'x-real-ip',
];
export function getIpAddress(headers: Headers) {