Fix: Force pull images in deploy workflow
All checks were successful
Build and Push / build-all (push) Successful in 8m52s
All checks were successful
Build and Push / build-all (push) Successful in 8m52s
This commit is contained in:
parent
5430e434c3
commit
7f56f19e94
10 changed files with 164 additions and 30 deletions
|
|
@ -2536,7 +2536,7 @@ void AdminController::uploadDefaultAvatars(const HttpRequestPtr &req,
|
|||
}
|
||||
|
||||
// Create avatars directory if it doesn't exist
|
||||
std::string avatarsDir = "/data/uploads/avatars";
|
||||
std::string avatarsDir = "/app/uploads/avatars";
|
||||
std::filesystem::create_directories(avatarsDir);
|
||||
|
||||
Json::Value uploaded(Json::arrayValue);
|
||||
|
|
@ -2667,7 +2667,7 @@ void AdminController::deleteDefaultAvatar(const HttpRequestPtr &req,
|
|||
<< id
|
||||
>> [callback, filePath](const Result&) {
|
||||
// Delete file from filesystem
|
||||
std::string fullPath = "/data" + filePath;
|
||||
std::string fullPath = "/app" + filePath;
|
||||
std::filesystem::remove(fullPath);
|
||||
|
||||
Json::Value resp;
|
||||
|
|
|
|||
|
|
@ -562,20 +562,87 @@ void WatchController::removeFromPlaylist(const HttpRequestPtr &req,
|
|||
<< iId << rId
|
||||
>> [callback, dbClient, rId, isDeletingCurrentVideo](const Result&) {
|
||||
if (isDeletingCurrentVideo) {
|
||||
// Clear the current video state
|
||||
*dbClient << "UPDATE watch_room_state SET current_video_id = NULL, "
|
||||
"playback_state = 'paused', current_time_seconds = 0, "
|
||||
"last_sync_at = CURRENT_TIMESTAMP WHERE realm_id = $1"
|
||||
// FIX: Instead of just clearing the state, try to advance to next video
|
||||
// Get next queued video (prioritize locked, then by created_at)
|
||||
*dbClient << "SELECT id, youtube_video_id, title, duration_seconds, thumbnail_url, is_locked "
|
||||
"FROM watch_playlist "
|
||||
"WHERE realm_id = $1 AND status = 'queued' "
|
||||
"ORDER BY is_locked DESC NULLS LAST, created_at ASC LIMIT 1"
|
||||
<< rId
|
||||
>> [callback](const Result&) {
|
||||
Json::Value resp;
|
||||
resp["success"] = true;
|
||||
resp["clearedCurrentVideo"] = true;
|
||||
callback(jsonResp(resp));
|
||||
>> [callback, dbClient, rId](const Result& nextResult) {
|
||||
if (nextResult.empty()) {
|
||||
// No more videos - clear the state
|
||||
*dbClient << "UPDATE watch_room_state SET current_video_id = NULL, "
|
||||
"playback_state = 'paused', current_time_seconds = 0, "
|
||||
"last_sync_at = CURRENT_TIMESTAMP WHERE realm_id = $1"
|
||||
<< rId
|
||||
>> [callback](const Result&) {
|
||||
Json::Value resp;
|
||||
resp["success"] = true;
|
||||
resp["clearedCurrentVideo"] = true;
|
||||
resp["currentVideo"] = Json::nullValue;
|
||||
resp["playbackState"] = "paused";
|
||||
callback(jsonResp(resp));
|
||||
}
|
||||
>> [callback](const DrogonDbException& e) {
|
||||
LOG_ERROR << "Failed to clear room state: " << e.base().what();
|
||||
Json::Value resp;
|
||||
resp["success"] = true;
|
||||
callback(jsonResp(resp));
|
||||
};
|
||||
} else {
|
||||
// Advance to next video
|
||||
int64_t nextVideoId = nextResult[0]["id"].as<int64_t>();
|
||||
std::string youtubeVideoId = nextResult[0]["youtube_video_id"].as<std::string>();
|
||||
std::string title = nextResult[0]["title"].as<std::string>();
|
||||
int durationSeconds = nextResult[0]["duration_seconds"].as<int>();
|
||||
std::string thumbnailUrl = nextResult[0]["thumbnail_url"].isNull() ? "" : nextResult[0]["thumbnail_url"].as<std::string>();
|
||||
bool isLocked = nextResult[0]["is_locked"].isNull() ? false : nextResult[0]["is_locked"].as<bool>();
|
||||
|
||||
// Update next video to playing
|
||||
*dbClient << "UPDATE watch_playlist SET status = 'playing', "
|
||||
"started_at = CURRENT_TIMESTAMP WHERE id = $1"
|
||||
<< nextVideoId
|
||||
>> [callback, dbClient, rId, nextVideoId, youtubeVideoId, title, durationSeconds, thumbnailUrl, isLocked](const Result&) {
|
||||
// Update room state to point to new video
|
||||
*dbClient << "UPDATE watch_room_state SET current_video_id = $1, "
|
||||
"playback_state = 'playing', current_time_seconds = 0, "
|
||||
"last_sync_at = CURRENT_TIMESTAMP WHERE realm_id = $2"
|
||||
<< nextVideoId << rId
|
||||
>> [callback, nextVideoId, youtubeVideoId, title, durationSeconds, thumbnailUrl, isLocked](const Result&) {
|
||||
Json::Value resp;
|
||||
resp["success"] = true;
|
||||
resp["advancedToNext"] = true;
|
||||
resp["playbackState"] = "playing";
|
||||
resp["currentTime"] = 0.0;
|
||||
|
||||
Json::Value video;
|
||||
video["id"] = static_cast<Json::Int64>(nextVideoId);
|
||||
video["youtubeVideoId"] = youtubeVideoId;
|
||||
video["title"] = title;
|
||||
video["durationSeconds"] = durationSeconds;
|
||||
video["thumbnailUrl"] = thumbnailUrl;
|
||||
video["isLocked"] = isLocked;
|
||||
resp["currentVideo"] = video;
|
||||
callback(jsonResp(resp));
|
||||
}
|
||||
>> [callback](const DrogonDbException& e) {
|
||||
LOG_ERROR << "Failed to update room state: " << e.base().what();
|
||||
Json::Value resp;
|
||||
resp["success"] = true;
|
||||
callback(jsonResp(resp));
|
||||
};
|
||||
}
|
||||
>> [callback](const DrogonDbException& e) {
|
||||
LOG_ERROR << "Failed to update next video: " << e.base().what();
|
||||
Json::Value resp;
|
||||
resp["success"] = true;
|
||||
callback(jsonResp(resp));
|
||||
};
|
||||
}
|
||||
}
|
||||
>> [callback](const DrogonDbException& e) {
|
||||
LOG_ERROR << "Failed to clear room state: " << e.base().what();
|
||||
// Still return success since video was deleted
|
||||
LOG_ERROR << "Failed to get next video: " << e.base().what();
|
||||
Json::Value resp;
|
||||
resp["success"] = true;
|
||||
callback(jsonResp(resp));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue