fix: docker packages and IP parsing for 127.0.0.1
Some checks failed
Release new version / release (push) Successful in 27s
Update changelog / changelog (push) Successful in 26s
Build and push Docker image / build (push) Failing after 3m57s

This commit is contained in:
2026-01-09 21:55:46 +01:00
parent 9cba46e427
commit c829cb2a6b
3 changed files with 11 additions and 2 deletions

View File

@@ -1 +1,2 @@
.env
kittyurl-frontend/node_modules

View File

@@ -1,11 +1,12 @@
# Credit: https://www.digitalocean.com/community/tutorials/how-to-build-a-node-js-application-with-docker
# https://stackoverflow.com/a/56941391
FROM node:24-trixie-slim AS builder
WORKDIR /app
COPY ./kittyurl-frontend/package*.json ./
RUN npm ci && npm cache clean --force
COPY ./kittyurl-frontend/ .
COPY ./kittyurl-frontend/. ./
RUN npm run build
FROM node:24-trixie-slim AS production

View File

@@ -11,6 +11,13 @@ export type View = 'home' | 'login' | 'history' | 'jump-game' | 'flappy-game';
const getSubdomain = () => {
const hostname = window.location.hostname;
// Handle localhost and 127.0.0.1 cases.
// For more advanced cases (like bare IP hosting)
// a regex may be necessary.
if (hostname === 'localhost' || hostname === '127.0.0.1') {
return null;
}
const parts = hostname.split('.');
if (parts.length <= 2) return null;
return parts[0];