A photo manager for VRChat.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

use the proper photo path

+29 -9
+18 -9
src-tauri/src/main.rs
··· 33 33 open::that(url).unwrap(); 34 34 } 35 35 36 + #[tauri::command] 37 + fn get_user_photos_path() -> path::PathBuf { 38 + dirs::picture_dir().unwrap().join("VRChat") 39 + } 40 + 36 41 // When the user changes the start with windows toggle 37 42 // create and delete the shortcut from the startup folder 38 43 #[tauri::command] ··· 76 81 #[tauri::command] 77 82 fn load_photos(window: tauri::Window) { 78 83 thread::spawn(move || { 79 - let base_dir = dirs::home_dir().unwrap().join("Pictures\\VRChat"); 84 + let base_dir = dirs::picture_dir().unwrap().join("VRChat"); 80 85 81 86 let mut photos: Vec<path::PathBuf> = Vec::new(); 82 87 let mut size: usize = 0; ··· 105 110 if metadata.is_file() { 106 111 size += metadata.len() as usize; 107 112 108 - let path = path.strip_prefix(dirs::home_dir().unwrap().join("Pictures\\VRChat")).unwrap().to_path_buf(); 113 + let path = path.strip_prefix(dirs::picture_dir().unwrap().join("VRChat")).unwrap().to_path_buf(); 109 114 photos.push(path); 110 115 } 111 116 } ··· 125 130 let photo = photo.to_string(); 126 131 127 132 thread::spawn(move || { 128 - let mut base_dir = dirs::home_dir().unwrap().join("Pictures\\VRChat"); 133 + let mut base_dir = dirs::picture_dir().unwrap().join("VRChat"); 129 134 base_dir.push(&photo); 130 135 131 136 let mut file = fs::File::open(base_dir.clone()).expect("Cannot read image file."); ··· 139 144 // Delete a photo when the users confirms the prompt in the ui 140 145 #[tauri::command] 141 146 fn delete_photo( path: &str ){ 142 - let p = dirs::home_dir().unwrap().join("Pictures\\VRChat").join(path); 147 + let p = dirs::picture_dir().unwrap().join("VRChat").join(path); 143 148 fs::remove_file(p).unwrap(); 144 149 } 145 150 ··· 175 180 re1.is_match(path.to_str().unwrap()) || 176 181 re2.is_match(path.to_str().unwrap()) 177 182 { 178 - sender.send((2, path.clone().strip_prefix(dirs::home_dir().unwrap().join("Pictures\\VRChat")).unwrap().to_path_buf())).unwrap(); 183 + sender.send((2, path.clone().strip_prefix(dirs::picture_dir().unwrap().join("VRChat")).unwrap().to_path_buf())).unwrap(); 179 184 } 180 185 }, 181 186 EventKind::Create(_) => { ··· 188 193 re1.is_match(path.to_str().unwrap()) || 189 194 re2.is_match(path.to_str().unwrap()) 190 195 { 191 - sender.send((1, path.clone().strip_prefix(dirs::home_dir().unwrap().join("Pictures\\VRChat")).unwrap().to_path_buf())).unwrap(); 196 + sender.send((1, path.clone().strip_prefix(dirs::picture_dir().unwrap().join("VRChat")).unwrap().to_path_buf())).unwrap(); 192 197 } 193 198 }, 194 199 _ => {} ··· 198 203 } 199 204 }).unwrap(); 200 205 201 - watcher.watch(&dirs::home_dir().unwrap().join("Pictures\\VRChat"), RecursiveMode::Recursive).unwrap(); 206 + watcher.watch(&dirs::picture_dir().unwrap().join("VRChat"), RecursiveMode::Recursive).unwrap(); 202 207 203 208 tauri::Builder::default() 204 209 .system_tray(tray) ··· 250 255 251 256 let path = uri.replace("photo://localhost/", ""); 252 257 253 - let mut base_dir = dirs::home_dir().unwrap().join("Pictures\\VRChat"); 258 + let mut base_dir = dirs::picture_dir().unwrap().join("VRChat"); 254 259 base_dir.push(path); 255 260 256 261 let file = fs::File::open(base_dir); ··· 323 328 324 329 Ok(()) 325 330 }) 326 - .invoke_handler(tauri::generate_handler![start_user_auth, load_photos, close_splashscreen, load_photo_meta, delete_photo, open_url, find_world_by_id, start_with_win]) 331 + .invoke_handler(tauri::generate_handler![ 332 + start_user_auth, load_photos, close_splashscreen, 333 + load_photo_meta, delete_photo, open_url, 334 + find_world_by_id, start_with_win, get_user_photos_path 335 + ]) 327 336 .run(tauri::generate_context!()) 328 337 .expect("error while running tauri application"); 329 338 }
+4
src/Components/SettingsMenu.tsx
··· 190 190 </div> 191 191 </label> 192 192 </div> 193 + 194 + <br /> 195 + <p>VRChat Photo Path: <span class="path" ref={( el ) => invoke('get_user_photos_path').then(( path: any ) => { el.innerHTML = path; console.log(path) })}>Loading...</span></p> 196 + <p>Final Photo Path: <span class="path" ref={( el ) => invoke('get_user_photos_path').then(( path: any ) => { el.innerHTML = path; console.log(path) })}>Loading...</span></p> 193 197 </div> 194 198 <div class="settings-block"> 195 199 <h1>Account Settings</h1>
+7
src/styles.css
··· 557 557 .selector input:checked ~ label .selection-box{ 558 558 background: rgba(0, 146, 204, 0.705); 559 559 color: #fff; 560 + } 561 + 562 + .path{ 563 + padding: 5px 10px; 564 + background: #000a; 565 + border-radius: 5px; 566 + margin-left: 5px; 560 567 }