Skip to content

Commit e0ad35d

Browse files
author
Inside4ndroid
committed
Full overhaul of the repo please see changelog
1 parent 2119398 commit e0ad35d

115 files changed

Lines changed: 26337 additions & 6697 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
node_modules
2+
npm-debug.log
3+
.DS_Store
4+
.vscode
5+
screenshots
6+
streams_cache
7+
providers/.cache
8+
utils/user-config.json
9+
.env
10+
.git
11+
.gitignore
12+
*.log
13+
*.md
14+
!README.md
15+
tests
16+
coverage
17+
.github
18+
docker-compose.yml

.env_example

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
public/
3+
*.log

.eslintrc.cjs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true,
5+
es2022: true,
6+
},
7+
parserOptions: {
8+
ecmaVersion: 2022,
9+
sourceType: 'module',
10+
},
11+
ignorePatterns: ["public/*"],
12+
extends: [
13+
'eslint:recommended'
14+
],
15+
rules: {
16+
'no-unused-vars': ['warn', { args: 'none', ignoreRestSiblings: true }],
17+
'no-undef': 'error',
18+
'no-console': 'off',
19+
'prefer-const': 'warn',
20+
'eqeqeq': ['warn', 'smart'],
21+
'no-var': 'warn'
22+
}
23+
};
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Docker Publish
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
tags: [ 'v*' ]
7+
workflow_dispatch:
8+
9+
env:
10+
IMAGE_NAME: tmdb-embed-api
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v3
24+
25+
- name: Set up Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Log in to Docker Hub
29+
uses: docker/login-action@v3
30+
with:
31+
username: ${{ secrets.DOCKERHUB_USERNAME }}
32+
password: ${{ secrets.DOCKERHUB_TOKEN }}
33+
34+
- name: Extract version
35+
id: vars
36+
run: |
37+
PKG_VERSION=$(node -p "require('./package.json').version")
38+
echo "pkg_version=$PKG_VERSION" >> $GITHUB_OUTPUT
39+
if [[ $GITHUB_REF == refs/tags/v* ]]; then
40+
TAG=${GITHUB_REF#refs/tags/}
41+
echo "ref_tag=$TAG" >> $GITHUB_OUTPUT
42+
fi
43+
44+
- name: Build & Push (branch)
45+
if: startsWith(github.ref, 'refs/heads/')
46+
uses: docker/build-push-action@v5
47+
with:
48+
context: .
49+
push: true
50+
platforms: linux/amd64,linux/arm64
51+
tags: |
52+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
53+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.pkg_version }}
54+
labels: |
55+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
56+
org.opencontainers.image.revision=${{ github.sha }}
57+
org.opencontainers.image.version=${{ steps.vars.outputs.pkg_version }}
58+
59+
- name: Build & Push (tag)
60+
if: startsWith(github.ref, 'refs/tags/v')
61+
uses: docker/build-push-action@v5
62+
with:
63+
context: .
64+
push: true
65+
platforms: linux/amd64,linux/arm64
66+
tags: |
67+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
68+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.pkg_version }}
69+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.ref_tag }}
70+
labels: |
71+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
72+
org.opencontainers.image.revision=${{ github.sha }}
73+
org.opencontainers.image.version=${{ steps.vars.outputs.pkg_version }}
74+
org.opencontainers.image.ref.name=${{ steps.vars.outputs.ref_tag }}

CHANGELOG.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Changelog
2+
3+
## [1.0.0] - 2025-09-16
4+
5+
### Added
6+
- Comprehensive `README.md` (features, endpoints, admin UI overview, screenshots gallery, Docker usage, troubleshooting).
7+
- `LICENSE` (MIT) file.
8+
- Multi‑TMDB key rotation support (array of keys; random selection per request).
9+
- Config override system writing to `utils/user-config.json` with live merged view.
10+
- Session-based authentication (login, logout, session check, password change) with brute-force mitigation.
11+
- Rate limiting + exponential lockouts for failed login attempts.
12+
- Provider status & metrics endpoints: `/api/health`, `/api/metrics`, `/api/status`, `/api/providers`.
13+
- Stream aggregation endpoints (aggregate + provider-specific) with filtering pipeline.
14+
- Diagnostics instrumentation (intercept `process.exit`, `beforeExit`, unhandled rejection / exception logging, periodic heartbeat interval).
15+
- Docker assets: multi-stage `Dockerfile`, `.dockerignore`, `docker-compose.yml` with persistent volume for overrides.
16+
- GitHub Actions workflow (`.github/workflows/docker-publish.yml`) for automatic multi-arch (amd64+arm64) build & push on branch and tag (`v*`).
17+
- OCI metadata labels and build argument (`VERSION`) in Docker image.
18+
- Version + (placeholder) Docker pulls badges in README header.
19+
- VidSrc extractor refactor: removed direct `process.exit` calls; `main()` now returns status code (safer when required as a module).
20+
21+
### Changed
22+
- Config normalization now clears legacy single `tmdbApiKey` when `tmdbApiKeys` override is explicitly emptied.
23+
- Dockerfile slimmed: narrowed COPY set, added labels, build arg, retained only necessary runtime artifacts.
24+
- `.dockerignore` expanded to reduce build context (`.git`, logs, markdown except README, tests, CI configs, caches, compose file, etc.).
25+
26+
### Removed
27+
- Deprecated `uhdmovies` provider: code file, registry references, UI toggles, documentation mentions.
28+
29+
### Security
30+
- Hardened auth flow: session cookies (HttpOnly), no-store headers for admin pages, escalating lockouts against brute force.
31+
32+
### CI / Automation
33+
- Added multi-arch Docker publish workflow using Buildx & QEMU.
34+
35+
### Documentation
36+
- Added Docker usage section (local build, compose, multi-key usage, env vars table, healthcheck notes).
37+
- Added screenshots gallery of admin UI.
38+
- Updated docs to reflect provider removal and new configuration semantics.
39+
- Added this `CHANGELOG.md`.
40+
41+
### Developer Experience
42+
- Heartbeat diagnostic interval to aid investigation of unexpected exits.
43+
- Intercepted premature `process.exit` calls to avoid silent shutdowns during debugging.
44+
45+
## Historical Context
46+
This 1.0.0 release consolidates modernization work: provider cleanup, configuration clarity, deployment ergonomics (Docker + CI), security hardening, and observability.
47+
48+
---
49+
50+
[1.0.0]: https://github.com/Inside4ndroid/TMDB-Embed-API/releases/1.0.0

Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# ---------- Build Stage ----------
2+
FROM node:20-alpine AS build
3+
ARG VERSION=dev
4+
WORKDIR /app
5+
6+
# Install only production dependencies first (leveraging cache)
7+
COPY package.json package-lock.json ./
8+
# Using npm install instead of npm ci because lock file appears out-of-sync
9+
# If you later regenerate lock (npm install locally) you can revert to npm ci for reproducibility
10+
RUN npm install --omit=dev
11+
12+
# Copy only required source (avoid sending screenshots, node_modules already installed)
13+
COPY apiServer.js ./
14+
COPY providers ./providers
15+
COPY public ./public
16+
COPY utils ./utils
17+
COPY README.md ./
18+
19+
# ---------- Runtime Stage ----------
20+
FROM node:20-alpine AS runtime
21+
ARG VERSION=dev
22+
WORKDIR /app
23+
ENV NODE_ENV=production \
24+
API_PORT=8787 \
25+
APP_VERSION=${VERSION}
26+
27+
# Create non-root user
28+
RUN addgroup -S app && adduser -S app -G app
29+
30+
# Copy node_modules from build and necessary source
31+
COPY --from=build /app/node_modules ./node_modules
32+
COPY --from=build /app/apiServer.js ./
33+
COPY --from=build /app/public ./public
34+
COPY --from=build /app/providers ./providers
35+
COPY --from=build /app/utils ./utils
36+
COPY --from=build /app/package.json ./
37+
COPY --from=build /app/README.md ./
38+
39+
# Expose port (documentational; runtime can override)
40+
EXPOSE 8787
41+
42+
USER app
43+
44+
# Labels / metadata
45+
LABEL org.opencontainers.image.title="TMDB Embed API" \
46+
org.opencontainers.image.description="Streaming metadata + source aggregation API with multi-key TMDB rotation" \
47+
org.opencontainers.image.version="${VERSION}" \
48+
org.opencontainers.image.source="https://github.com/Inside4ndroid/TMDB-Embed-API" \
49+
org.opencontainers.image.licenses="MIT"
50+
51+
# Healthcheck (simple)
52+
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s CMD wget -qO- http://localhost:${API_PORT:-8787}/api/health || exit 1
53+
54+
CMD ["node","apiServer.js"]

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Inside4ndroid
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)