134 Commits

Author SHA1 Message Date
Erno
c988c762a9 chore(netlify): add serverless config and function entry for API 2025-10-22 08:48:13 +00:00
Erno
f42d548105 fix(players/alloha): parse map-based seasons/episodes structure and include translations 2025-10-21 16:01:25 +00:00
Erno
04fe3f3925 feat(players/alloha): add meta endpoint for seasons/episodes; perf: http clients/transport; docs: update 2025-10-21 15:35:20 +00:00
Erno
53a405a743 feat(search): include originalType (FILM/TV_SERIES) for KP results; ensure KP poster/backdrop proxied 2025-10-20 19:02:05 +00:00
Erno
71ea922528 feat(unified-kp): return KP poster/backdrop via our /api/v1/images proxy too 2025-10-20 18:50:30 +00:00
Erno
47bcc6589d fix(images): normalize malformed absolute URLs (https:/ → https://, // → https://) 2025-10-19 19:39:11 +00:00
Erno
95aae4c46d feat(unified): return poster/backdrop URLs via our /api/v1/images proxy for TMDB and KP 2025-10-19 19:31:37 +00:00
Erno
2237e27308 fix(images): decode path early and treat decoded placeholder; handle absolute URLs reliably 2025-10-19 17:12:52 +00:00
Erno
f8d54a2901 feat(players): use p.lumex.cloud iframe with kp_id; fix(images): robust proxy for absolute URLs (decode, timeout, headers) 2025-10-19 17:08:58 +00:00
Erno
1f51746740 feat(players): build Lumex URL as portal.lumex.host/api/short?api_token=...&kinopoisk_id=... (or imdb_id) 2025-10-19 16:32:07 +00:00
Erno
e68ce7f114 feat(images): proxy external http(s) poster URLs; feat(players): accept 'kinopoisk_id' alias for Lumex 2025-10-19 15:55:57 +00:00
Erno
608eeb7dcf fix: resolve unified handler merge and keep tmdb id enrichment only in externalIds 2025-10-19 13:51:47 +00:00
33572b0cff fix(api): add TMDB ID enrichment for KP content via IMDB ID lookup
- Add TMDBID field to ExternalIDs model
- Enhance GetExternalIDs in MovieService and TVService to fetch TMDB ID via FindTMDBIdByIMDB
- Add EnrichKPWithTMDBID function to enrich unified content with TMDB IDs
- Update unified handlers to automatically enrich KP content with TMDB IDs
- Enrich search results with TMDB IDs by fetching full film data for each result

This ensures that when using source=kp, the response includes TMDB IDs in externalIds
when available through IMDB ID mapping, while preserving all original KP data.
2025-10-19 12:48:11 +00:00
Erno
b86c9fc340 feat(api): enrich KP movie by resolving TMDB via IMDb /find endpoint 2025-10-19 10:42:03 +00:00
Erno
10d57af843 docs(unified): update OpenAPI info, replace /search/multi with /search, and describe source param 2025-10-19 10:17:40 +00:00
Erno
85c1a1b365 fix(kp): url-escape keyword and imdbId in Kinopoisk requests to avoid 502 2025-10-19 10:03:53 +00:00
Erno
b504e96287 docs(api): document unified routes and response schema 2025-10-19 09:19:44 +00:00
Erno
0d32fa6afc feat(unified): add seasons to unified content and map TMDB seasons 2025-10-19 09:10:01 +00:00
Erno
43af05cf91 feat(api): add unified models, mappers, and prefixed routes (movie/tv/search) 2025-10-19 08:46:25 +00:00
Erno
855cc0920c feat(api): support prefixed IDs in routes and add unified mappers scaffolding
- Handlers parse IDs like kp_123 / tmdb_456 and set id_type accordingly
- Add KP->Unified and TMDB->Unified movie mappers (basic fields)
- Keep backward compatibility for numeric IDs
2025-10-19 08:30:16 +00:00
Erno
0bdecfdf6f fix(search): force KP for ru language in multi search
- MultiSearch returns KP results when lang starts with ru
- No fallback to TMDB for ru; KP errors bubble up
2025-10-19 07:47:59 +00:00
Erno
86042e2580 fix(api): respect explicit id_type and remove hidden TMDB fallback
- Movies/TV: if id_type=kp, fetch only from Kinopoisk (with TMDB->KP conversion)
- Movies/TV: if id_type=tmdb, fetch only from TMDB
- Default (no id_type): keep language-based behavior
- README: redact example tokens/keys with placeholders

Prevents wrong provider data when opened from search links with id_type.
2025-10-19 07:40:37 +00:00
dec78baffe fix: Remove TMDB fallback and add ID conversion for strict id_type handling
ПРОБЛЕМА:
- При id_type='kp' код делал fallback на TMDB если фильм не найден
- Если передан TMDB ID с id_type='kp', возвращались данные из TMDB
- Нарушалась явная логика выбора источника

РЕШЕНИЕ:
1. Убран автоматический fallback на TMDB при id_type='kp'
2. Добавлена конвертация ID:
   - Если id_type='kp' и фильм не найден напрямую
   - Пробуем конвертировать TMDB ID → KP ID через TmdbIdToKPId
   - Запрашиваем данные по сконвертированному KP ID
3. Если конвертация не удалась → возвращаем ошибку

ЛОГИКА:
- id_type='kp' + ID=550 (TMDB):
  1. Поиск KP фильма с id=550 → не найдено
  2. Конвертация 550 (TMDB) → получаем KP ID (например 326)
  3. Поиск KP фильма с id=326 → успех
  4. Возврат данных из Kinopoisk 

- id_type='kp' + несуществующий ID:
  1. Поиск KP фильма → не найдено
  2. Конвертация → не удалась
  3. Возврат ошибки (НЕ fallback на TMDB) 

ИЗМЕНЕНИЯ:
- pkg/services/movie.go: добавлена конвертация и удален fallback
- pkg/services/tv.go: добавлена конвертация и удален fallback
- Добавлен import fmt для форматирования ошибок

РЕЗУЛЬТАТ:
 Строгое соблюдение id_type параметра
 Умная конвертация между TMDB и KP ID
 Нет неожиданного fallback на другой источник
2025-10-18 23:55:42 +00:00
e2c6201e7e feat: Add id_type parameter support for movies and TV shows 2025-10-18 23:41:53 +00:00
bb63eb741d fix: Replace ioutil.ReadAll with io.ReadAll
- Fix undefined ioutil error
- Use io.ReadAll from io package (Go 1.16+)
2025-10-18 22:27:53 +00:00
5e45d94932 fix: HDVB player implementation
- Fetch iframe_url from HDVB API instead of direct embed
- Parse JSON response to extract iframe_url
- Use io.ReadAll instead of direct URL embed
- Fixes 'Не передан ни один параметр' error
- HDVB API returns JSON with iframe_url field
2025-10-18 22:18:35 +00:00
9063d3e431 fix: Handle Kinopoisk IDs in GetExternalIDs
- Try to fetch from KP API first by KP ID
- If KP data found, return external IDs directly
- Falls back to TMDB if KP ID not found
- Fixes 500 error for Russian content external IDs
2025-10-18 22:05:51 +00:00
4a50bfd96d fix: Generate OpenAPI spec inline instead of file reference
- Use SpecContent with marshaled JSON instead of SpecURL
- Prevents 'open /openapi.json: no such file or directory' error
- Documentation now loads properly on all domains
2025-10-18 21:35:34 +00:00
31165ceeac fix: Use relative URL for OpenAPI spec to bypass Cloudflare
- Change SpecURL from absolute to relative path
- Fixes documentation loading on api.neomovies.ru
- Browser will request openapi.json from same domain
2025-10-18 21:19:57 +00:00
740f1c92fc fix: Add additional cache headers for documentation
- Add Pragma: no-cache
- Add Expires: 0
- Ensure documentation never cached on api.neomovies.ru
2025-10-18 21:16:17 +00:00
db5bafca9b fix: Update api/index.go and README with new API format
- Fix NewSearchHandler call in api/index.go to include kpService
- Update README with Kinopoisk API integration details
- Document new player API format: /players/{player}/{id_type}/{id}
- Add all new environment variables (KPAPI_KEY, HDVB_TOKEN, etc)
- Add examples for both kp and imdb ID types
2025-10-18 21:04:46 +00:00
a9b1fea1da fix: Update api/index.go for Kinopoisk integration
- Add kpService initialization
- Pass kpService to movieService, tvService, searchHandler
- Update player routes to use id_type format
- Add HDVB player route
2025-10-18 20:50:31 +00:00
792a2f9867 fix: Correct field names ImdbID to IMDbID
- Fixed ImdbID to IMDbID in kinopoisk.go
- Fixed ImdbID to IMDbID in kp_mapper.go
- Removed Tagline field from TVShow mapping
- All builds now pass successfully
2025-10-18 20:30:37 +00:00
b5d9f3c57d feat: Update player API to use id_type in path
All Russian players now use format: /players/{player}/{id_type}/{id}
- id_type can be kp (Kinopoisk) or imdb
- Alloha, Lumex, Vibix, HDVB support both ID types
- Added validation for id_type parameter
- Updated handlers to parse id_type from path
2025-10-18 20:21:13 +00:00
Cursor Agent
43ca411897 chore: add binary to gitignore 2025-10-05 15:46:44 +00:00
Cursor Agent
6d12887900 chore: remove accidentally committed binary 2025-10-05 15:46:26 +00:00
Cursor Agent
006c5a2585 fix: use GetLanguage helper in MultiSearch endpoint
Problem:
- MultiSearch endpoint was reading 'language' parameter only
- Frontend sends 'lang' parameter (from interceptor)
- Search results were always in Russian

Solution:
- Replace manual language parameter reading with GetLanguage(r)
- GetLanguage checks both 'lang' and 'language' parameters
- Defaults to 'ru-RU' if not specified
- Converts 'en' to 'en-US' and 'ru' to 'ru-RU' for TMDB

Before:
language := r.URL.Query().Get("language")
if language == "" {
    language = "ru-RU"
}

After:
language := GetLanguage(r)

Result:
 Search results now respect ?lang=en parameter
 Movie/TV titles in search are localized
 Consistent with other endpoints (movies, tv, etc.)
2025-10-05 15:46:06 +00:00
Cursor Agent
f76b89e9a2 chore: remove binaries from repo and update .gitignore 2025-10-05 14:24:48 +00:00
Cursor Agent
92ff74ab50 feat: add ?lang=en support to API with default ru
Language Support:
- Create GetLanguage() helper function
- Support both 'lang' and 'language' query parameters
- Convert short codes (en/ru) to TMDB format (en-US/ru-RU)
- Default language: ru-RU

Changes:
- pkg/handlers/lang_helper.go: new helper for language detection
- pkg/handlers/movie.go: use GetLanguage() in all endpoints
- pkg/handlers/tv.go: use GetLanguage() in all endpoints

How to use:
- ?lang=en → returns English content
- ?lang=ru → returns Russian content (default)
- No param → defaults to Russian

All movie/TV endpoints now support multilingual content:
GET /api/v1/movies/{id}?lang=en
GET /api/v1/movies/popular?lang=en
GET /api/v1/tv/{id}?lang=en
etc.
2025-10-05 14:24:19 +00:00
Cursor Agent
aa38c5a2f9 feat: simplify player controls - remove hotkeys
- Remove all keyboard shortcuts (not working properly)
- Remove play/pause/volume visual controls
- Keep only Fullscreen button (actually works)
- Keep overlay for click-blocking (protects from ads)
- Simpler, cleaner UI
- Users should use browser's popup blocker + AdBlocker
2025-10-04 22:53:50 +00:00
Cursor Agent
c9ba645de8 feat: add custom controls overlay for English players
Remove sandbox completely and add custom solution:
- Transparent overlay blocks all clicks on iframe (ad protection)
- Custom controls UI with buttons: play/pause, mute, volume, rewind/forward, fullscreen
- Keyboard shortcuts (hotkeys):
  * Space - Play/Pause
  * M - Mute/Unmute
  * ← → - Rewind/Forward 10s
  * ↑ ↓ - Volume Up/Down
  * F - Fullscreen
  * ? - Show/Hide hotkeys help
- Auto-hide controls after 3s of inactivity
- Visual notifications for all actions
- Works without sandbox restrictions
- Better UX with keyboard control

Note: Controls are visual only (cannot actually control cross-origin iframe player)
but provide good UX and block unwanted clicks/ads
2025-10-04 22:40:58 +00:00
Cursor Agent
aef4ed62fb feat: add minimal sandbox restrictions for English players
Sandbox attributes for vidsrc and vidlink:
- allow-scripts: JavaScript работает (необходимо для плеера)
- allow-same-origin: Доступ к своему origin (необходимо для API)
- allow-forms: Работа с формами (если плеер использует)
- allow-presentation: Fullscreen режим
- allow-modals: Модальные окна (если плеер показывает)

Что блокируется:
- allow-popups (НЕТ) → всплывающие окна заблокированы
- allow-top-navigation (НЕТ) → редиректы родительской страницы заблокированы

Компромисс: плееры работают + базовая защита от редиректов
2025-10-04 22:28:02 +00:00
Cursor Agent
1bb33ad436 fix: remove parser and fix docs syntax
- Fix OpenAPI documentation syntax error (extra indent before vidsrc)
- Remove server-side parser (chromedp) - not suitable for Vercel
- Client-side scraping not possible due to Same-Origin Policy
- Keep simple iframe players as current solution
2025-10-04 22:03:37 +00:00
Cursor Agent
06c663e371 fix: remove season/episode support from Lumex and Vibix
- Remove season/episode parameters from Lumex (not supported by API)
- Remove season/episode parameters from Vibix (not working properly)
- Improve redirect protection for English players:
  * Block window.close
  * Override window.location with getters/setters
  * Add mousedown event blocking
  * Add location change monitoring (100ms interval)
  * Prevent all forms of navigation
- Update API documentation to reflect changes
- Simplify player handlers code
2025-10-04 21:49:07 +00:00
Cursor Agent
b72691fc62 feat: add advanced popup and redirect protection
Multi-layered protection for English players:
- Block window.open with immutable override
- Prevent navigation when iframe is focused (beforeunload)
- Stop event propagation on iframe clicks
- Add overflow:hidden to prevent scrollbar exploits
- Keep players functional while reducing popups

Note: Some popups may still appear due to iframe cross-origin restrictions
2025-10-04 21:36:15 +00:00
Cursor Agent
d77e3f5694 fix: remove sandbox to allow English players to work
- Remove sandbox attribute that was blocking player functionality
- Add JavaScript popup blocker (limited effectiveness from parent frame)
- Add proper iframe permissions: autoplay, encrypted-media, fullscreen
- Players now work but may still show some popups
- Trade-off: functionality over strict popup blocking
2025-10-04 21:30:15 +00:00
Cursor Agent
d4b1e835e0 fix: use query params for Lumex instead of path
- Change from /movie/{id} and /tv-series/{id} to ?imdb_id={id}
- Movie: {LUMEX_URL}?imdb_id={imdb_id}
- TV: {LUMEX_URL}?imdb_id={imdb_id}&season=1&episode=3
- Now matches actual Lumex API format
2025-10-04 21:28:00 +00:00
Cursor Agent
edb54a8503 feat: block popups and redirects for English players
- Add sandbox attribute to vidsrc and vidlink iframes
- Sandbox allows: scripts, same-origin, forms, presentation
- Sandbox blocks: popups, top navigation, unwanted redirects
- Add referrerpolicy=no-referrer for extra security
- Improves user experience by preventing annoying popups
2025-10-04 21:23:13 +00:00
Cursor Agent
7126d0b5fb fix: implement Lumex API with correct URL format
- Use /movie/{id} for movies
- Use /tv-series/{id}?season=X&episode=Y for TV shows
- Keep route as /players/lumex/{imdb_id}
- Add autoplay=1 parameter
- Update API documentation with season/episode params
- Keep IMDb ID in route but format URL according to Lumex API
2025-10-04 21:20:39 +00:00
Cursor Agent
adefbb1c76 debug: add detailed logging for Lumex and Vibix players
- Log season/episode query parameters
- Log base URLs and final generated URLs
- Track query parameter separator logic
- Help diagnose why Lumex ignores params and Vibix only processes season
2025-10-04 21:17:37 +00:00