+4
-1
changelog
+4
-1
changelog
+1
-1
src-tauri/src/main.rs
+1
-1
src-tauri/src/main.rs
···
12
use notify::{EventKind, RecursiveMode, Watcher};
13
use pngmeta::PNGImage;
14
use regex::Regex;
15
-
use util::handle_deeplink;
16
use std::{env, fs, thread};
17
use tauri::{Emitter, Manager, WindowEvent};
18
use tauri_plugin_deep_link::DeepLinkExt;
···
124
}
125
}).unwrap();
126
127
watcher
128
.watch(
129
&util::get_photo_path::get_photo_path(),
···
12
use notify::{EventKind, RecursiveMode, Watcher};
13
use pngmeta::PNGImage;
14
use regex::Regex;
15
use std::{env, fs, thread};
16
use tauri::{Emitter, Manager, WindowEvent};
17
use tauri_plugin_deep_link::DeepLinkExt;
···
123
}
124
}).unwrap();
125
126
+
println!("Watching dir: {:?}", util::get_photo_path::get_photo_path());
127
watcher
128
.watch(
129
&util::get_photo_path::get_photo_path(),
+3
-3
src-tauri/src/photosync.rs
+3
-3
src-tauri/src/photosync.rs
···
14
pub fn sync_photos(token: String, path: path::PathBuf, window: tauri::Window) {
15
let sync_lock_path = dirs::config_dir()
16
.unwrap()
17
-
.join("PhazeDev\\VRChatPhotoManager\\.sync_lock");
18
19
match fs::metadata(&sync_lock_path) {
20
Ok(_) => {
···
207
folder_name.nth(0).unwrap()
208
);
209
210
-
let full_path = format!("{}\\{}\\{}", path.to_str().unwrap(), folder_name, photo);
211
212
let res = client
213
.get(format!(
···
221
222
match res {
223
Ok(res) => {
224
-
let folder_path = format!("{}\\{}", path.to_str().unwrap(), folder_name);
225
match fs::metadata(&folder_path) {
226
Ok(_) => {}
227
Err(_) => {
···
14
pub fn sync_photos(token: String, path: path::PathBuf, window: tauri::Window) {
15
let sync_lock_path = dirs::config_dir()
16
.unwrap()
17
+
.join("PhazeDev/VRChatPhotoManager/.sync_lock");
18
19
match fs::metadata(&sync_lock_path) {
20
Ok(_) => {
···
207
folder_name.nth(0).unwrap()
208
);
209
210
+
let full_path = format!("{}/{}/{}", path.to_str().unwrap(), folder_name, photo);
211
212
let res = client
213
.get(format!(
···
221
222
match res {
223
Ok(res) => {
224
+
let folder_path = format!("{}/{}", path.to_str().unwrap(), folder_name);
225
match fs::metadata(&folder_path) {
226
Ok(_) => {}
227
Err(_) => {
+31
-21
src/Components/PhotoList.tsx
+31
-21
src/Components/PhotoList.tsx
···
372
})
373
374
listen('show-window', () => {
375
-
requestAnimationFrame(render);
376
})
377
378
listen('photo_meta_loaded', ( event: any ) => {
···
471
472
let loadPhotos = async () => {
473
photoPath = await invoke('get_user_photos_path') + '/';
474
-
invoke('load_photos')
475
476
listen('photos_loaded', ( event: any ) => {
477
let photoPaths = event.payload.photos.reverse();
···
482
483
let doesHaveLegacy = false;
484
485
-
if(photoPaths.length === 0){
486
anime({
487
targets: photoTreeLoadingContainer,
488
height: 0,
···
493
photoTreeLoadingContainer.style.display = 'none';
494
}
495
})
496
-
497
anime({
498
targets: '.reload-photos',
499
opacity: 1,
500
duration: 150,
501
easing: 'easeInOutQuad'
502
})
503
-
}
504
505
-
photoPaths.forEach(( path: string ) => {
506
-
let photo
507
-
508
-
if(path.slice(0, 9) === "legacy://"){
509
-
photo = new Photo(path.slice(9), true);
510
-
doesHaveLegacy = true;
511
-
} else
512
-
photo = new Photo(path, false);
513
-
514
-
photos.push(photo);
515
-
photo.loadMeta();
516
-
})
517
-
518
-
if(doesHaveLegacy){
519
-
photos = photos.sort(( a, b ) => b.date.valueOf() - a.date.valueOf());
520
}
521
-
})
522
}
523
524
onMount(() => {
···
372
})
373
374
listen('show-window', () => {
375
+
if(hasFirstLoaded)
376
+
requestAnimationFrame(render);
377
})
378
379
listen('photo_meta_loaded', ( event: any ) => {
···
472
473
let loadPhotos = async () => {
474
photoPath = await invoke('get_user_photos_path') + '/';
475
476
listen('photos_loaded', ( event: any ) => {
477
let photoPaths = event.payload.photos.reverse();
···
482
483
let doesHaveLegacy = false;
484
485
+
photoPaths.forEach(( path: string ) => {
486
+
let photo
487
+
488
+
if(path.slice(0, 9) === "legacy://"){
489
+
photo = new Photo(path.slice(9), true);
490
+
doesHaveLegacy = true;
491
+
} else
492
+
photo = new Photo(path, false);
493
+
494
+
photos.push(photo);
495
+
photo.loadMeta();
496
+
})
497
+
498
+
if(doesHaveLegacy){
499
+
photos = photos.sort(( a, b ) => b.date.valueOf() - a.date.valueOf());
500
+
}
501
+
502
+
console.log(photos.length + ' Photos found.');
503
+
if(photos.length === 0){
504
+
console.log('No photos found, Skipping loading stage.');
505
+
506
+
filteredPhotos = photos;
507
+
hasFirstLoaded = true;
508
+
509
anime({
510
targets: photoTreeLoadingContainer,
511
height: 0,
···
516
photoTreeLoadingContainer.style.display = 'none';
517
}
518
})
519
+
520
anime({
521
targets: '.reload-photos',
522
opacity: 1,
523
duration: 150,
524
easing: 'easeInOutQuad'
525
})
526
527
+
render();
528
}
529
+
});
530
+
531
+
invoke('load_photos');
532
}
533
534
onMount(() => {