diff --git a/TODO.md b/TODO.md index d0cf56b..f2c43a3 100644 --- a/TODO.md +++ b/TODO.md @@ -2,12 +2,17 @@ -- 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 +- 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/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/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"; diff --git a/frontend/public/favicon-min.png b/frontend/public/favicon-min.png index 642b0ec..b62aa95 100644 Binary files a/frontend/public/favicon-min.png and b/frontend/public/favicon-min.png differ diff --git a/frontend/src/ChatHub.tsx b/frontend/src/ChatHub.tsx index 22f86d8..e4070b4 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 = () => { />
- - {/* */}
+ ); }