Skip to content

Commit

Permalink
cs_user
Browse files Browse the repository at this point in the history
  • Loading branch information
dragoonDorise committed Sep 29, 2024
1 parent 82e86fd commit 46624f7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions cloudSyncHealth.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function cloud_sync_download_test($emuName){
"test" | Set-Content "$target\.temp" -ErrorAction SilentlyContinue -Encoding UTF8
$fileHash = "$target\.temp"
Write-Host "Testing $emuName download..."
& $cloud_sync_bin -q --log-file "$userFolder/EmuDeck/logs/rclone.log" copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 "$cloud_sync_provider`:Emudeck\saves\$emuName\.temp" "$fileHash"
& $cloud_sync_bin -q --log-file "$userFolder/EmuDeck/logs/rclone.log" copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 "$cloud_sync_provider`:$cs_user`Emudeck\saves\$emuName\.temp" "$fileHash"
if ($?) {
Write-Host "success" -ForegroundColor Green
}else{
Expand All @@ -62,7 +62,7 @@ function cloud_sync_upload_test($emuNAme){

Write-Host "Testing $emuName upload..."

& $cloud_sync_bin -q --log-file "$userFolder/EmuDeck/logs/rclone.log" copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 "$fileHash" "$cloud_sync_provider`:Emudeck\saves\$emuName\.temp"
& $cloud_sync_bin -q --log-file "$userFolder/EmuDeck/logs/rclone.log" copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 "$fileHash" "$cloud_sync_provider`:$cs_user`Emudeck\saves\$emuName\.temp"
if ($?) {
Write-Host "success" -ForegroundColor Green
}else{
Expand Down
2 changes: 1 addition & 1 deletion functions/JSONtoPS1.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function storePatreonToken($token){
mkdir "$savesPath" -ErrorAction SilentlyContinue
$token | Set-Content -Path "$savesPath/.token" -Encoding UTF8
if (Test-Path "$cloud_sync_bin") {
& $cloud_sync_bin --progress copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 "$savesPath/.token" "$cloud_sync_provider`:Emudeck\saves\.token"
& $cloud_sync_bin --progress copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 "$savesPath/.token" "$cloud_sync_provider`:$cs_user`Emudeck\saves\.token"
}
}

Expand Down
34 changes: 17 additions & 17 deletions functions/ToolScripts/emuDeckSaveSync.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ function cloud_sync_config($cloud_sync_provider, $token){
Start-Process $cloud_sync_bin -ArgumentList @"
config update $cloud_sync_provider
"@ -WindowStyle Maximized -Wait
& $cloud_sync_bin mkdir "$cloud_sync_provider`:Emudeck\saves"
& $cloud_sync_bin copy $savesPath "$cloud_sync_provider`:Emudeck\saves" --include "*.cloud"
& $cloud_sync_bin mkdir "$cloud_sync_provider`:$cs_user`Emudeck\saves"
& $cloud_sync_bin copy $savesPath "$cloud_sync_provider`:$cs_user`Emudeck\saves" --include "*.cloud"
#Cleaning up
Get-ChildItem -Path $carpetaLocal -Filter "*.cloud" | ForEach-Object {
Remove-Item $_.FullName
Expand All @@ -253,8 +253,8 @@ function cloud_sync_config($cloud_sync_provider, $token){
Start-Process $cloud_sync_bin -ArgumentList @"
config update "Emudeck-SFTP" host=$($credentials.Url) user=$($credentials.Username) port=$($credentials.Port) pass="$obscuredPassword"
"@ -WindowStyle Maximized -Wait
& $cloud_sync_bin mkdir "$cloud_sync_provider`:Emudeck\saves"
& $cloud_sync_bin copy $savesPath "$cloud_sync_provider`:Emudeck\saves" --include "*.cloud"
& $cloud_sync_bin mkdir "$cloud_sync_provider`:$cs_user`Emudeck\saves"
& $cloud_sync_bin copy $savesPath "$cloud_sync_provider`:$cs_user`Emudeck\saves" --include "*.cloud"
#Cleaning up
Get-ChildItem -Path $carpetaLocal -Filter "*.cloud" | ForEach-Object {
Remove-Item $_.FullName
Expand All @@ -277,8 +277,8 @@ function cloud_sync_config($cloud_sync_provider, $token){
Start-Process $cloud_sync_bin -ArgumentList @"
config update "Emudeck-cloud" host="cloud.emudeck.com" user="cs_$user" port="22" pass="$pass"
"@ -WindowStyle Maximized -Wait
& $cloud_sync_bin mkdir "$cloud_sync_provider`:Emudeck\saves"
& $cloud_sync_bin copy $savesPath "$cloud_sync_provider`:Emudeck\saves" --include "*.cloud"
& $cloud_sync_bin mkdir "$cloud_sync_provider`:$cs_user`Emudeck\saves"
& $cloud_sync_bin copy $savesPath "$cloud_sync_provider`:$cs_user`Emudeck\saves" --include "*.cloud"
#Cleaning up
Get-ChildItem -Path $carpetaLocal -Filter "*.cloud" | ForEach-Object {
Remove-Item $_.FullName
Expand All @@ -298,8 +298,8 @@ function cloud_sync_config($cloud_sync_provider, $token){
createCloudFile $_.FullName
}

& $cloud_sync_bin mkdir "$cloud_sync_provider`:Emudeck\saves"
& $cloud_sync_bin copy $savesPath "$cloud_sync_provider`:Emudeck\saves" --include "*.cloud"
& $cloud_sync_bin mkdir "$cloud_sync_provider`:$cs_user`Emudeck\saves"
& $cloud_sync_bin copy $savesPath "$cloud_sync_provider`:$cs_user`Emudeck\saves" --include "*.cloud"
#Cleaning up
Get-ChildItem -Path $carpetaLocal -Filter "*.cloud" | ForEach-Object {
Remove-Item $_.FullName
Expand Down Expand Up @@ -426,7 +426,7 @@ function cloud_sync_download($emuName){
if ((Test-Path "$cloud_sync_bin") -and ($cloud_sync_status -eq $true)) {


& "$cloud_sync_bin" --progress copyto -L --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 --log-file "$userFolder/EmuDeck/logs/rclone.log" "$cloud_sync_provider`:Emudeck/saves/.token" "$savesPath/.token"
& "$cloud_sync_bin" --progress copyto -L --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 --log-file "$userFolder/EmuDeck/logs/rclone.log" "$cloud_sync_provider`:$cs_user`Emudeck/saves/.token" "$savesPath/.token"

$tokenPath = "$savesPath/.token"
if (Test-Path $tokenPath) {
Expand Down Expand Up @@ -470,7 +470,7 @@ function cloud_sync_download($emuName){
$hash="0"
}

& $cloud_sync_bin --progress copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 --log-file "$userFolder/EmuDeck/logs/rclone.log" "$cloud_sync_provider`:Emudeck\saves\.hash" "$fileHash"
& $cloud_sync_bin --progress copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 --log-file "$userFolder/EmuDeck/logs/rclone.log" "$cloud_sync_provider`:$cs_user`Emudeck\saves\.hash" "$fileHash"

if (Test-Path -PathType Any "$fileHash"){
$hashCloud= Get-Content $fileHash
Expand All @@ -482,7 +482,7 @@ function cloud_sync_download($emuName){
$dialog = steamToast -MessageText "Saves up to date, no need to sync"
}else{
$dialog = steamToast -MessageText "Downloading saves for all installed system, please wait..."
& $cloud_sync_bin copy --fast-list --update --checkers=50 --exclude=/.fail_upload --exclude=/.fail_download --exclude=/system/prod.keys --exclude=/system/title.keys --exclude=/.pending_upload --exclude=/.watching --exclude=/*.lnk --exclude=/.cloud --exclude=/.emulator -q --log-file "$userFolder/EmuDeck/logs/rclone.log" --exclude=/.user "$cloud_sync_provider`:Emudeck\saves\" "$target"
& $cloud_sync_bin copy --fast-list --update --checkers=50 --exclude=/.fail_upload --exclude=/.fail_download --exclude=/system/prod.keys --exclude=/system/title.keys --exclude=/.pending_upload --exclude=/.watching --exclude=/*.lnk --exclude=/.cloud --exclude=/.emulator -q --log-file "$userFolder/EmuDeck/logs/rclone.log" --exclude=/.user "$cloud_sync_provider`:$cs_user`Emudeck\saves\" "$target"
if ($?) {
$baseFolder = "$target"
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Expand All @@ -501,7 +501,7 @@ function cloud_sync_download($emuName){
}
}else{
$dialog = steamToast -MessageText "Downloading saves for all installed system, please wait..."
& $cloud_sync_bin copy --update --fast-list --checkers=50 --exclude=/.fail_upload --exclude=/.fail_download --exclude=/system/prod.keys --exclude=/system/title.keys --exclude=/.pending_upload --exclude=/.watching --exclude=/*.lnk --exclude=/.cloud --exclude=/.emulator --exclude=/.user --log-file "$userFolder/EmuDeck/logs/rclone.log" "$cloud_sync_provider`:Emudeck\saves\" "$target"
& $cloud_sync_bin copy --update --fast-list --checkers=50 --exclude=/.fail_upload --exclude=/.fail_download --exclude=/system/prod.keys --exclude=/system/title.keys --exclude=/.pending_upload --exclude=/.watching --exclude=/*.lnk --exclude=/.cloud --exclude=/.emulator --exclude=/.user --log-file "$userFolder/EmuDeck/logs/rclone.log" "$cloud_sync_provider`:$cs_user`Emudeck\saves\" "$target"
if ($?) {
$baseFolder = "$target"
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Expand Down Expand Up @@ -530,7 +530,7 @@ function cloud_sync_download($emuName){
$hash="0"
}

& $cloud_sync_bin -q --log-file "$userFolder/EmuDeck/logs/rclone.log" copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 --log-file "$userFolder/EmuDeck/logs/rclone.log" "$cloud_sync_provider`:Emudeck\saves\$emuName\.hash" "$fileHash"
& $cloud_sync_bin -q --log-file "$userFolder/EmuDeck/logs/rclone.log" copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 --log-file "$userFolder/EmuDeck/logs/rclone.log" "$cloud_sync_provider`:$cs_user`Emudeck\saves\$emuName\.hash" "$fileHash"

if (Test-Path -PathType Any "$fileHash"){
$hashCloud= Get-Content $fileHash
Expand All @@ -542,11 +542,11 @@ function cloud_sync_download($emuName){
$dialog = steamToast -MessageText "Saves up to date, no need to sync"
}else{
$dialog = steamToast -MessageText "Downloading saves for $emuName, please wait..."
& $cloud_sync_bin copy --fast-list --update --tpslimit 12 --checkers=50 --exclude=/.fail_upload --exclude=/.fail_download --exclude=/system/prod.keys --exclude=/system/title.keys --exclude=/.pending_upload --exclude=/.watching --exclude=/*.lnk --exclude=/.cloud --exclude=/.emulator -q --log-file "$userFolder/EmuDeck/logs/rclone.log" --exclude=/.user "$cloud_sync_provider`:Emudeck\saves\$emuName\" "$target"
& $cloud_sync_bin copy --fast-list --update --tpslimit 12 --checkers=50 --exclude=/.fail_upload --exclude=/.fail_download --exclude=/system/prod.keys --exclude=/system/title.keys --exclude=/.pending_upload --exclude=/.watching --exclude=/*.lnk --exclude=/.cloud --exclude=/.emulator -q --log-file "$userFolder/EmuDeck/logs/rclone.log" --exclude=/.user "$cloud_sync_provider`:$cs_user`Emudeck\saves\$emuName\" "$target"
}
}else{
$dialog = steamToast -MessageText "Downloading saves for $emuName, please wait..."
& $cloud_sync_bin copy --fast-list --update --tpslimit 12 --checkers=50 --exclude=/.fail_upload --exclude=/.fail_download --exclude=/system/prod.keys --exclude=/system/title.keys --exclude=/.pending_upload --exclude=/.watching --exclude=/*.lnk --exclude=/.cloud --exclude=/.emulator -q --log-file "$userFolder/EmuDeck/logs/rclone.log" --exclude=/.user "$cloud_sync_provider`:Emudeck\saves\$emuName\" "$target"
& $cloud_sync_bin copy --fast-list --update --tpslimit 12 --checkers=50 --exclude=/.fail_upload --exclude=/.fail_download --exclude=/system/prod.keys --exclude=/system/title.keys --exclude=/.pending_upload --exclude=/.watching --exclude=/*.lnk --exclude=/.cloud --exclude=/.emulator -q --log-file "$userFolder/EmuDeck/logs/rclone.log" --exclude=/.user "$cloud_sync_provider`:$cs_user`Emudeck\saves\$emuName\" "$target"
}

}
Expand Down Expand Up @@ -605,7 +605,7 @@ function cloud_sync_upload{

cloud_sync_save_hash($target)

& $cloud_sync_bin copy --fast-list --update --tpslimit 12 --checkers=50 --exclude=/.fail_upload --exclude=/.fail_download --exclude=/system/prod.keys --exclude=/system/title.keys --exclude=/.pending_upload --exclude=/.watching --exclude=/*.lnk --exclude=/.cloud --exclude=/.emulator --exclude=/.user -q --log-file "$userFolder/EmuDeck/logs/rclone.log" "$target" "$cloud_sync_provider`:Emudeck\saves\"
& $cloud_sync_bin copy --fast-list --update --tpslimit 12 --checkers=50 --exclude=/.fail_upload --exclude=/.fail_download --exclude=/system/prod.keys --exclude=/system/title.keys --exclude=/.pending_upload --exclude=/.watching --exclude=/*.lnk --exclude=/.cloud --exclude=/.emulator --exclude=/.user -q --log-file "$userFolder/EmuDeck/logs/rclone.log" "$target" "$cloud_sync_provider`:$cs_user`Emudeck\saves\"
if ($?) {
$baseFolder = "$target"
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Expand All @@ -626,7 +626,7 @@ function cloud_sync_upload{
$target = "$emulationPath\saves\$emuName"
cloud_sync_save_hash($target)

& $cloud_sync_bin copy -q --log-file "$userFolder/EmuDeck/logs/rclone.log" --fast-list --update --tpslimit 12 --checkers=50 --exclude=/.fail_upload --exclude=/.fail_download --exclude=/system/prod.keys --exclude=/system/title.keys --exclude=/.pending_upload --exclude=/.watching --exclude=/*.lnk --exclude=/.cloud --exclude=/.emulator --exclude=/.user --log-file "$userFolder/EmuDeck/logs/rclone.log" "$target" "$cloud_sync_provider`:Emudeck\saves\$emuName\"
& $cloud_sync_bin copy -q --log-file "$userFolder/EmuDeck/logs/rclone.log" --fast-list --update --tpslimit 12 --checkers=50 --exclude=/.fail_upload --exclude=/.fail_download --exclude=/system/prod.keys --exclude=/system/title.keys --exclude=/.pending_upload --exclude=/.watching --exclude=/*.lnk --exclude=/.cloud --exclude=/.emulator --exclude=/.user --log-file "$userFolder/EmuDeck/logs/rclone.log" "$target" "$cloud_sync_provider`:$cs_user`Emudeck\saves\$emuName\"
if ($?) {
Write-Host "upload success"
Write-Host $target
Expand Down
6 changes: 3 additions & 3 deletions functions/cloudSyncHealth.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function cloudSyncHealth(){
Start-Sleep -Seconds 1
}

$result = & $cloud_sync_bin lsf "$cloud_sync_provider`:Emudeck/saves/retroarch/" | Select-String "test_emudeck.txt"
$result = & $cloud_sync_bin lsf "$cloud_sync_provider`:$cs_user`Emudeck/saves/retroarch/" | Select-String "test_emudeck.txt"

# Evaluar el resultado
if ($result) {
Expand All @@ -57,7 +57,7 @@ function cloudSyncHealth(){
##Testing Dowmload
#

& "$cloud_sync_bin" --progress copyto -L --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 "$cloud_sync_provider`:Emudeck/saves/retroarch/test_emudeck.txt" "$savesPath/retroarch/test_emudeck.txt"
& "$cloud_sync_bin" --progress copyto -L --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 "$cloud_sync_provider`:$cs_user`Emudeck/saves/retroarch/test_emudeck.txt" "$savesPath/retroarch/test_emudeck.txt"

if (Test-Path "$savesPath\retroarch\test_emudeck.txt") {
Write-Host "file exists in local. SUCCESS"
Expand All @@ -71,7 +71,7 @@ function cloudSyncHealth(){
Remove-Item -Recurse -Force "$savesPath\retroarch\test_emudeck.txt"

# Eliminar el archivo remoto
& $cloud_sync_bin delete "$cloud_sync_provider`:Emudeck/saves/retroarch/test_emudeck.txt"
& $cloud_sync_bin delete "$cloud_sync_provider`:$cs_user`Emudeck/saves/retroarch/test_emudeck.txt"

# Verificar si se debe matar Retroarch o cerrar otra ventana
if ($kill -eq "RETROARCH") {
Expand Down
2 changes: 1 addition & 1 deletion functions/helperFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ function storePatreonToken($token){
mkdir "$savesPath" -ErrorAction SilentlyContinue
$token | Set-Content -Path "$savesPath/.token" -Encoding UTF8
if (Test-Path "$cloud_sync_bin") {
& $cloud_sync_bin --progress copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 "$savesPath/.token" "$cloud_sync_provider`:Emudeck\saves\.token"
& $cloud_sync_bin --progress copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 "$savesPath/.token" "$cloud_sync_provider`:$cs_user`Emudeck\saves\.token"
}else{
echo "NOPE"
}
Expand Down

0 comments on commit 46624f7

Please sign in to comment.