fix: use relative /api URLs through Next.js proxy instead of direct backend URL
This commit is contained in:
parent
b5fe18ef9e
commit
b02f671aeb
4 changed files with 4 additions and 9 deletions
|
|
@ -18,13 +18,11 @@ COPY frontend/package.json frontend/package-lock.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
||||||
FROM node:20-alpine AS frontend-builder
|
FROM node:20-alpine AS frontend-builder
|
||||||
ARG NEXT_PUBLIC_API_URL=http://127.0.0.1:8080/api
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=frontend-deps /app/node_modules ./node_modules
|
COPY --from=frontend-deps /app/node_modules ./node_modules
|
||||||
COPY frontend/ ./
|
COPY frontend/ ./
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
RUN npm run build
|
||||||
RUN echo "NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL" && npm run build
|
|
||||||
|
|
||||||
# ---- Final Unified Image ----
|
# ---- Final Unified Image ----
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
@ -57,9 +55,6 @@ ENV NODE_ENV=production
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
ENV KVTUBE_DATA_DIR=/app/data
|
ENV KVTUBE_DATA_DIR=/app/data
|
||||||
ENV GIN_MODE=release
|
ENV GIN_MODE=release
|
||||||
ARG NEXT_PUBLIC_API_URL=http://127.0.0.1:8080/api
|
|
||||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
|
||||||
|
|
||||||
RUN addgroup -S kvtube && adduser -S kvtube -G kvtube && chown -R kvtube:kvtube /app
|
RUN addgroup -S kvtube && adduser -S kvtube -G kvtube && chown -R kvtube:kvtube /app
|
||||||
|
|
||||||
USER kvtube
|
USER kvtube
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ function formatSubscribers(count: number): string {
|
||||||
|
|
||||||
// We no longer need getAvatarColor as we now use the global --yt-avatar-bg
|
// We no longer need getAvatarColor as we now use the global --yt-avatar-bg
|
||||||
|
|
||||||
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://127.0.0.1:8080/api';
|
const API_BASE = 'http://localhost:8080/api';
|
||||||
|
|
||||||
async function getChannelInfo(id: string) {
|
async function getChannelInfo(id: string) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ export default function LibraryPage() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
try {
|
try {
|
||||||
const apiBase = process.env.NEXT_PUBLIC_API_URL || 'http://127.0.0.1:8080/api';
|
const apiBase = '/api';
|
||||||
const [historyRes, subsRes] = await Promise.all([
|
const [historyRes, subsRes] = await Promise.all([
|
||||||
fetch(`${apiBase}/history?limit=20`, { cache: 'no-store' }),
|
fetch(`${apiBase}/history?limit=20`, { cache: 'no-store' }),
|
||||||
fetch(`${apiBase}/subscriptions`, { cache: 'no-store' })
|
fetch(`${apiBase}/subscriptions`, { cache: 'no-store' })
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { getChannelVideosClient, getChannelInfoClient } from '../../clientAction
|
||||||
import { VideoData } from '../../constants';
|
import { VideoData } from '../../constants';
|
||||||
import LoadingSpinner from '../../components/LoadingSpinner';
|
import LoadingSpinner from '../../components/LoadingSpinner';
|
||||||
|
|
||||||
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://127.0.0.1:8080/api';
|
const API_BASE = '/api';
|
||||||
|
|
||||||
interface Subscription {
|
interface Subscription {
|
||||||
channel_id: string;
|
channel_id: string;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue