diff --git a/.env.example b/.env.example index b3a1e71..7f0fc80 100644 --- a/.env.example +++ b/.env.example @@ -8,4 +8,6 @@ DB_NAME= DB_PORT= DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres" -BOT_TOKEN= \ No newline at end of file +BOT_TOKEN= + +REDIS_URL=redis://localhost:6379 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 3057411..52eaaa7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,8 +2,6 @@ services: redis: image: redis:8-alpine restart: unless-stopped - ports: - - "6379:6379" volumes: - redis-data:/data command: ["redis-server", "--appendonly", "yes"] @@ -15,7 +13,7 @@ services: POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres} POSTGRES_DB: ${DB_NAME:-postgres} ports: - - "${DB_PORT:-5432}:5432" + - "127.0.0.1:${DB_PORT:-5432}:5432" volumes: - db_data:/var/lib/postgresql/data app: diff --git a/src/app/page.tsx b/src/app/page.tsx index 40151b7..02d04ea 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -13,6 +13,7 @@ export default function Home() { const [url, setUrl] = useState(""); const [expiryTime, setExpiryTime] = useState(0); const [isLoading, setIsLoading] = useState(true); + const [notFound, setNotFound] = useState(false); const initData = useRawInitData(); const onCopyClick = async () => { if (!url.length) return; @@ -32,12 +33,24 @@ export default function Home() { setIsLoading(false); } catch (e) { console.error(e); + setNotFound(true); + setIsLoading(false); } }; fetchData(); }, [initData]); if (isLoading) return ; + if (notFound) { + return ( + +
+ Ссылка не найдена +
+
+ ); + } + return (