Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Fix missed issue during merge from upstream lib.rs

Ilya64f38f6a78bf
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs
index 7d84c5082..b8921d6cd 100644
--- a/apps/desktop/src-tauri/src/lib.rs
+++ b/apps/desktop/src-tauri/src/lib.rs
@@ -2019,116 +2019,6 @@ async fn send_feedback_request(app: AppHandle, feedback: String) -> Result<(), S
Ok(())
}
-#[tauri::command]
-#[specta::specta]
-async fn reupload_rendered_video(
- app: AppHandle,
- video_id: String,
- project: ProjectConfiguration,
-) -> Result<UploadResult, String> {
- let Ok(Some(mut auth)) = AuthStore::get(&app) else {
- AuthStore::set(&app, None).map_err(|e| e.to_string())?;
- return Ok(UploadResult::NotAuthenticated);
- };
-
- // Check if user has an upgraded plan
- if !auth.is_upgraded() {
- match AuthStore::fetch_and_update_plan(&app).await {
- Ok(_) => match AuthStore::get(&app) {
- Ok(Some(updated_auth)) => {
- auth = updated_auth;
- }
- Ok(None) => {
- return Ok(UploadResult::NotAuthenticated);
- }
- Err(e) => return Err(format!("Failed to refresh auth: {}", e)),
- },
- Err(e) => {
- if e.contains("Authentication expired") {
- return Ok(UploadResult::NotAuthenticated);
- }
- return Ok(UploadResult::PlanCheckFailed);
- }
- }
-
- if !auth.is_upgraded() {
- open_upgrade_window(app).await;
- return Ok(UploadResult::UpgradeRequired);
- }
- }
-
- let editor_instance = upsert_editor_instance(&app, video_id.clone()).await;
- let meta = editor_instance.meta();
-
- let Some(sharing) = meta.sharing.clone() else {
- return Err("No sharing metadata found".to_string());
- };
-
- UploadProgress {
- stage: "rendering".to_string(),
- progress: 0.0,
- message: "Preparing video...".to_string(),
- }
- .emit(&app)
- .ok();
-
- let output_path = match get_rendered_video(app.clone(), video_id.clone(), project).await {
- Ok(path) => {
- UploadProgress {
- stage: "rendering".to_string(),
- progress: 1.0,
- message: "Rendering complete".to_string(),
- }
- .emit(&app)
- .ok();
- path
- }
- Err(e) => {
- notifications::send_notification(&app, notifications::NotificationType::UploadFailed);
- return Err(format!("Failed to get rendered video: {}", e));
- }
- };
-
- // Start upload progress
- UploadProgress {
- stage: "uploading".to_string(),
- progress: 0.0,
- message: "Starting upload...".to_string(),
- }
- .emit(&app)
- .ok();
-
- // Get S3 config with the existing video ID
- let s3_config = get_s3_config(&app, false, Some(sharing.id)).await?;
-
- match upload_video(&app, video_id.clone(), output_path, false, Some(s3_config)).await {
- Ok(uploaded_video) => {
- // Emit upload complete
- UploadProgress {
- stage: "uploading".to_string(),
- progress: 1.0,
- message: "Upload complete!".to_string(),
- }
- .emit(&app)
- .ok();
-
- notifications::send_notification(
- &app,
- notifications::NotificationType::ShareableLinkCopied,
- );
-
- #[cfg(target_os = "macos")]
- platform::write_string_to_pasteboard(&uploaded_video.link);
-
- Ok(UploadResult::Success(sharing.link)) // Use existing sharing link
- }
- Err(e) => {
- notifications::send_notification(&app, notifications::NotificationType::UploadFailed);
- Err(e)
- }
- }
-}
-
#[tauri::command]
#[specta::specta]
fn global_message_dialog(app: AppHandle, message: String) {