Merge pull request #812 from mikecao/dev

v1.23.0
This commit is contained in:
Mike Cao 2021-10-06 00:47:27 -07:00 committed by GitHub
commit 2575cbfc11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 534 additions and 482 deletions

View File

@ -7,7 +7,7 @@ import { useEffect } from 'react';
export default function useTheme() {
const defaultTheme =
typeof window !== 'undefined'
? window?.matchMedia('prefers-color-scheme: dark')?.matches
? window?.matchMedia('(prefers-color-scheme: dark)')?.matches
? 'dark'
: 'light'
: 'light';

View File

@ -1,6 +1,6 @@
{
"label.accounts": "Konten",
"label.add-account": "Konto hinzugfügen",
"label.add-account": "Konto hinzufügen",
"label.add-website": "Webseite hinzufügen",
"label.administrator": "Administrator",
"label.all": "Alle",

103
lang/en-GB.json Normal file
View File

@ -0,0 +1,103 @@
{
"label.accounts": "Accounts",
"label.add-account": "Add account",
"label.add-website": "Add website",
"label.administrator": "Administrator",
"label.all": "All",
"label.all-websites": "All websites",
"label.all-events": "All events",
"label.back": "Back",
"label.cancel": "Cancel",
"label.change-password": "Change password",
"label.confirm-password": "Confirm password",
"label.copy-to-clipboard": "Copy to clipboard",
"label.current-password": "Current password",
"label.custom-range": "Custom range",
"label.dashboard": "Dashboard",
"label.date-range": "Date range",
"label.default-date-range": "Default date range",
"label.delete": "Delete",
"label.delete-account": "Delete account",
"label.delete-website": "Delete website",
"label.reset-website": "Reset statistics",
"label.dismiss": "Dismiss",
"label.domain": "Domain",
"label.edit": "Edit",
"label.edit-account": "Edit account",
"label.edit-website": "Edit website",
"label.enable-share-url": "Enable share URL",
"label.invalid": "Invalid",
"label.invalid-domain": "Invalid domain",
"label.last-days": "Last {x} days",
"label.last-hours": "Last {x} hours",
"label.logged-in-as": "Logged in as {username}",
"label.login": "Login",
"label.logout": "Logout",
"label.more": "More",
"label.name": "Name",
"label.new-password": "New password",
"label.password": "Password",
"label.passwords-dont-match": "Passwords don't match",
"label.profile": "Profile",
"label.realtime": "Realtime",
"label.realtime-logs": "Realtime logs",
"label.refresh": "Refresh",
"label.required": "Required",
"label.reset": "Reset",
"label.save": "Save",
"label.settings": "Settings",
"label.share-url": "Share URL",
"label.single-day": "Single day",
"label.this-month": "This month",
"label.this-week": "This week",
"label.this-year": "This year",
"label.timezone": "Timezone",
"label.today": "Today",
"label.tracking-code": "Tracking code",
"label.unknown": "Unknown",
"label.username": "Username",
"label.view-details": "View details",
"label.websites": "Websites",
"message.active-users": "{x} current {x, plural, one {visitor} other {visitors}}",
"message.confirm-reset": "Are your sure you want to reset {target}'s statistics?",
"message.confirm-delete": "Are your sure you want to delete {target}?",
"message.copied": "Copied!",
"message.reset-warning": "All statistics for this website will be deleted, but your tracking code will remain intact.",
"message.delete-warning": "All associated data will be deleted as well.",
"message.failure": "Something went wrong.",
"message.get-share-url": "Get share URL",
"message.get-tracking-code": "Get tracking code",
"message.go-to-settings": "Go to settings",
"message.incorrect-username-password": "Incorrect username/password.",
"message.log.visitor": "Visitor from {country} using {browser} on {os} {device}",
"message.new-version-available": "A new version of umami {version} is available!",
"message.no-data-available": "No data available.",
"message.no-websites-configured": "You don't have any websites configured.",
"message.page-not-found": "Page not found.",
"message.powered-by": "Powered by {name}",
"message.save-success": "Saved successfully.",
"message.share-url": "This is the publicly shared URL for {target}.",
"message.track-stats": "To track stats for {target}, place the following code in the {head} section of your website.",
"message.type-delete": "Type {delete} in the box below to confirm.",
"metrics.actions": "Actions",
"metrics.average-visit-time": "Average visit time",
"metrics.bounce-rate": "Bounce rate",
"metrics.browsers": "Browsers",
"metrics.countries": "Countries",
"metrics.device.desktop": "Desktop",
"metrics.device.laptop": "Laptop",
"metrics.device.mobile": "Mobile",
"metrics.device.tablet": "Tablet",
"metrics.devices": "Devices",
"metrics.events": "Events",
"metrics.filter.combined": "Combined",
"metrics.filter.domain-only": "Domain only",
"metrics.filter.raw": "Raw",
"metrics.operating-systems": "Operating systems",
"metrics.page-views": "Page views",
"metrics.pages": "Pages",
"metrics.referrers": "Referrers",
"metrics.unique-visitors": "Unique visitors",
"metrics.views": "Views",
"metrics.visitors": "Visitors"
}

View File

@ -19,6 +19,7 @@
"label.delete": "Удалить",
"label.delete-account": "Удалить аккаунт",
"label.delete-website": "Удалить сайт",
"label.reset-website": "Сбросить статистику",
"label.dismiss": "Отклонить",
"label.domain": "Домен",
"label.edit": "Редактировать",
@ -58,8 +59,10 @@
"label.view-details": "Посмотреть детали",
"label.websites": "Сайты",
"message.active-users": "{x} текущих посетителей",
"message.confirm-reset": "Вы уверены, что хотите сбросить статистику {target}?",
"message.confirm-delete": "Вы уверены, что хотите удалить {target}?",
"message.copied": "Скопировано!",
"message.reset-warning": "Вся статистика для этого сайта будет удалена, но ваш код отслеживания останется нетронутым.",
"message.delete-warning": "Все связанные данные будут также удалены.",
"message.failure": "Что-то пошло не так.",
"message.get-share-url": "Получить публичную ссылку",

View File

@ -6,6 +6,7 @@ import {
de,
el,
enUS,
enGB,
es,
fi,
fr,
@ -44,7 +45,8 @@ export const languages = {
'cs-CZ': { label: 'Čeština', display: 'cs' },
'da-DK': { label: 'Dansk', display: 'da' },
'de-DE': { label: 'Deutsch', display: 'de' },
'en-US': { label: 'English', display: 'en' },
'en-US': { label: 'English (US)', display: 'en' },
'en-GB': { label: 'English (UK)', display: 'en-GB'},
'es-MX': { label: 'Español', display: 'es' },
'fa-IR': { label: 'فارسی', display: 'fa' },
'fo-FO': { label: 'Føroyskt', display: 'fo' },
@ -67,7 +69,7 @@ export const languages = {
'ru-RU': { label: 'Русский', display: 'ru' },
'ro-RO': { label: 'Română', display: 'ro' },
'sk-SK': { label: 'Slovenčina', display: 'sk' },
'sl-SI': { label: 'Slovene', display: 'sl' },
'sl-SI': { label: 'Slovenščina', display: 'sl' },
'fi-FI': { label: 'Suomi', display: 'fi' },
'sv-SE': { label: 'Svenska', display: 'sv' },
'ta-IN': { label: 'தமிழ்', display: 'ta' },
@ -80,6 +82,7 @@ export const rtlLocales = ['ar-SA', 'fa-IR'];
export const dateLocales = {
'ar-SA': arSA,
'en-US': enUS,
'en-GB': enGB,
'nl-NL': nl,
'zh-CN': zhCN,
'zh-TW': zhTW,

View File

@ -465,15 +465,21 @@ export function getEventMetrics(
filters = {},
) {
const params = [website_id, start_at, end_at];
const { url } = filters;
const { url, event_type } = filters;
let urlFilter = '';
let eventTypeFilter = '';
if (url) {
urlFilter = `and url=$${params.length + 1}`;
params.push(decodeURIComponent(url));
}
if (event_type) {
eventTypeFilter = `and event_type=$${params.length + 1}`;
params.push(event_type);
}
return rawQuery(
`
select
@ -484,6 +490,7 @@ export function getEventMetrics(
where website_id=$1
and created_at between $2 and $3
${urlFilter}
${eventTypeFilter}
group by 1, 2
order by 2
`,

View File

@ -1,6 +1,6 @@
{
"name": "umami",
"version": "1.22.0",
"version": "1.23.0",
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao <mike@mikecao.com>",
"license": "MIT",
@ -56,10 +56,10 @@
}
},
"dependencies": {
"@fontsource/inter": "^4.5.0",
"@fontsource/noto-sans-jp": "^4.5.0",
"@fontsource/noto-sans-sc": "^4.5.0",
"@fontsource/noto-sans-tc": "^4.5.0",
"@fontsource/inter": "4.5.0",
"@fontsource/noto-sans-jp": "4.5.0",
"@fontsource/noto-sans-sc": "4.5.0",
"@fontsource/noto-sans-tc": "4.5.0",
"@prisma/client": "2.29.1",
"@reduxjs/toolkit": "^1.6.1",
"bcryptjs": "^2.4.3",
@ -73,7 +73,7 @@
"detect-browser": "^5.2.0",
"dotenv": "^8.2.0",
"formik": "^2.2.9",
"immer": "^9.0.5",
"immer": "^9.0.6",
"ipaddr.js": "^2.0.1",
"is-localhost-ip": "^1.4.0",
"isbot": "^3.2.2",

View File

@ -2,11 +2,15 @@ import { serialize } from 'cookie';
import { checkPassword, createSecureToken } from 'lib/crypto';
import { getAccountByUsername } from 'lib/queries';
import { AUTH_COOKIE_NAME } from 'lib/constants';
import { ok, unauthorized } from 'lib/response';
import { ok, unauthorized, badRequest } from 'lib/response';
export default async (req, res) => {
const { username, password } = req.body;
if (!username || !password) {
return badRequest(res);
}
const account = await getAccountByUsername(username);
if (account && (await checkPassword(password, account.password))) {

View File

@ -11,7 +11,7 @@ export default async (req, res) => {
return unauthorized(res);
}
const { id, start_at, end_at, unit, tz, url } = req.query;
const { id, start_at, end_at, unit, tz, url, event_type } = req.query;
if (!moment.tz.zone(tz) || !unitTypes.includes(unit)) {
return badRequest(res);
@ -21,7 +21,10 @@ export default async (req, res) => {
const startDate = new Date(+start_at);
const endDate = new Date(+end_at);
const events = await getEventMetrics(websiteId, startDate, endDate, tz, unit, { url });
const events = await getEventMetrics(websiteId, startDate, endDate, tz, unit, {
url,
event_type,
});
return ok(res, events);
}

View File

@ -0,0 +1 @@
{"AF":"Afghanistan","AX":"\u00c5land Islands","AL":"Albania","DZ":"Algeria","AS":"American Samoa","AD":"Andorra","AO":"Angola","AI":"Anguilla","AQ":"Antarctica","AG":"Antigua & Barbuda","AR":"Argentina","AM":"Armenia","AW":"Aruba","AU":"Australia","AT":"Austria","AZ":"Azerbaijan","BS":"Bahamas","BH":"Bahrain","BD":"Bangladesh","BB":"Barbados","BY":"Belarus","BE":"Belgium","BZ":"Belize","BJ":"Benin","BM":"Bermuda","BT":"Bhutan","BO":"Bolivia","BA":"Bosnia & Herzegovina","BW":"Botswana","BV":"Bouvet Island","BR":"Brazil","IO":"British Indian Ocean Territory","VG":"British Virgin Islands","BN":"Brunei","BG":"Bulgaria","BF":"Burkina Faso","BI":"Burundi","KH":"Cambodia","CM":"Cameroon","CA":"Canada","CV":"Cape Verde","BQ":"Caribbean Netherlands","KY":"Cayman Islands","CF":"Central African Republic","TD":"Chad","CL":"Chile","CN":"China","CX":"Christmas Island","CC":"Cocos (Keeling) Islands","CO":"Colombia","KM":"Comoros","CG":"Congo - Brazzaville","CD":"Congo - Kinshasa","CK":"Cook Islands","CR":"Costa Rica","CI":"C\u00f4te d\u2019Ivoire","HR":"Croatia","CU":"Cuba","CW":"Cura\u00e7ao","CY":"Cyprus","CZ":"Czechia","DK":"Denmark","DJ":"Djibouti","DM":"Dominica","DO":"Dominican Republic","EC":"Ecuador","EG":"Egypt","SV":"El Salvador","GQ":"Equatorial Guinea","ER":"Eritrea","EE":"Estonia","SZ":"Eswatini","ET":"Ethiopia","FK":"Falkland Islands","FO":"Faroe Islands","FJ":"Fiji","FI":"Finland","FR":"France","GF":"French Guiana","PF":"French Polynesia","TF":"French Southern Territories","GA":"Gabon","GM":"Gambia","GE":"Georgia","DE":"Germany","GH":"Ghana","GI":"Gibraltar","GR":"Greece","GL":"Greenland","GD":"Grenada","GP":"Guadeloupe","GU":"Guam","GT":"Guatemala","GG":"Guernsey","GN":"Guinea","GW":"Guinea-Bissau","GY":"Guyana","HT":"Haiti","HM":"Heard & McDonald Islands","HN":"Honduras","HK":"Hong Kong SAR China","HU":"Hungary","IS":"Iceland","IN":"India","ID":"Indonesia","IR":"Iran","IQ":"Iraq","IE":"Ireland","IM":"Isle of Man","IL":"Israel","IT":"Italy","JM":"Jamaica","JP":"Japan","JE":"Jersey","JO":"Jordan","KZ":"Kazakhstan","KE":"Kenya","KI":"Kiribati","KW":"Kuwait","KG":"Kyrgyzstan","LA":"Laos","LV":"Latvia","LB":"Lebanon","LS":"Lesotho","LR":"Liberia","LY":"Libya","LI":"Liechtenstein","LT":"Lithuania","LU":"Luxembourg","MO":"Macao SAR China","MG":"Madagascar","MW":"Malawi","MY":"Malaysia","MV":"Maldives","ML":"Mali","MT":"Malta","MH":"Marshall Islands","MQ":"Martinique","MR":"Mauritania","MU":"Mauritius","YT":"Mayotte","MX":"Mexico","FM":"Micronesia","MD":"Moldova","MC":"Monaco","MN":"Mongolia","ME":"Montenegro","MS":"Montserrat","MA":"Morocco","MZ":"Mozambique","MM":"Myanmar (Burma)","NA":"Namibia","NR":"Nauru","NP":"Nepal","NL":"Netherlands","NC":"New Caledonia","NZ":"New Zealand","NI":"Nicaragua","NE":"Niger","NG":"Nigeria","NU":"Niue","NF":"Norfolk Island","KP":"North Korea","MK":"North Macedonia","MP":"Northern Mariana Islands","NO":"Norway","OM":"Oman","PK":"Pakistan","PW":"Palau","PS":"Palestinian Territories","PA":"Panama","PG":"Papua New Guinea","PY":"Paraguay","PE":"Peru","PH":"Philippines","PN":"Pitcairn Islands","PL":"Poland","PT":"Portugal","PR":"Puerto Rico","QA":"Qatar","RE":"R\u00e9union","RO":"Romania","RU":"Russia","RW":"Rwanda","WS":"Samoa","SM":"San Marino","ST":"S\u00e3o Tom\u00e9 & Pr\u00edncipe","SA":"Saudi Arabia","SN":"Senegal","RS":"Serbia","SC":"Seychelles","SL":"Sierra Leone","SG":"Singapore","SX":"Sint Maarten","SK":"Slovakia","SI":"Slovenia","SB":"Solomon Islands","SO":"Somalia","ZA":"South Africa","GS":"South Georgia & South Sandwich Islands","KR":"South Korea","SS":"South Sudan","ES":"Spain","LK":"Sri Lanka","BL":"St. Barth\u00e9lemy","SH":"St. Helena","KN":"St. Kitts & Nevis","LC":"St. Lucia","MF":"St. Martin","PM":"St. Pierre & Miquelon","VC":"St. Vincent & Grenadines","SD":"Sudan","SR":"Suriname","SJ":"Svalbard & Jan Mayen","SE":"Sweden","CH":"Switzerland","SY":"Syria","TW":"Taiwan","TJ":"Tajikistan","TZ":"Tanzania","TH":"Thailand","TL":"Timor-Leste","TG":"Togo","TK":"Tokelau","TO":"Tonga","TT":"Trinidad & Tobago","TN":"Tunisia","TR":"Turkey","TM":"Turkmenistan","TC":"Turks & Caicos Islands","TV":"Tuvalu","UM":"U.S. Outlying Islands","VI":"U.S. Virgin Islands","UG":"Uganda","UA":"Ukraine","AE":"United Arab Emirates","GB":"United Kingdom","US":"United States","UY":"Uruguay","UZ":"Uzbekistan","VU":"Vanuatu","VA":"Vatican City","VE":"Venezuela","VN":"Vietnam","WF":"Wallis & Futuna","EH":"Western Sahara","YE":"Yemen","ZM":"Zambia","ZW":"Zimbabwe"}

864
yarn.lock

File diff suppressed because it is too large Load Diff