From b4838460ae9f459d7bcfa49ef534894261deb4bc Mon Sep 17 00:00:00 2001 From: Guessst Date: Mon, 22 Sep 2025 23:33:25 -0300 Subject: [PATCH 1/4] Updated TODO --- TODO.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index d0cf56b..fa397a2 100644 --- a/TODO.md +++ b/TODO.md @@ -2,12 +2,15 @@ -- acomodar layout corretamente no mobile -- tema escuro -- temas diferenciados por ex. vaporwave/synthwave -- Emoticon +-- Digitação "flúida" +- Kaomoji/caules - Permitir citar/responder -- Menu de opções -- Métricas com grafana +- Mostrar infos em tempo real por ex. usuários online +- Métricas com grafana/prometheus - Múltiplos chats +- mudar domínio para 'chat.gustavoqueiroz.dev' - Filtrar spam - Permitir bloquear IP - Visão admin -- Shader/3D/firulas \ No newline at end of file +- Shader/3D/firulas +- Localização/idioma \ No newline at end of file From 7dfbc9e2ac829fec5e55687b03c683cb1b056dea Mon Sep 17 00:00:00 2001 From: Guessst Date: Tue, 23 Sep 2025 05:33:15 -0300 Subject: [PATCH 2/4] Reset at midnight timer --- TODO.md | 3 ++- frontend/src/ChatHub.tsx | 45 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index fa397a2..69d72aa 100644 --- a/TODO.md +++ b/TODO.md @@ -13,4 +13,5 @@ - Permitir bloquear IP - Visão admin - Shader/3D/firulas -- Localização/idioma \ No newline at end of file +- Localização/idioma +- Performance Pagespeed \ No newline at end of file diff --git a/frontend/src/ChatHub.tsx b/frontend/src/ChatHub.tsx index 22f86d8..75caa3f 100644 --- a/frontend/src/ChatHub.tsx +++ b/frontend/src/ChatHub.tsx @@ -8,8 +8,6 @@ import { SettingsDialog } from "./SettingsDialog"; const USER_LOCALE = navigator.language || navigator.languages[0]; -// const IS_DEV = import.meta.env.DEV === true - interface ChatMessage { id: number username: string @@ -56,6 +54,32 @@ function useLocalStorage(key: string, initialValue: string) { return [value, setValue] as const; } +function getMilisecondsUntilBrazilianMidnight() { + const now = new Date(); + + // current UTC time in ms + const nowUtc = now.getTime() + now.getTimezoneOffset() * 60_000; + + // offset for Brazil (UTC−3) + const brazilOffsetMs = -3 * 60 * 60 * 1000; + + // current "Brazil time" + const nowBrazil = new Date(nowUtc + brazilOffsetMs); + + // next midnight in Brazil + const nextMidnightBrazil = new Date(nowBrazil); + nextMidnightBrazil.setHours(24, 0, 0, 0); + + // convert that Brazil midnight back to UTC + const nextMidnightUtc = + nextMidnightBrazil.getTime() - brazilOffsetMs; + + // how long until then from now + const msUntilMidnight = nextMidnightUtc - nowUtc; + + return msUntilMidnight +} + const MessageItem = ({ formattedMessage }: { formattedMessage: FormattedChatMessage }) => { return (
@@ -273,6 +297,16 @@ export const ChatHub = () => { } }, [currentInput]); // runs whenever input changes + // MISCELANEOUS + useEffect(() => { + const msUntilMidnight = getMilisecondsUntilBrazilianMidnight() + const timer = setTimeout(() => { + window.location.reload(); + }, msUntilMidnight); + + return () => clearTimeout(timer); + }, []) + return (
@@ -331,8 +365,6 @@ export const ChatHub = () => { />
- - {/* */}
+
+
+ ⚠️ The Chat™ resets every day at midnight Brazilian Time (UTC-3). +
+
); } From 384c07cc1d4097d701b3b980c256acf19e77d1c9 Mon Sep 17 00:00:00 2001 From: Guessst Date: Tue, 23 Sep 2025 07:15:03 -0300 Subject: [PATCH 3/4] Minimal frontend tweaks --- frontend/index.html | 2 +- frontend/public/favicon-min.png | Bin 1215 -> 2191 bytes frontend/src/ChatHub.tsx | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 7e281d1..21fdf83 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -3,7 +3,7 @@ - Projeto + Chat diff --git a/frontend/public/favicon-min.png b/frontend/public/favicon-min.png index 642b0ecddc93fbbd6677abb10ac96605aee6392e..b62aa950f2d8bdcca1620be0579005b239140eae 100644 GIT binary patch literal 2191 zcmV;A2ypj_P)W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oGpR@n~ diff --git a/frontend/src/ChatHub.tsx b/frontend/src/ChatHub.tsx index 75caa3f..e4070b4 100644 --- a/frontend/src/ChatHub.tsx +++ b/frontend/src/ChatHub.tsx @@ -377,7 +377,7 @@ export const ChatHub = () => {
- ⚠️ The Chat™ resets every day at midnight Brazilian Time (UTC-3). + ⚠️ The Chat™ resets every day at midnight Brazilian Time (UTC -3).
From 68d90868271aa2352961da7da6e799b154e8cdda Mon Sep 17 00:00:00 2001 From: Guessst Date: Tue, 23 Sep 2025 08:39:25 -0300 Subject: [PATCH 4/4] Changed domain to chat.* --- TODO.md | 3 ++- backend/appsettings.Production.json | 4 ++-- docker-compose.production.yml | 5 ++--- docker-compose.yml | 4 ++-- frontend/nginx.production.conf | 19 ++++--------------- 5 files changed, 12 insertions(+), 23 deletions(-) diff --git a/TODO.md b/TODO.md index 69d72aa..f2c43a3 100644 --- a/TODO.md +++ b/TODO.md @@ -14,4 +14,5 @@ - Visão admin - Shader/3D/firulas - Localização/idioma -- Performance Pagespeed \ No newline at end of file +- Performance Pagespeed +- Arrumar portas do docker \ No newline at end of file diff --git a/backend/appsettings.Production.json b/backend/appsettings.Production.json index 06d9c78..95a6792 100644 --- a/backend/appsettings.Production.json +++ b/backend/appsettings.Production.json @@ -1,6 +1,6 @@ { "Cors": { - "AllowedOrigins": [ "https://gustavoqueiroz.dev" ] + "AllowedOrigins": [ "https://chat.gustavoqueiroz.dev" ] }, - "AllowedHosts": "gustavoqueiroz.dev;www.gustavoqueiroz.dev" + "AllowedHosts": "chat.gustavoqueiroz.dev" } diff --git a/docker-compose.production.yml b/docker-compose.production.yml index b47fafe..922ba1e 100644 --- a/docker-compose.production.yml +++ b/docker-compose.production.yml @@ -11,15 +11,14 @@ services: context: . ports: !reset [] expose: - - "8080" + - "2001" frontend: image: guessst/chat-frontend:latest build: context: . ports: - - "80:80" - - "443:443" + - "2000:2000" volumes: - /etc/letsencrypt:/etc/letsencrypt:ro - /var/www/certbot:/usr/share/nginx/html/.well-known/acme-challenge diff --git a/docker-compose.yml b/docker-compose.yml index e936934..4e095fa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -45,14 +45,14 @@ services: ENV_POSTGRES_PASSWORD: ${ENV_POSTGRES_PASSWORD} ASPNETCORE_ENVIRONMENT: ${ENV_ASPNETCORE_ENVIRONMENT} ports: - - "8080:8080" + - "2001:2001" frontend: build: ./frontend depends_on: - backend ports: - - "80:80" + - "2000:2000" volumes: db_data: diff --git a/frontend/nginx.production.conf b/frontend/nginx.production.conf index e6a874f..7c6f1c8 100644 --- a/frontend/nginx.production.conf +++ b/frontend/nginx.production.conf @@ -1,18 +1,7 @@ server { - listen 80; - server_name gustavoqueiroz.dev www.gustavoqueiroz.dev; - return 301 https://$host$request_uri; -} - -server { - listen 443 ssl; - server_name gustavoqueiroz.dev www.gustavoqueiroz.dev; - - ssl_certificate /etc/letsencrypt/live/gustavoqueiroz.dev/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/gustavoqueiroz.dev/privkey.pem; - + listen 2000; + root /usr/share/nginx/html; - index index.html; location / { @@ -20,12 +9,12 @@ server { } location /chat { - proxy_pass http://backend:8080; + proxy_pass http://backend:2001; proxy_set_header Host $host; } location /chatHub { - proxy_pass http://backend:8080; + proxy_pass http://backend:2001; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";