From f5ecc401bf47be9bb8844c7678938d3c07ba6db7 Mon Sep 17 00:00:00 2001 From: Manda Putra Date: Sun, 26 Dec 2021 08:01:57 +0700 Subject: [PATCH 1/6] draft: implement realtime current users --- README.md | 7 +++++-- components/metrics/RealtimeHeader.js | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 98fe2150..39feb395 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ A detailed getting started guide can be found at [https://umami.is/docs/](https: ``` git clone https://github.com/mikecao/umami.git cd umami -npm install +yarn ``` ### Create database tables @@ -50,6 +50,7 @@ HASH_SALT=(any random string) ``` The connection url is in the following format: + ``` postgresql://username:mypassword@localhost:5432/mydb @@ -70,7 +71,7 @@ npm run build npm start ``` -By default this will launch the application on `http://localhost:3000`. You will need to either +By default this will launch the application on `http://localhost:3000`. You will need to either [proxy](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/) requests from your web server or change the [port](https://nextjs.org/docs/api-reference/cli#production) to serve the application directly. @@ -83,11 +84,13 @@ docker-compose up ``` Alternatively, to pull just the Umami Docker image with PostgreSQL support: + ```bash docker pull ghcr.io/mikecao/umami:postgresql-latest ``` Or with MySQL support: + ```bash docker pull ghcr.io/mikecao/umami:mysql-latest ``` diff --git a/components/metrics/RealtimeHeader.js b/components/metrics/RealtimeHeader.js index c501937a..204339b8 100644 --- a/components/metrics/RealtimeHeader.js +++ b/components/metrics/RealtimeHeader.js @@ -2,6 +2,7 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; import PageHeader from '../layout/PageHeader'; import DropDown from '../common/DropDown'; +import ActiveUsers from './ActiveUsers'; import MetricCard from './MetricCard'; import styles from './RealtimeHeader.module.css'; @@ -24,6 +25,9 @@ export default function RealtimeHeader({ websites, data, websiteId, onSelect })
+
+ +
From dc29d8ed77458466e48c6fefa587a64d3d06ebc3 Mon Sep 17 00:00:00 2001 From: Manda Putra Date: Sun, 26 Dec 2021 08:12:49 +0700 Subject: [PATCH 2/6] add info for development --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 39feb395..7b845c1c 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,8 @@ The `HASH_SALT` is used to generate unique values for your installation. ### Build the application +For development purpose, you need to build first that is because the application need to prepare language and geo setting. + ```bash npm run build ``` From 7d9372baa7c2d0e9ae768d802988ca141b067e17 Mon Sep 17 00:00:00 2001 From: Manda Putra Date: Sun, 26 Dec 2021 11:37:41 +0700 Subject: [PATCH 3/6] change every npm run with yarn --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7b845c1c..80601028 100644 --- a/README.md +++ b/README.md @@ -64,13 +64,13 @@ The `HASH_SALT` is used to generate unique values for your installation. For development purpose, you need to build first that is because the application need to prepare language and geo setting. ```bash -npm run build +yarn build ``` ### Start the application ```bash -npm start +yarn start ``` By default this will launch the application on `http://localhost:3000`. You will need to either @@ -103,8 +103,8 @@ To get the latest features, simply do a pull, install any new dependencies, and ```bash git pull -npm install -npm run build +yarn +yarn build ``` ## License From 20fa2d8fb204b2b285922a3925a5a25388ca371f Mon Sep 17 00:00:00 2001 From: P-Chan Date: Tue, 4 Jan 2022 17:55:51 +0900 Subject: [PATCH 4/6] Fix runtime error when device is null Fix #904 --- components/metrics/RealtimeLog.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/metrics/RealtimeLog.js b/components/metrics/RealtimeLog.js index 81e25d2e..34de4e6a 100644 --- a/components/metrics/RealtimeLog.js +++ b/components/metrics/RealtimeLog.js @@ -137,7 +137,11 @@ export default function RealtimeLog({ data, websites, websiteId }) { ), browser: {BROWSERS[browser]}, os: {os}, - device: {intl.formatMessage(devices[device])?.toLowerCase()}, + device: + {devices[device] + ? intl.formatMessage(devices[device]).toLowerCase() + : intl.formatMessage({ id: 'label.unknown', defaultMessage: 'Unknown' })} + , }} /> ); From 56c0837e831a9b8e1203f2cdaf21e0e173f49408 Mon Sep 17 00:00:00 2001 From: P-Chan Date: Wed, 5 Jan 2022 20:25:53 +0900 Subject: [PATCH 5/6] Refactor device message --- components/metrics/RealtimeLog.js | 8 ++------ pages/api/collect.js | 2 ++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/components/metrics/RealtimeLog.js b/components/metrics/RealtimeLog.js index 34de4e6a..8ea917df 100644 --- a/components/metrics/RealtimeLog.js +++ b/components/metrics/RealtimeLog.js @@ -7,7 +7,7 @@ import Tag from 'components/common/Tag'; import Dot from 'components/common/Dot'; import FilterButtons from 'components/common/FilterButtons'; import NoData from 'components/common/NoData'; -import { devices } from 'components/messages'; +import { devices, getDeviceMessage } from 'components/messages'; import useLocale from 'hooks/useLocale'; import useCountryNames from 'hooks/useCountryNames'; import { BROWSERS } from 'lib/constants'; @@ -137,11 +137,7 @@ export default function RealtimeLog({ data, websites, websiteId }) { ), browser: {BROWSERS[browser]}, os: {os}, - device: - {devices[device] - ? intl.formatMessage(devices[device]).toLowerCase() - : intl.formatMessage({ id: 'label.unknown', defaultMessage: 'Unknown' })} - , + device: {getDeviceMessage(devices[device])}, }} /> ); diff --git a/pages/api/collect.js b/pages/api/collect.js index 41c9cabb..40a913a0 100644 --- a/pages/api/collect.js +++ b/pages/api/collect.js @@ -9,6 +9,8 @@ import { createToken } from 'lib/crypto'; export default async (req, res) => { await useCors(req, res); + console.log('hi!'); + if (isbot(req.headers['user-agent'])) { return ok(res); } From f10a8224f151a3e75264dd099451dcf43d30ec51 Mon Sep 17 00:00:00 2001 From: Manda Putra Date: Sat, 8 Jan 2022 00:32:56 +0700 Subject: [PATCH 6/6] reset readme --- README.md | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 80601028..98fe2150 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ A detailed getting started guide can be found at [https://umami.is/docs/](https: ``` git clone https://github.com/mikecao/umami.git cd umami -yarn +npm install ``` ### Create database tables @@ -50,7 +50,6 @@ HASH_SALT=(any random string) ``` The connection url is in the following format: - ``` postgresql://username:mypassword@localhost:5432/mydb @@ -61,19 +60,17 @@ The `HASH_SALT` is used to generate unique values for your installation. ### Build the application -For development purpose, you need to build first that is because the application need to prepare language and geo setting. - ```bash -yarn build +npm run build ``` ### Start the application ```bash -yarn start +npm start ``` -By default this will launch the application on `http://localhost:3000`. You will need to either +By default this will launch the application on `http://localhost:3000`. You will need to either [proxy](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/) requests from your web server or change the [port](https://nextjs.org/docs/api-reference/cli#production) to serve the application directly. @@ -86,13 +83,11 @@ docker-compose up ``` Alternatively, to pull just the Umami Docker image with PostgreSQL support: - ```bash docker pull ghcr.io/mikecao/umami:postgresql-latest ``` Or with MySQL support: - ```bash docker pull ghcr.io/mikecao/umami:mysql-latest ``` @@ -103,8 +98,8 @@ To get the latest features, simply do a pull, install any new dependencies, and ```bash git pull -yarn -yarn build +npm install +npm run build ``` ## License