A photo manager for VRChat.

update to new backend

Changed files
+13 -18
src
src-tauri
+2 -2
src-tauri/src/main.rs
··· 53 53 54 54 #[tauri::command] 55 55 fn start_user_auth() { 56 - open::that("https://id.phazed.xyz?oauth=79959294626406").unwrap(); 56 + open::that("https://photos.phazed.xyz/api/v1/auth").unwrap(); 57 57 } 58 58 59 59 #[tauri::command] ··· 266 266 267 267 let mut cmd = Command::new(&container_folder.join("./updater.exe")); 268 268 cmd.current_dir(container_folder); 269 - cmd.spawn().expect("Cannot run VRChat Photo Manager"); 269 + cmd.spawn().expect("Cannot run updater"); 270 270 271 271 process::exit(0); 272 272 }
+4 -4
src-tauri/src/photosync.rs
··· 41 41 let re1 = Regex::new(r"(?m)VRChat_[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}-[0-9]{2}.[0-9]{3}_[0-9]{4}x[0-9]{4}.png").unwrap(); 42 42 let re2 = Regex::new( 43 43 r"(?m)VRChat_[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}-[0-9]{2}.[0-9]{3}_[0-9]{4}x[0-9]{4}_wrld_[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}.png").unwrap(); 44 - 44 + 45 45 if 46 46 re1.is_match(p.file_name().to_str().unwrap()) || 47 47 re2.is_match(p.file_name().to_str().unwrap()) ··· 55 55 } 56 56 } 57 57 58 - let body = reqwest::blocking::get(format!("https://photos.phazed.xyz/api/v1/photos/exists?token={}", &token)).unwrap() 58 + let body = reqwest::blocking::get(format!("https://photos-cdn.phazed.xyz/api/v1/photos/exists?token={}", &token)).unwrap() 59 59 .text().unwrap(); 60 60 61 61 let body: Value = serde_json::from_str(&body).unwrap(); ··· 97 97 98 98 match file{ 99 99 Ok(file) => { 100 - let res = client.put(format!("https://photos.phazed.xyz/api/v1/photos?token={}", &token)) 100 + let res = client.put(format!("https://photos-cdn.phazed.xyz/api/v1/photos?token={}", &token)) 101 101 .header("Content-Type", "image/png") 102 102 .header("filename", photo) 103 103 .body(file) ··· 164 164 165 165 let full_path = format!("{}\\{}\\{}", path.to_str().unwrap(), folder_name, photo); 166 166 167 - let res = client.get(format!("https://photos.phazed.xyz/api/v1/photos?token={}&photo={}", &token, &photo)) 167 + let res = client.get(format!("https://photos-cdn.phazed.xyz/api/v1/photos?token={}&photo={}", &token, &photo)) 168 168 .timeout(Duration::from_secs(120)) 169 169 .send().unwrap().bytes(); 170 170
+1 -1
src-tauri/tauri.conf.json
··· 23 23 "http": { 24 24 "all": true, 25 25 "request": true, 26 - "scope": [ "https://photos.phazed.xyz/*" ] 26 + "scope": [ "https://photos.phazed.xyz/*", "https://photos-cdn.phazed.xyz/*" ] 27 27 }, 28 28 "window": { 29 29 "close": true,
+2 -4
src/Components/App.tsx
··· 36 36 } 37 37 38 38 if(localStorage.getItem('token')){ 39 - fetch<any>('https://photos.phazed.xyz/api/v1/account', { 39 + fetch<any>('https://photos.phazed.xyz/api/v1/account?token='+localStorage.getItem('token'), { 40 40 method: 'GET', 41 - headers: { auth: localStorage.getItem('token' )}, 42 41 responseType: ResponseType.JSON 43 42 }) 44 43 .then(data => { ··· 116 115 listen('auth-callback', ( event: any ) => { 117 116 let token = event.payload; 118 117 119 - fetch<any>('https://photos.phazed.xyz/api/v1/account', { 118 + fetch<any>('https://photos.phazed.xyz/api/v1/account?token='+token, { 120 119 method: 'GET', 121 - headers: { auth: token }, 122 120 responseType: ResponseType.JSON 123 121 }) 124 122 .then(data => {
+2 -4
src/Components/NavBar.tsx
··· 148 148 duration: 250 149 149 }) 150 150 151 - fetch<any>('https://photos.phazed.xyz/api/v1/account', { 151 + fetch<any>('https://photos.phazed.xyz/api/v1/account?token='+localStorage.getItem('token')!, { 152 152 method: 'GET', 153 - headers: { auth: localStorage.getItem('token')! }, 154 153 responseType: ResponseType.JSON 155 154 }) 156 155 .then(data => { ··· 171 170 172 171 <Show when={props.loggedIn().loggedIn == false} fallback={ 173 172 <div class="dropdown-button" onClick={() => { 174 - fetch<any>('https://photos.phazed.xyz/api/v1/deauth', { 173 + fetch<any>('https://photos.phazed.xyz/api/v1/deauth?token='+localStorage.getItem('token')!, { 175 174 method: 'DELETE', 176 - headers: { auth: localStorage.getItem('token')! }, 177 175 responseType: ResponseType.JSON 178 176 }) 179 177 .then(data => {
+2 -3
src/Components/SettingsMenu.tsx
··· 172 172 }) 173 173 174 174 let refreshAccount = () => { 175 - fetch<any>('https://photos.phazed.xyz/api/v1/account', { 175 + fetch<any>('https://photos.phazed.xyz/api/v1/account?token='+localStorage.getItem('token')!, { 176 176 method: 'GET', 177 - headers: { auth: localStorage.getItem('token')! }, 178 177 responseType: ResponseType.JSON 179 178 }) 180 179 .then(data => { ··· 363 362 props.setStorageInfo({ used: 0, storage: 0, sync: false }); 364 363 setDeletingPhotos(true); 365 364 366 - fetch<any>('https://photos.phazed.xyz/api/v1/allphotos', { 365 + fetch<any>('https://photos-cdn.phazed.xyz/api/v1/allphotos', { 367 366 method: 'DELETE', 368 367 headers: { auth: localStorage.getItem("token")! }, 369 368 responseType: ResponseType.JSON