Skip to content

Commit

Permalink
Merge pull request umami-software#459 from mikecao/dev
Browse files Browse the repository at this point in the history
v1.12.0
  • Loading branch information
mikecao authored Feb 2, 2021
2 parents 0b8336f + 88452ad commit 30ebf7b
Show file tree
Hide file tree
Showing 14 changed files with 443 additions and 1,807 deletions.
2 changes: 1 addition & 1 deletion components/common/DropDown.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function DropDown({
}

useDocumentClick(e => {
if (!ref.current.contains(e.target)) {
if (!ref.current?.contains(e.target)) {
setShowMenu(false);
}
});
Expand Down
2 changes: 1 addition & 1 deletion components/common/MenuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function MenuButton({
}

useDocumentClick(e => {
if (!ref.current.contains(e.target)) {
if (!ref.current?.contains(e.target)) {
setShowMenu(false);
}
});
Expand Down
19 changes: 15 additions & 4 deletions components/metrics/WebsiteHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,23 @@ import Arrow from 'assets/arrow-right.svg';
import styles from './WebsiteHeader.module.css';

export default function WebsiteHeader({ websiteId, title, domain, showLink = false }) {
const header = showLink ? (
<>
<Favicon domain={domain} />
<Link href="/website/[...id]" as={`/website/${websiteId}/${title}`}>
{title}
</Link>
</>
) : (
<div>
<Favicon domain={domain} />
{title}
</div>
);

return (
<PageHeader>
<div className={styles.title}>
<Favicon domain={domain} />
{title}
</div>
<div className={styles.title}>{header}</div>
<ActiveUsers className={styles.active} websiteId={websiteId} />
<ButtonLayout align="right">
<RefreshButton websiteId={websiteId} />
Expand Down
15 changes: 7 additions & 8 deletions components/settings/AccountSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ export default function AccountSettings() {

const Checkmark = ({ is_admin }) => (is_admin ? <Icon icon={<Check />} size="medium" /> : null);

const DashboardLink = row =>
row.is_admin ? null : (
<Link href={`/dashboard/${row.user_id}/${row.username}`}>
<a>
<Icon icon={<LinkIcon />} />
</a>
</Link>
);
const DashboardLink = row => (
<Link href={`/dashboard/${row.user_id}/${row.username}`}>
<a>
<Icon icon={<LinkIcon />} />
</a>
</Link>
);

const Buttons = row =>
row.username !== 'admin' ? (
Expand Down
2 changes: 1 addition & 1 deletion components/settings/LanguageButton.module.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.menu {
display: flex;
flex-flow: row wrap;
min-width: 500px;
min-width: 560px;
max-width: 100vw;
padding: 10px;
}
Expand Down
2 changes: 1 addition & 1 deletion lang/pl-PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"label.login": "Zaloguj sie",
"label.logout": "Wyloguj",
"label.more": "Więcej",
"label.name": "Name",
"label.name": "Nazwa",
"label.new-password": "Nowe hasło",
"label.password": "Hasło",
"label.passwords-dont-match": "Hasła się nie zgadzają",
Expand Down
99 changes: 99 additions & 0 deletions lang/pt-BR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"label.accounts": "Contas",
"label.add-account": "Adicionar conta",
"label.add-website": "Adicionar site",
"label.administrator": "Administrador",
"label.all": "Todos",
"label.all-websites": "Todos os sites",
"label.back": "Voltar",
"label.cancel": "Cancelar",
"label.change-password": "Alterar a senha",
"label.confirm-password": "Confirme a nova senha",
"label.copy-to-clipboard": "Copiar para a área de transferência",
"label.current-password": "Senha atual",
"label.custom-range": "Intervalo personalizado",
"label.dashboard": "Painel",
"label.date-range": "Intervalo de datas",
"label.default-date-range": "Intervalo de datas predefinido",
"label.delete": "Remover",
"label.delete-account": "Remover conta",
"label.delete-website": "Remover site",
"label.dismiss": "Dispensar",
"label.domain": "Domínio",
"label.edit": "Editar",
"label.edit-account": "Editar conta",
"label.edit-website": "Editar site",
"label.enable-share-url": "Ativar link de compartilhamento",
"label.invalid": "Inválido",
"label.invalid-domain": "Domínio inválido",
"label.last-days": "Últimos {x} dias",
"label.last-hours": "Últimas {x} horas",
"label.logged-in-as": "Sessão iniciada como {username}",
"label.login": "Iniciar sessão",
"label.logout": "Sair",
"label.more": "Mais",
"label.name": "Nome",
"label.new-password": "Nova senha",
"label.password": "Senha",
"label.passwords-dont-match": "As senhas não correspondem",
"label.profile": "Perfil",
"label.realtime": "Tempo real",
"label.realtime-logs": "Relatório em tempo real",
"label.refresh": "Atualizar",
"label.required": "Obrigatório",
"label.reset": "Redefinir",
"label.save": "Salvar",
"label.settings": "Configurações",
"label.share-url": "Link de compartilhamento",
"label.single-day": "Dia específico",
"label.this-month": "Este mês",
"label.this-week": "Esta semana",
"label.this-year": "Este ano",
"label.timezone": "Fuso horário",
"label.today": "Hoje",
"label.tracking-code": "Código de rastreamento",
"label.unknown": "Desconhecido",
"label.username": "Nome de usuário",
"label.view-details": "Ver detalhes",
"label.websites": "Sites",
"message.active-users": "{x} {x, plural, one {visitante} other {visitantes}} neste momento",
"message.confirm-delete": "Deseja realmente remover {target}?",
"message.copied": "Copiado!",
"message.delete-warning": "Todos os dados associados também serão eliminados.",
"message.failure": "Ocorreu um erro.",
"message.get-share-url": "Obter link de compartilhamento",
"message.get-tracking-code": "Obter código de rastreamento",
"message.go-to-settings": "Ir para as configurações",
"message.incorrect-username-password": "O nome de usuário e/ou senha está incorreto.",
"message.log.visitor": "Visitante de {country} usando {browser} no {device} {os}",
"message.new-version-available": "Uma nova versão de umami {version} está disponível!",
"message.no-data-available": "Sem dados disponíveis.",
"message.no-websites-configured": "Nenhum site foi configurado ainda.",
"message.page-not-found": "Página não encontrada.",
"message.powered-by": "Distribuído por {name}",
"message.save-success": "Salvo com sucesso.",
"message.share-url": "Este é o link público de compartilhamento para {target}.",
"message.track-stats": "Para gerar estatística para {target}, coloque o seguinte código no {head} do html do seu site.",
"message.type-delete": "Escreva {delete} abaixo para continuar.",
"metrics.actions": "Ações",
"metrics.average-visit-time": "Tempo médio da visita",
"metrics.bounce-rate": "Taxa de rejeição",
"metrics.browsers": "Navegadores",
"metrics.countries": "Países",
"metrics.device.desktop": "Computador",
"metrics.device.laptop": "Notebook",
"metrics.device.mobile": "Celular",
"metrics.device.tablet": "Tablet",
"metrics.devices": "Dispositivos",
"metrics.events": "Eventos",
"metrics.filter.combined": "Combinado",
"metrics.filter.domain-only": "Apenas domínio",
"metrics.filter.raw": "Dados brutos",
"metrics.operating-systems": "Sistemas operacionais",
"metrics.page-views": "Visualizações de página",
"metrics.pages": "Páginas",
"metrics.referrers": "Referências",
"metrics.unique-visitors": "Visitantes únicos",
"metrics.views": "Visualizações",
"metrics.visitors": "Visitantes"
}
2 changes: 1 addition & 1 deletion lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const BROWSERS = {
edge: 'Edge',
'edge-ios': 'Edge (iOS)',
yandexbrowser: 'Yandex',
kakaotalk: 'KKaoTalk',
kakaotalk: 'KaKaoTalk',
samsung: 'Samsung',
silk: 'Silk',
miui: 'MIUI',
Expand Down
5 changes: 5 additions & 0 deletions lib/lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
nl,
pl,
pt,
ptBR,
ro,
ru,
sv,
Expand All @@ -42,6 +43,7 @@ import svMessages from 'lang-compiled/sv-SE.json';
import grMessages from 'lang-compiled/el-GR.json';
import foMessages from 'lang-compiled/fo-FO.json';
import ptMessages from 'lang-compiled/pt-PT.json';
import ptBRMessages from 'lang-compiled/pt-BR.json';
import roMessages from 'lang-compiled/ro-RO.json';
import nbNOMessages from 'lang-compiled/nb-NO.json';
import idMessages from 'lang-compiled/id-ID.json';
Expand Down Expand Up @@ -71,6 +73,7 @@ export const messages = {
'el-GR': grMessages,
'fo-FO': foMessages,
'pt-PT': ptMessages,
'pt-BR': ptBRMessages,
'ro-RO': roMessages,
'nb-NO': nbNOMessages,
'id-ID': idMessages,
Expand Down Expand Up @@ -101,6 +104,7 @@ export const dateLocales = {
'el-GR': el,
'fo-FO': da,
'pt-PT': pt,
'pt-BR': ptBR,
'ro-RO': ro,
'nb-NO': nb,
'id-ID': id,
Expand Down Expand Up @@ -135,6 +139,7 @@ export const menuOptions = [
{ label: 'Norsk Bokmål', value: 'nb-NO', display: 'nb' },
{ label: 'Polski', value: 'pl-PL', display: 'pl' },
{ label: 'Português', value: 'pt-PT', display: 'pt' },
{ label: 'Português do Brasil', value: 'pt-BR', display: 'pt-BR' },
{ label: 'Русский', value: 'ru-RU', display: 'ru' },
{ label: 'Română', value: 'ro-RO', display: 'ro' },
{ label: 'Suomi', value: 'fi-FI', display: 'fi' },
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "umami",
"version": "1.11.0",
"version": "1.12.0",
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -56,7 +56,7 @@
}
},
"dependencies": {
"@prisma/client": "2.14.0",
"@prisma/client": "2.15.0",
"@reduxjs/toolkit": "^1.5.0",
"bcrypt": "^5.0.0",
"chalk": "^4.1.0",
Expand All @@ -69,17 +69,17 @@
"detect-browser": "^5.2.0",
"dotenv": "^8.2.0",
"formik": "^2.2.6",
"immer": "^8.0.0",
"immer": "^8.0.1",
"is-localhost-ip": "^1.4.0",
"isbot-fast": "^1.2.0",
"jose": "2.0.3",
"maxmind": "^4.3.1",
"moment-timezone": "^0.5.32",
"next": "^10.0.5",
"next": "^10.0.6",
"prompts": "2.4.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-intl": "^5.10.16",
"react-intl": "^5.12.0",
"react-redux": "^7.2.2",
"react-simple-maps": "^2.3.0",
"react-spring": "^8.0.27",
Expand All @@ -97,21 +97,21 @@
},
"devDependencies": {
"@formatjs/cli": "^2.13.16",
"@prisma/cli": "2.14.0",
"@prisma/cli": "2.15.0",
"@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-node-resolve": "^11.0.1",
"@rollup/plugin-node-resolve": "^11.1.1",
"@rollup/plugin-replace": "^2.3.4",
"@svgr/webpack": "^5.5.0",
"cross-env": "^7.0.3",
"del": "^6.0.0",
"dotenv-cli": "^4.0.0",
"eslint": "^7.17.0",
"eslint-config-prettier": "^7.1.0",
"eslint": "^7.19.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"extract-react-intl-messages": "^4.1.1",
"husky": "^4.3.7",
"husky": "^4.3.8",
"lint-staged": "^10.5.3",
"loadtest": "5.1.2",
"npm-run-all": "^4.1.5",
Expand All @@ -120,10 +120,10 @@
"postcss-preset-env": "^6.7.0",
"prettier": "^2.2.1",
"prettier-eslint": "^12.0.0",
"rollup": "^2.36.1",
"rollup": "^2.38.3",
"rollup-plugin-hashbang": "^2.2.2",
"rollup-plugin-terser": "^7.0.2",
"stylelint": "^13.8.0",
"stylelint": "^13.9.0",
"stylelint-config-css-modules": "^2.2.0",
"stylelint-config-prettier": "^8.0.1",
"stylelint-config-recommended": "^3.0.0",
Expand Down
1 change: 1 addition & 0 deletions public/country/pt-BR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"AF":"Afeganist\u00e3o","ZA":"\u00c1frica do Sul","AL":"Alb\u00e2nia","DE":"Alemanha","AD":"Andorra","AO":"Angola","AI":"Anguila","AQ":"Ant\u00e1rtida","AG":"Ant\u00edgua e Barbuda","SA":"Ar\u00e1bia Saudita","DZ":"Arg\u00e9lia","AR":"Argentina","AM":"Arm\u00eania","AW":"Aruba","AU":"Austr\u00e1lia","AT":"\u00c1ustria","AZ":"Azerbaij\u00e3o","BS":"Bahamas","BH":"Bahrein","BD":"Bangladesh","BB":"Barbados","BE":"B\u00e9lgica","BZ":"Belize","BJ":"Benin","BM":"Bermudas","BY":"Bielorr\u00fassia","BO":"Bol\u00edvia","BA":"B\u00f3snia e Herzegovina","BW":"Botsuana","BR":"Brasil","BN":"Brunei","BG":"Bulg\u00e1ria","BF":"Burquina Faso","BI":"Burundi","BT":"But\u00e3o","CV":"Cabo Verde","CM":"Camar\u00f5es","KH":"Camboja","CA":"Canad\u00e1","QA":"Catar","KZ":"Cazaquist\u00e3o","TD":"Chade","CL":"Chile","CN":"China","CY":"Chipre","VA":"Cidade do Vaticano","CO":"Col\u00f4mbia","KM":"Comores","CD":"Congo - Kinshasa","KP":"Coreia do Norte","KR":"Coreia do Sul","CI":"Costa do Marfim","CR":"Costa Rica","HR":"Cro\u00e1cia","CU":"Cuba","CW":"Cura\u00e7ao","DK":"Dinamarca","DJ":"Djibuti","DM":"Dominica","EG":"Egito","SV":"El Salvador","AE":"Emirados \u00c1rabes Unidos","EC":"Equador","ER":"Eritreia","SK":"Eslov\u00e1quia","SI":"Eslov\u00eania","ES":"Espanha","SZ":"Essuat\u00edni","US":"Estados Unidos","EE":"Est\u00f4nia","ET":"Eti\u00f3pia","FJ":"Fiji","PH":"Filipinas","FI":"Finl\u00e2ndia","FR":"Fran\u00e7a","GA":"Gab\u00e3o","GM":"G\u00e2mbia","GH":"Gana","GE":"Ge\u00f3rgia","GI":"Gibraltar","GD":"Granada","GR":"Gr\u00e9cia","GL":"Groenl\u00e2ndia","GP":"Guadalupe","GU":"Guam","GT":"Guatemala","GG":"Guernsey","GY":"Guiana","GF":"Guiana Francesa","GN":"Guin\u00e9","GQ":"Guin\u00e9 Equatorial","GW":"Guin\u00e9-Bissau","HT":"Haiti","HN":"Honduras","HK":"Hong Kong, RAE da China","HU":"Hungria","YE":"I\u00eamen","BV":"Ilha Bouvet","CX":"Ilha Christmas","IM":"Ilha de Man","NF":"Ilha Norfolk","AX":"Ilhas Aland","KY":"Ilhas Cayman","CC":"Ilhas Cocos (Keeling)","CK":"Ilhas Cook","FO":"Ilhas Faroe","GS":"Ilhas Ge\u00f3rgia do Sul e Sandwich do Sul","HM":"Ilhas Heard e McDonald","FK":"Ilhas Malvinas","MP":"Ilhas Marianas do Norte","MH":"Ilhas Marshall","UM":"Ilhas Menores Distantes dos EUA","PN":"Ilhas Pitcairn","SB":"Ilhas Salom\u00e3o","TC":"Ilhas Turcas e Caicos","VI":"Ilhas Virgens Americanas","VG":"Ilhas Virgens Brit\u00e2nicas","IN":"\u00cdndia","ID":"Indon\u00e9sia","IR":"Ir\u00e3","IQ":"Iraque","IE":"Irlanda","IS":"Isl\u00e2ndia","IL":"Israel","IT":"It\u00e1lia","JM":"Jamaica","JP":"Jap\u00e3o","JE":"Jersey","JO":"Jord\u00e2nia","KW":"Kuwait","LA":"Laos","LS":"Lesoto","LV":"Let\u00f4nia","LB":"L\u00edbano","LR":"Lib\u00e9ria","LY":"L\u00edbia","LI":"Liechtenstein","LT":"Litu\u00e2nia","LU":"Luxemburgo","MO":"Macau, RAE da China","MK":"Maced\u00f4nia do Norte","MG":"Madagascar","MY":"Mal\u00e1sia","MW":"Malaui","MV":"Maldivas","ML":"Mali","MT":"Malta","MA":"Marrocos","MQ":"Martinica","MU":"Maur\u00edcio","MR":"Maurit\u00e2nia","YT":"Mayotte","MX":"M\u00e9xico","MM":"Mianmar (Birm\u00e2nia)","FM":"Micron\u00e9sia","MZ":"Mo\u00e7ambique","MD":"Moldova","MC":"M\u00f4naco","MN":"Mong\u00f3lia","ME":"Montenegro","MS":"Montserrat","NA":"Nam\u00edbia","NR":"Nauru","NP":"Nepal","NI":"Nicar\u00e1gua","NE":"N\u00edger","NG":"Nig\u00e9ria","NU":"Niue","NO":"Noruega","NC":"Nova Caled\u00f4nia","NZ":"Nova Zel\u00e2ndia","OM":"Om\u00e3","NL":"Pa\u00edses Baixos","BQ":"Pa\u00edses Baixos Caribenhos","PW":"Palau","PA":"Panam\u00e1","PG":"Papua-Nova Guin\u00e9","PK":"Paquist\u00e3o","PY":"Paraguai","PE":"Peru","PF":"Polin\u00e9sia Francesa","PL":"Pol\u00f4nia","PR":"Porto Rico","PT":"Portugal","KE":"Qu\u00eania","KG":"Quirguist\u00e3o","KI":"Quiribati","GB":"Reino Unido","CF":"Rep\u00fablica Centro-Africana","CG":"Rep\u00fablica do Congo","DO":"Rep\u00fablica Dominicana","RE":"Reuni\u00e3o","RO":"Rom\u00eania","RW":"Ruanda","RU":"R\u00fassia","EH":"Saara Ocidental","WS":"Samoa","AS":"Samoa Americana","SM":"San Marino","SH":"Santa Helena","LC":"Santa L\u00facia","BL":"S\u00e3o Bartolomeu","KN":"S\u00e3o Crist\u00f3v\u00e3o e N\u00e9vis","MF":"S\u00e3o Martinho","PM":"S\u00e3o Pedro e Miquel\u00e3o","ST":"S\u00e3o Tom\u00e9 e Pr\u00edncipe","VC":"S\u00e3o Vicente e Granadinas","SC":"Seicheles","SN":"Senegal","SL":"Serra Leoa","RS":"S\u00e9rvia","SG":"Singapura","SX":"Sint Maarten","SY":"S\u00edria","SO":"Som\u00e1lia","LK":"Sri Lanka","SD":"Sud\u00e3o","SS":"Sud\u00e3o do Sul","SE":"Su\u00e9cia","CH":"Su\u00ed\u00e7a","SR":"Suriname","SJ":"Svalbard e Jan Mayen","TJ":"Tadjiquist\u00e3o","TH":"Tail\u00e2ndia","TW":"Taiwan","TZ":"Tanz\u00e2nia","CZ":"Tch\u00e9quia","IO":"Territ\u00f3rio Brit\u00e2nico do Oceano \u00cdndico","TF":"Territ\u00f3rios Franceses do Sul","PS":"Territ\u00f3rios palestinos","TL":"Timor-Leste","TG":"Togo","TK":"Tokelau","TO":"Tonga","TT":"Trinidad e Tobago","TN":"Tun\u00edsia","TM":"Turcomenist\u00e3o","TR":"Turquia","TV":"Tuvalu","UA":"Ucr\u00e2nia","UG":"Uganda","UY":"Uruguai","UZ":"Uzbequist\u00e3o","VU":"Vanuatu","VE":"Venezuela","VN":"Vietn\u00e3","WF":"Wallis e Futuna","ZM":"Z\u00e2mbia","ZW":"Zimb\u00e1bue"}
13 changes: 7 additions & 6 deletions scripts/loadtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const commandlineOptions = {
maxRequests: 1,
},
// Heavy can saturate CPU which leads to requests stalling depending on machine
// Keep an eye if --verbose logs pause, or if node CPU in top is > 100.
// Keep an eye if --verbose logs pause, or if node CPU in top is > 100.
// https://github.com/alexfernandez/loadtest#usage-donts
heavy: {
concurrency: 10,
Expand All @@ -51,7 +51,6 @@ const options = {
const message = JSON.stringify(mockPageView());
options.headers['Content-Length'] = message.length;
options.headers['Content-Type'] = 'application/json';
options.headers['user-agent'] = 'User-Agent: Mozilla/5.0 LoadTest';
options.body = message;
options.path = '/api/collect';
const request = client(options, callback);
Expand Down Expand Up @@ -95,15 +94,14 @@ loadtest.loadTest(options, (error, results) => {
if (results.errorCodes && Object.keys(results.errorCodes).length) {
console.log(chalk.redBright('*'), chalk.red('Error Codes:'), results.errorCodes);
}
// console.log(results);
});

/**
* Create a new object for each request. Note, we could randomize values here if desired.
* Create a new object for each request. Note, we could randomize values here if desired.
*
* TODO: Need a better way of passing in websiteId, hostname, URL.
* TODO: Need a better way of passing in websiteId, hostname, URL.
*
* @param {object} payload pageview payload same as sent via tracker
* @param {object} payload pageview payload same as sent via tracker
*/
function mockPageView(
payload = {
Expand All @@ -121,6 +119,9 @@ function mockPageView(

// If you pass in --verbose, this function is called
function statusCallback(error, result, latency) {
if (error) {
return console.error(chalk.redBright(error));
}
console.log(
chalk.yellowBright(`\n## req #${result.requestIndex + 1} of ${latency.totalRequests}`),
);
Expand Down
6 changes: 5 additions & 1 deletion tracker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ import { removeTrailingSlash } from '../lib/url';
/* Handle history changes */

const handlePush = (state, title, url) => {
if (!url) return;

removeEvents();

currentRef = currentUrl;
Expand All @@ -144,7 +146,9 @@ import { removeTrailingSlash } from '../lib/url';
currentUrl = newUrl;
}

trackView(currentUrl, currentRef);
if (currentUrl !== currentRef) {
trackView(currentUrl, currentRef);
}

setTimeout(addEvents, 300);
};
Expand Down
Loading

0 comments on commit 30ebf7b

Please sign in to comment.