refactor(file-transfer): replace base64 encoding with direct file transfer method in various components for improved clarity and efficiency

This commit is contained in:
Andras Bacsai
2025-09-09 11:10:38 +02:00
parent fe2c4fd1c7
commit feacedbb04
8 changed files with 36 additions and 51 deletions

View File

@@ -309,10 +309,7 @@ class Server extends BaseModel
$conf = Yaml::dump($dynamic_conf, 12, 2);
}
$conf = $banner.$conf;
$base64 = base64_encode($conf);
instant_remote_process([
"echo '$base64' | base64 -d | tee $default_redirect_file > /dev/null",
], $this);
transfer_file_to_server($conf, $default_redirect_file, $this);
}
if ($proxy_type === 'CADDY') {
@@ -446,11 +443,10 @@ class Server extends BaseModel
"# Do not edit it manually (only if you know what are you doing).\n\n".
$yaml;
$base64 = base64_encode($yaml);
instant_remote_process([
"mkdir -p $dynamic_config_path",
"echo '$base64' | base64 -d | tee $file > /dev/null",
], $this);
transfer_file_to_server($yaml, $file, $this);
}
} elseif ($this->proxyType() === 'CADDY') {
$file = "$dynamic_config_path/coolify.caddy";
@@ -473,10 +469,7 @@ $schema://$host {
}
reverse_proxy coolify:8080
}";
$base64 = base64_encode($caddy_file);
instant_remote_process([
"echo '$base64' | base64 -d | tee $file > /dev/null",
], $this);
transfer_file_to_server($caddy_file, $file, $this);
$this->reloadCaddy();
}
}