From 8342fd52d77e3d4dba30125d969f00666509d229 Mon Sep 17 00:00:00 2001 From: astria Date: Sat, 6 Sep 2025 13:38:42 +0200 Subject: [PATCH] HOTFIX --- backend/app/routes/user.route.js | 12 +- backend/app/utils/mail.js | 2 +- backend/logs/access.log | 90 +++++ docker-compose.yaml | 4 +- frontend/src/components/CreatorCard.jsx | 4 +- frontend/src/pages/Video.jsx | 459 ++++++++++++------------ 6 files changed, 336 insertions(+), 235 deletions(-) diff --git a/backend/app/routes/user.route.js b/backend/app/routes/user.route.js index 11e60b4..fe06eab 100644 --- a/backend/app/routes/user.route.js +++ b/backend/app/routes/user.route.js @@ -32,25 +32,25 @@ import {Channel} from "../middlewares/channel.middleware.js"; const router = Router(); -// REGISTER A USER +// REGISTER A USER+ router.post("/", [profileUpload.single("profile"), addLogger, UserRegister.email, UserRegister.username, UserRegister.password, validator, doEmailExists, doUsernameExists], register); -// LOGIN A USER +// LOGIN A USER+ router.post("/login", [addLogger, UserLogin.username, UserLogin.password, validator], login) // SEARCH BY USERNAME router.get("/search", [addLogger, isTokenValid, UserSearch.username, validator], searchByUsername); -// GET USER BY ID +// GET USER BY ID+ router.get("/:id", [addLogger, isTokenValid, User.id, validator], getById) -// GET USER BY USERNAME +// GET USER BY USERNAME+ router.get("/username/:username", [addLogger, isTokenValid, UserRequest.username, validator], getByUsername); -// UPDATE USER +// UPDATE USER+ router.put("/:id", [addLogger, isTokenValid, User.id, UserRegister.email, UserRegister.username, validator, doUserExists, isOwner], update); -// DELETE USER +// DELETE USER+ router.delete("/:id", [addLogger, isTokenValid, User.id, validator, doUserExists, isOwner], deleteUser); // GET USER CHANNEL diff --git a/backend/app/utils/mail.js b/backend/app/utils/mail.js index 0197e21..9b134d3 100644 --- a/backend/app/utils/mail.js +++ b/backend/app/utils/mail.js @@ -7,7 +7,7 @@ function getTransporter() { secure: false, auth: { user: process.env.GMAIL_USER, - pass: "yuuu kvoi ytrf blla", + pass: process.env.GMAIL_PASSWORD, }, }); }; diff --git a/backend/logs/access.log b/backend/logs/access.log index 3ab8444..1ea8d58 100644 --- a/backend/logs/access.log +++ b/backend/logs/access.log @@ -12072,3 +12072,93 @@ [2025-09-05 17:57:44.224] [undefined] POST(/:id): user not the owner of the playlist with id 1 with status 403 [2025-09-05 17:58:14.088] [undefined] POST(/:id): Video added to playlist with id 2 with status 200 [2025-09-05 17:58:21.531] [undefined] GET(/:id): Playlist retrieved with id 2 with status 200 +[2025-09-06 10:11:19.116] [undefined] GET(/see-later): 'See Later' playlist retrieved for user with id 1 with status 200 +[2025-09-06 10:11:56.023] [undefined] GET(/see-later): 'See Later' playlist retrieved for user with id 1 with status 200 +[2025-09-06 10:12:16.248] [undefined] GET(/see-later): 'See Later' playlist retrieved for user with id 1 with status 200 +[2025-09-06 10:12:23.630] [undefined] GET(/:id): failed due to invalid values with status 400 +[2025-09-06 10:12:35.862] [undefined] GET(/see-later): 'See Later' playlist retrieved for user with id 1 with status 200 +[2025-09-06 10:13:32.803] [undefined] GET(/:id): try to get channel with id 1 +[2025-09-06 10:13:32.809] [undefined] GET(/:id): Successfully get channel with id 1 with status 200 +[2025-09-06 10:13:32.824] [undefined] GET(/:id/channel/subscribed): check if user 1 is subscribed to channel 1 +[2025-09-06 10:13:32.829] [undefined] GET(/:id/channel/subscribed): user 1 is not subscribed to channel 1 with status 200 +[2025-09-06 10:13:58.268] [undefined] POST(/:id/subscribe): try to toggle subscription for channel with id 1 +[2025-09-06 10:13:58.276] [undefined] POST(/:id/subscribe): Successfully subscribed to channel with status 200 +[2025-09-06 10:14:41.764] [undefined] GET(/:id): try to get channel with id 1 +[2025-09-06 10:14:41.775] [undefined] GET(/:id): Successfully get channel with id 1 with status 200 +[2025-09-06 10:14:41.789] [undefined] GET(/:id/channel/subscribed): check if user 1 is subscribed to channel 1 +[2025-09-06 10:14:41.794] [undefined] GET(/:id/channel/subscribed): user 1 is subscribed to channel 1 with status 200 +[2025-09-06 10:14:42.428] [undefined] GET(/user/:id): Playlists retrieved for user with id 1 with status 200 +[2025-09-06 10:14:42.437] [undefined] GET(/:id): try to get video 1 +[2025-09-06 10:14:42.447] [undefined] GET(/:id): successfully get video 1 with status 200 +[2025-09-06 10:14:42.457] [undefined] GET(/:id/similar): try to get similar videos for video 1 +[2025-09-06 10:14:42.464] [undefined] GET(/:id/similar): successfully get similar videos for video 1 with status 200 +[2025-09-06 10:14:42.479] [undefined] GET(/:id/views): try to add views for video 1 +[2025-09-06 10:14:42.484] [undefined] GET(/:id/views): successfully added views for video 1 with status 200 +[2025-09-06 10:14:49.450] [undefined] GET(/:id): try to get video 1 +[2025-09-06 10:14:49.454] [undefined] GET(/user/:id): Playlists retrieved for user with id 1 with status 200 +[2025-09-06 10:14:49.462] [undefined] GET(/:id): successfully get video 1 with status 200 +[2025-09-06 10:14:49.473] [undefined] GET(/:id/similar): try to get similar videos for video 1 +[2025-09-06 10:14:49.480] [undefined] GET(/:id/similar): successfully get similar videos for video 1 with status 200 +[2025-09-06 10:14:49.529] [undefined] GET(/:id/views): try to add views for video 1 +[2025-09-06 10:14:49.536] [undefined] GET(/:id/views): successfully added views for video 1 with status 200 +[2025-09-06 10:14:51.048] [undefined] GET(/:id): try to get channel with id 1 +[2025-09-06 10:14:51.054] [undefined] GET(/:id): Successfully get channel with id 1 with status 200 +[2025-09-06 10:14:51.065] [undefined] GET(/:id/channel/subscribed): check if user 1 is subscribed to channel 1 +[2025-09-06 10:14:51.071] [undefined] GET(/:id/channel/subscribed): user 1 is subscribed to channel 1 with status 200 +[2025-09-06 10:15:00.735] [undefined] GET(/:id): try to get channel with id 1 +[2025-09-06 10:15:00.741] [undefined] GET(/:id): Successfully get channel with id 1 with status 200 +[2025-09-06 10:15:00.754] [undefined] GET(/:id/channel/subscribed): check if user 1 is subscribed to channel 1 +[2025-09-06 10:15:00.759] [undefined] GET(/:id/channel/subscribed): user 1 is subscribed to channel 1 with status 200 +[2025-09-06 10:15:01.676] [undefined] GET(/:id): try to get video 1 +[2025-09-06 10:15:01.681] [undefined] GET(/user/:id): Playlists retrieved for user with id 1 with status 200 +[2025-09-06 10:15:01.690] [undefined] GET(/:id): successfully get video 1 with status 200 +[2025-09-06 10:15:01.700] [undefined] GET(/:id/similar): try to get similar videos for video 1 +[2025-09-06 10:15:01.706] [undefined] GET(/:id/similar): successfully get similar videos for video 1 with status 200 +[2025-09-06 10:15:01.723] [undefined] GET(/:id/views): try to add views for video 1 +[2025-09-06 10:15:01.731] [undefined] GET(/:id/views): successfully added views for video 1 with status 200 +[2025-09-06 10:15:54.639] [undefined] GET(/user/:id): Playlists retrieved for user with id 1 with status 200 +[2025-09-06 10:15:54.651] [undefined] GET(/:id): try to get video 1 +[2025-09-06 10:15:54.658] [undefined] GET(/:id): successfully get video 1 with status 200 +[2025-09-06 10:15:54.669] [undefined] GET(/:id/similar): try to get similar videos for video 1 +[2025-09-06 10:15:54.676] [undefined] GET(/:id/similar): successfully get similar videos for video 1 with status 200 +[2025-09-06 10:15:54.696] [undefined] GET(/:id/views): try to add views for video 1 +[2025-09-06 10:15:54.704] [undefined] GET(/:id/views): successfully added views for video 1 with status 200 +[2025-09-06 10:15:57.359] [undefined] GET(/:id): try to get channel with id 1 +[2025-09-06 10:15:57.365] [undefined] GET(/:id): Successfully get channel with id 1 with status 200 +[2025-09-06 10:15:57.377] [undefined] GET(/:id/channel/subscribed): check if user 1 is subscribed to channel 1 +[2025-09-06 10:15:57.382] [undefined] GET(/:id/channel/subscribed): user 1 is subscribed to channel 1 with status 200 +[2025-09-06 10:16:01.637] [undefined] GET(/:id): try to get video 1 +[2025-09-06 10:16:01.642] [undefined] GET(/user/:id): Playlists retrieved for user with id 1 with status 200 +[2025-09-06 10:16:01.649] [undefined] GET(/:id): successfully get video 1 with status 200 +[2025-09-06 10:16:01.658] [undefined] GET(/:id/similar): try to get similar videos for video 1 +[2025-09-06 10:16:01.666] [undefined] GET(/:id/similar): successfully get similar videos for video 1 with status 200 +[2025-09-06 10:16:01.710] [undefined] GET(/:id/views): try to add views for video 1 +[2025-09-06 10:16:01.716] [undefined] GET(/:id/views): successfully added views for video 1 with status 200 +[2025-09-06 10:16:04.193] [undefined] GET(/see-later): 'See Later' playlist retrieved for user with id 1 with status 200 +[2025-09-06 10:16:13.098] [undefined] GET(/:id): try to get channel with id 2 +[2025-09-06 10:16:13.154] [undefined] GET(/:id): Successfully get channel with id 2 with status 200 +[2025-09-06 10:16:13.165] [undefined] GET(/:id/channel/subscribed): check if user 1 is subscribed to channel 2 +[2025-09-06 10:16:13.170] [undefined] GET(/:id/channel/subscribed): user 1 is not subscribed to channel 2 with status 200 +[2025-09-06 10:19:06.785] [undefined] GET(/:id): try to get channel with id 2 +[2025-09-06 10:19:06.798] [undefined] GET(/:id): Successfully get channel with id 2 with status 200 +[2025-09-06 10:19:06.814] [undefined] GET(/:id/channel/subscribed): check if user 1 is subscribed to channel 2 +[2025-09-06 10:19:06.819] [undefined] GET(/:id/channel/subscribed): user 1 is not subscribed to channel 2 with status 200 +[2025-09-06 10:19:15.009] [undefined] GET(/see-later): 'See Later' playlist retrieved for user with id 1 with status 200 +[2025-09-06 10:23:43.105] [undefined] GET(/:id/channel): try to retrieve channel of user 1 +[2025-09-06 10:23:43.111] [undefined] GET(/:id/channel): successfully retrieved channel of user 1 with status 200 +[2025-09-06 10:23:43.117] [undefined] GET(/:id/history): try to retrieve history of user 1 +[2025-09-06 10:23:43.124] [undefined] GET(/:id/history): successfully retrieved history of user 1 with status 200 +[2025-09-06 10:23:43.129] [undefined] GET(/user/:id): Playlists retrieved for user with id 1 with status 200 +[2025-09-06 10:23:44.349] [undefined] GET(/:id): try to get channel with id 1 +[2025-09-06 10:23:44.354] [undefined] GET(/:id/stats): try to get stats +[2025-09-06 10:23:44.359] [undefined] GET(/:id/stats): Successfully get stats with status 200 +[2025-09-06 10:23:44.365] [undefined] GET(/:id): Successfully get channel with id 1 with status 200 +[2025-09-06 10:23:47.007] [undefined] GET(/:id/history): try to retrieve history of user 1 +[2025-09-06 10:23:47.013] [undefined] GET(/:id/channel): try to retrieve channel of user 1 +[2025-09-06 10:23:47.066] [undefined] GET(/:id/history): successfully retrieved history of user 1 with status 200 +[2025-09-06 10:23:47.070] [undefined] GET(/:id/channel): successfully retrieved channel of user 1 with status 200 +[2025-09-06 10:23:47.077] [undefined] GET(/user/:id): Playlists retrieved for user with id 1 with status 200 +[2025-09-06 10:23:54.346] [undefined] GET(/:id): try to get channel with id 2 +[2025-09-06 10:23:54.352] [undefined] GET(/:id): Successfully get channel with id 2 with status 200 +[2025-09-06 10:23:54.364] [undefined] GET(/:id/channel/subscribed): check if user 1 is subscribed to channel 2 +[2025-09-06 10:23:54.370] [undefined] GET(/:id/channel/subscribed): user 1 is not subscribed to channel 2 with status 200 diff --git a/docker-compose.yaml b/docker-compose.yaml index ab63c0f..9a54746 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -23,7 +23,7 @@ services: FRONTEND_URL: ${FRONTEND_URL} volumes: - ./backend/logs:/var/log/freetube - - ./backend:/app + - upload:/app/backend/app/uploads depends_on: db: condition: service_healthy @@ -60,4 +60,6 @@ services: volumes: db_data: + driver: local + upload: driver: local \ No newline at end of file diff --git a/frontend/src/components/CreatorCard.jsx b/frontend/src/components/CreatorCard.jsx index efd16be..bdb0a06 100644 --- a/frontend/src/components/CreatorCard.jsx +++ b/frontend/src/components/CreatorCard.jsx @@ -2,9 +2,11 @@ export default function CreatorCard({ creator }) { const handleClick = () => { - window.location.href = `/manage-channel/${creator.id}`; + window.location.href = `/channel/${creator.channel_id}`; }; + console.log(creator); + return (
{ if (isFullscreen) { setShowControls(true); - + // Clear existing timeout if (hideControlsTimeoutRef.current) { clearTimeout(hideControlsTimeoutRef.current); } - + // Hide controls after 3 seconds of no mouse movement hideControlsTimeoutRef.current = setTimeout(() => { setShowControls(false); @@ -339,101 +339,100 @@ export default function Video() { setIsAddToPlaylistOpen(!isAddToPlaylistOpen); } - return ( -
- - -
- {video ? ( - <> - {/* Video player section */} -
- -
- - - {/* Video controls */} - +
{/* Similar videos section */} -
+
{ !isPlaylist ? ( -
-

Recommandations

- {similarVideos.length > 0 ? similarVideos.map((video, index) => ( -
- -
- )) : ( -

Aucune recommandation disponible

- )} -
+
+

Recommandations

+ {similarVideos.length > 0 ? similarVideos.map((video, index) => ( +
+ +
+ )) : ( +

Aucune recommandation disponible

+ )} +
) : ( -
-
+
+

{currentPlaylist?.name}

{ currentPlaylist?.videos && currentPlaylist.videos.length > 0 ? ( @@ -595,18 +602,18 @@ export default function Video() {

Aucune vidéo trouvée dans cette playlist.

) } -
-
+
+
) } -
- - ): ( -

Loading

- )} +
+ + ) : ( +

Loading

+ )} -
+ -
- ); +
+ ); } \ No newline at end of file