From 7d696a93af569a1d8c0745604a51b1455494685e Mon Sep 17 00:00:00 2001 From: vndangkhoa Date: Wed, 18 Feb 2026 19:07:13 +0700 Subject: [PATCH] Release v3.7: Codebase cleanup and security improvements --- Dockerfile | 4 +- README.md | 154 +++++++++--------- backend/cmd/server/main.go | 2 +- docker-compose.yml | 42 ++--- .../src/components/ErrorBoundary.tsx | 2 +- frontend-react/vite.config.ts | 2 +- 6 files changed, 102 insertions(+), 104 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5cf1d21..bcff6a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: Build Image (Frontend) -FROM node:18-alpine AS frontend-builder +FROM node:20-alpine AS frontend-builder WORKDIR /app/frontend COPY frontend-react/package*.json ./ RUN npm install @@ -7,7 +7,7 @@ COPY frontend-react/ . RUN npm run build # Stage 2: Build Image (Backend) -FROM golang:1.23-alpine AS backend-builder +FROM golang:1.24-alpine AS backend-builder WORKDIR /app/backend # Install build dependencies RUN apk add --no-cache gcc musl-dev diff --git a/README.md b/README.md index bd5658f..82c4d6e 100644 --- a/README.md +++ b/README.md @@ -1,82 +1,78 @@ -# StreamFlow V3.6 - -StreamFlow is a high-performance video streaming web application featuring a pure Go backend and a modern React + Tailwind frontend. - -## 🚀 Features - -- **Modern UI**: Built with React, TypeScript, and Tailwind CSS for a premium, responsive experience. -- **High Performance**: Backend written in Go (Golang) for speed and concurrency. -- **Smart Scraping**: Integrated scraping engine (Rophim) with automated episode extraction. -- **HLS Streaming**: Native HLS playback support. -- **Android TV Support (New)**: Optimized TV client with D-pad controls and 10s skip. -- **Performance Optimized**: Parallel API fetching and global image caching for instant loading. -- **Android TV App**: Native TV app support with dedicated APK available for download. -- **Docker Ready**: Multi-stage Docker build optimized for NAS Synology (linux/amd64). - -## 🛠️ Tech Stack - -- **Backend**: Go (Chi Router, GORM, GoQuery) -- **Frontend**: React, TypeScript, Vite, Tailwind CSS -- **Database**: SQLite -- **Deployment**: Docker - -## 📦 Installation - -### Prerequisites - -- Go 1.22+ -- Node.js 20+ -- Docker (optional) - -### Local Development - -1. **Backend** - ```bash - cd backend - go mod tidy - go run ./cmd/server/main.go - ``` - Server runs at `http://localhost:8000`. - -2. **Frontend** - ```bash - cd frontend-react - npm install - npm run dev - ``` - Frontend runs at `http://localhost:5173` (proxying to backend). - -### Docker Deployment (Recommended for NAS Synology) - -1. **Environmental Variables**: Create a `.env` file or set them in your NAS: - ```env - TMDB_API_KEY=your_api_key_here - ``` - -2. **Run with Docker Compose**: - ```yaml - version: '3.8' - - services: - streamflow: - image: git.khoavo.myds.me/vndangkhoa/kv-streamflow:v3.6 - container_name: streamflow - platform: linux/amd64 - ports: - - "3478:8000" - environment: - - DATABASE_URL=/app/data/streamflow.db - - TMDB_API_KEY=${TMDB_API_KEY} - volumes: - - ./data:/app/data - restart: always - ``` - - ```bash - docker-compose up -d - ``` - -Access the application at `http://YOUR_NAS_IP:3478`. You can download the **Android TV App** directly from the navigation bar once the webapp is running. +# StreamFlow V3.7 + +StreamFlow is a high-performance video streaming web application featuring a pure Go backend and a modern React + Tailwind frontend. + +## 🚀 Features + +- **Modern UI**: Built with React, TypeScript, and Tailwind CSS for a premium, responsive experience. +- **High Performance**: Backend written in Go (Golang) for speed and concurrency. +- **Smart Scraping**: Integrated scraping engine (Rophim) with automated episode extraction. +- **HLS Streaming**: Native HLS playback support. +- **Android TV Support**: Optimized TV client with D-pad controls and 10s skip. +- **Performance Optimized**: Parallel API fetching and global image caching for instant loading. +- **Android TV App**: Native TV app support with dedicated APK available for download. +- **Docker Ready**: Multi-stage Docker build optimized for NAS Synology (linux/amd64). +- **PWA Support**: Install as a progressive web app on mobile devices. + +## 🛠️ Tech Stack + +- **Backend**: Go 1.23 (Chi Router, GORM, GoQuery) +- **Frontend**: React 19, TypeScript, Vite 7, Tailwind CSS 4 +- **Database**: SQLite +- **Deployment**: Docker + +## 📦 Installation + +### Prerequisites + +- Go 1.23+ +- Node.js 20+ +- Docker (optional) + +### Local Development + +1. **Backend** + ```bash + cd backend + go mod tidy + go run ./cmd/server/main.go + ``` + Server runs at `http://localhost:8000`. + +2. **Frontend** + ```bash + cd frontend-react + npm install + npm run dev + ``` + Frontend runs at `http://localhost:5173` (proxying to backend). + +### Docker Deployment (Recommended for NAS Synology) + +1. **Run with Docker Compose**: + ```yaml + version: '3.8' + + services: + streamflow: + image: git.khoavo.myds.me/vndangkhoa/kv-streamflow:v3.7 + container_name: streamflow + platform: linux/amd64 + ports: + - "3478:8000" + environment: + - DATABASE_URL=/app/data/streamflow.db + - TZ=Asia/Ho_Chi_Minh + volumes: + - ./data:/app/data + restart: unless-stopped + ``` + + ```bash + docker-compose up -d + ``` + +Access the application at `http://YOUR_NAS_IP:3478`. You can download the **Android TV App** directly from the navigation bar once the webapp is running. ## 📂 Project Structure diff --git a/backend/cmd/server/main.go b/backend/cmd/server/main.go index d1c89fa..4bb2570 100644 --- a/backend/cmd/server/main.go +++ b/backend/cmd/server/main.go @@ -57,7 +57,7 @@ func main() { r.Route("/api", func(r chi.Router) { r.Get("/health", func(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(`{"status":"healthy", "version":"v3.6-go"}`)) + w.Write([]byte(`{"status":"healthy", "version":"v3.7"}`)) }) api.RegisterRoutes(r, handler) diff --git a/docker-compose.yml b/docker-compose.yml index b71ebb9..9d446ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,20 +1,22 @@ -version: '3.8' - -services: - streamflow: - # build: . - image: git.khoavo.myds.me/vndangkhoa/kv-streamflow:v3.6 - container_name: streamflow - platform: linux/amd64 - ports: - - "3478:8000" - environment: - - DATABASE_URL=/app/data/streamflow.db - # - TMDB_API_KEY=${TMDB_API_KEY} - volumes: - - ./data:/app/data - restart: always - -volumes: - streamflow_data: - streamflow_cache: +version: '3.8' + +services: + streamflow: + image: git.khoavo.myds.me/vndangkhoa/kv-streamflow:v3.7 + container_name: streamflow + platform: linux/amd64 + ports: + - "3478:8000" + environment: + - DATABASE_URL=/app/data/streamflow.db + - PORT=8000 + - TZ=Asia/Ho_Chi_Minh + volumes: + - ./data:/app/data + restart: unless-stopped + healthcheck: + test: ["CMD", "wget", "-q", "--spider", "http://localhost:8000/api/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 10s diff --git a/frontend-react/src/components/ErrorBoundary.tsx b/frontend-react/src/components/ErrorBoundary.tsx index 59e9cba..2002db4 100644 --- a/frontend-react/src/components/ErrorBoundary.tsx +++ b/frontend-react/src/components/ErrorBoundary.tsx @@ -1,4 +1,4 @@ -import { Component, ErrorInfo, ReactNode } from 'react'; +import { Component, type ErrorInfo, type ReactNode } from 'react'; interface Props { children: ReactNode; diff --git a/frontend-react/vite.config.ts b/frontend-react/vite.config.ts index b9ea28b..9f7aa6e 100644 --- a/frontend-react/vite.config.ts +++ b/frontend-react/vite.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from 'vite' +import { defineConfig } from 'vitest/config' import react from '@vitejs/plugin-react' import { VitePWA } from 'vite-plugin-pwa'