Skip to content

Commit e489a1b

Browse files
author
Inside4ndroid
committed
chore: bump version to 1.0.1, add CHANGELOG, restart UX (UI modal + nodemon trigger), config/filters fixes, Docker ownership and compose docs
1 parent 484ea4b commit e489a1b

File tree

79 files changed

+334
-11769
lines changed

Some content is hidden

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

79 files changed

+334
-11769
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Changelog
22

3+
All notable changes to this project will be documented in this file.
4+
5+
## [1.0.1] - 2025-09-17
6+
7+
### Added
8+
- Admin UI: Restart Server button (below Logout) with a themed confirmation modal. The UI polls `/api/health` and auto-reloads when the server is back.
9+
- Sidebar divider under Logout/Restart for clarity.
10+
11+
### Changed
12+
- Exclude Codecs presets:
13+
- Introduced "None" (default) → `{ "excludeDV": false, "excludeHDR": false }`.
14+
- "All" → `{ "excludeDV": true, "excludeHDR": true }`.
15+
- Persist and render presets reliably after Save / Reload.
16+
- Minimum Quality: Clear All now resets to `"all"` and selects the All preset in the UI.
17+
- Clear All: Now fully resets TMDB keys, FebBox cookies, providers, and filters; added a themed confirmation modal with optional "Don't ask again" preference.
18+
- Live Config: Hide legacy `tmdbApiKey` (only show `tmdbApiKeys`).
19+
- Restart behavior:
20+
- Local dev: Nodemon watches `restart.trigger`; backend writes it before a clean exit to force a restart.
21+
- Docker: Compose uses `restart: unless-stopped`; Docker restarts the container after restart endpoint triggers exit.
22+
- Dockerfile: Ensure non-root `app` user owns `/app` for writing overrides and restart marker.
23+
- package.json scripts: Simplified to `start`, `start:dev`, and `lint`; both start scripts are nodemon-based and watch `restart.trigger`.
24+
25+
### Fixed
26+
- Provider matrix re-renders immediately after Clear All (no page refresh needed).
27+
- Handling of Exclude Codecs "ALL" previously not persisting correctly.
28+
29+
## [1.0.0] - 2025-09-16
30+
- Initial stable release.
31+
32+
[1.0.1]: https://github.com/Inside4ndroid/TMDB-Embed-API/compare/v1.0.0...v1.0.1# Changelog
33+
334
## [1.0.0] - 2025-09-16
435

536
### Added

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ COPY --from=build /app/README.md ./
3939
# Expose port (documentational; runtime can override)
4040
EXPOSE 8787
4141

42+
# Ensure runtime user owns app directory for writes (overrides, restart marker)
43+
RUN chown -R app:app /app
4244
USER app
4345

4446
# Labels / metadata

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<img src="https://img.shields.io/badge/Node.js-18%2B-brightgreen?style=flat" />
77
<img src="https://img.shields.io/badge/Status-Active-success?style=flat" />
88
<img src="https://img.shields.io/badge/License-MIT-blue?style=flat" />
9-
<img src="https://img.shields.io/badge/Version-1.0.0-informational?style=flat" />
9+
<img src="https://img.shields.io/badge/Version-1.0.1-informational?style=flat" />
1010
<img src="https://img.shields.io/docker/pulls/inside4ndroid/tmdb-embed-api?label=Docker%20Pulls&style=flat" />
1111
</p>
1212

@@ -53,11 +53,11 @@ npm install
5353
# 2. (Optional) Copy example env if you want an initial TMDB key
5454
cp .env.example .env # then edit TMDB_API_KEY=
5555

56-
# 3. Start API (production style)
57-
node apiServer.js
56+
# 3. Start API with automatic restarts (recommended for local dev)
57+
npm start
5858

59-
# Or with automatic restarts (if you add a dev script)
60-
# npm run dev:api
59+
# Or production-style single run
60+
# node apiServer.js
6161

6262
# 4. Open the Admin UI (login page) in browser
6363
http://localhost:8787/
@@ -142,6 +142,11 @@ If both `TMDB_API_KEY` and `TMDB_API_KEYS` are provided, rotation uses the array
142142
```bash
143143
docker compose pull # if using an external registry (future)
144144
docker compose up -d --build
145+
146+
### Restart from Admin UI
147+
The Admin panel includes a Restart Server control.
148+
- Local (nodemon): the backend writes a `restart.trigger` file and exits; nodemon detects the change and restarts automatically.
149+
- Docker Compose: the container exits and is restarted by `restart: unless-stopped`.
145150
```
146151

147152
### Healthcheck
@@ -188,7 +193,7 @@ Saving in the UI writes only changed keys. Setting a field to empty removes the
188193
| Quality / Filters | Min quality presets & codec exclusion JSON |
189194
| Keys | Add/remove TMDB API keys (rotated randomly) |
190195
| FebBox / PStream | Manage FebBox cookies powering Showbox provider |
191-
| Advanced | Provider toggles, cache & validation flags, proxy paths |
196+
| Advanced | Provider toggles, cache & validation flags |
192197
| Server Status | Live metrics, provider functional checks |
193198
| Live Config | View merged + override JSON snapshots |
194199

apiServer.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ function recordLoginSuccess(ip){
6666
loginAttempts.delete(ip);
6767
}
6868

69-
// Guard against premature process.exit from imported legacy modules
69+
// Guard against premature process.exit from imported legacy modules, but allow controlled restarts
70+
const realProcessExit = process.exit.bind(process);
71+
let allowControlledExit = false;
7072
process.exit = function(code){
73+
if (allowControlledExit) return realProcessExit(code);
7174
console.warn('[diagnostic] Intercepted process.exit with code', code, new Error('exit trace').stack);
7275
// keep process alive for debugging
7376
};
@@ -198,6 +201,28 @@ app.post('/api/config', (req,res) => {
198201
res.json({ success: ok, merged: config });
199202
});
200203

204+
// Restart endpoint (requires auth via session cookie on /config.html UI)
205+
app.post('/api/restart', (req,res) => {
206+
const sess = getSession(req);
207+
if(!sess) return res.status(401).json({ success:false, error:'UNAUTHORIZED' });
208+
res.json({ success:true, message:'RESTARTING' });
209+
// Give the response a moment to flush
210+
setTimeout(()=>{
211+
try {
212+
const fs = require('fs');
213+
const restartMarker = require('path').join(process.cwd(), 'restart.trigger');
214+
fs.writeFileSync(restartMarker, String(Date.now()));
215+
console.warn('[control] wrote restart.trigger to notify nodemon');
216+
} catch (e) {
217+
console.warn('[control] failed to write restart marker:', e.message);
218+
}
219+
console.warn('[control] restarting process by exit(0)');
220+
// Let nodemon detect the file change and restart the app
221+
allowControlledExit = true;
222+
realProcessExit(0);
223+
}, 300);
224+
});
225+
201226
// --- Basic informational endpoints ---
202227
app.get('/api/health', (req, res) => {
203228
res.json({ ok: true, service: 'tmdb-embed-api', time: new Date().toISOString() });

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ services:
1616
volumes:
1717
# Persist runtime overrides (created by the admin UI)
1818
- user_config_data:/app/utils/user-config.json
19+
# Allow restart trigger file (optional; stored in container FS)
20+
# - restart_marker:/app/restart.trigger
1921
restart: unless-stopped
2022
healthcheck:
2123
test: ["CMD-SHELL", "wget -qO- http://localhost:8787/api/health || exit 1"]
@@ -25,3 +27,4 @@ services:
2527
retries: 3
2628
volumes:
2729
user_config_data:
30+
# restart_marker:

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
22
"name": "tmdb-embed-api",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Standalone streaming embed source aggregation API (TMDB ID in, streams out)",
55
"main": "apiServer.js",
66
"scripts": {
7-
"start": "node apiServer.js",
8-
"start:api": "node --watch apiServer.js",
9-
"dev:api": "nodemon --ignore providers/.cache --ignore **/tmdb-embed-showbox-cache apiServer.js",
7+
"start": "nodemon --watch restart.trigger apiServer.js",
8+
"start:dev": "nodemon --watch restart.trigger --ignore providers/.cache --ignore **/tmdb-embed-showbox-cache apiServer.js",
109
"lint": "eslint . --ext .js"
1110
},
1211
"dependencies": {

providers/.cache/4khdhub/4khdhub_resolved_urls_v3_1263256_movie.json

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

providers/.cache/4khdhub/4khdhub_resolved_urls_v3_1399_tv_s1e1.json

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

providers/.cache/4khdhub/4khdhub_resolved_urls_v3_293660_movie.json

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

providers/.cache/dramadrip/dramadrip_final_v13_1263256_movie.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)