Fix crash bugs and secure webhook/TMDB key
- Add missing MovieController::remove/markWatched (routes called undefined methods) - Fix linkPartner(): commit() was unreachable after an early return, so partner linking was never actually persisted in the DB - Add missing removeMovie/markWatched functions in app.js - webhook.php now verifies a GitHub HMAC signature before running git reset --hard - Move TMDB API key server-side via a new TmdbController proxy (tmdb-search/tmdb-details) instead of exposing it in client-side JS Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -42,9 +42,29 @@ class MovieController {
|
||||
|
||||
// 3. On renvoie le JSON
|
||||
echo json_encode([
|
||||
"success" => true,
|
||||
"partner_id" => $realPartnerId,
|
||||
"success" => true,
|
||||
"partner_id" => $realPartnerId,
|
||||
"lists" => $lists
|
||||
]);
|
||||
}
|
||||
|
||||
public function remove($data) {
|
||||
if (!isset($data['movie_id'])) {
|
||||
http_response_code(400);
|
||||
echo json_encode(["error" => "ID du film manquant"]);
|
||||
return;
|
||||
}
|
||||
$res = $this->movieModel->remove($data['movie_id'], $data['user_id']);
|
||||
echo json_encode(["success" => $res]);
|
||||
}
|
||||
|
||||
public function markWatched($data) {
|
||||
if (!isset($data['movie_id'])) {
|
||||
http_response_code(400);
|
||||
echo json_encode(["error" => "ID du film manquant"]);
|
||||
return;
|
||||
}
|
||||
$res = $this->movieModel->markWatched($data['movie_id'], $data['user_id']);
|
||||
echo json_encode(["success" => $res]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user