[skip ci] Fix RClone /about path

This commit is contained in:
Yann Stepienik
2026-08-27 21:09:13 +01:00
parent 5b0dba6ec4
commit c9e5e6f911
4 changed files with 23 additions and 62 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ terraform.tfstate
terraform.tfstate.*
.terraform.lock.hcl
*.log
./main.tf
/main.tf
# Ruflo local secrets and runtime data
.env
+1 -1
View File
@@ -71,7 +71,7 @@ export default function createRcloneAPI(apiFetch: ApiFetch) {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"fs": remoteName + ":/",
"fs": remoteName,
})
}))
}
-56
View File
@@ -1,56 +0,0 @@
terraform {
required_providers {
cosmos = {
source = "cosmos-cloud.io/azukaar/cosmos"
version = "0.1.0"
}
}
}
provider "cosmos" {
base_url = "http://localhost:8080"
token = "cosmos_LUQDv-Wfhd_CaKnAEA6Z48zHFo_5wCpHJof84EbTxvM"
insecure = true
}
# resource "cosmos_route" "test" {
# name = "test-route"
# target = "http://localhost:1234"
# use_host = true
# host = "localhost:1235"
# mode = "PROXY"
# }
# resource "cosmos_api_token" "nginx_token" {
# name = "nginx-readonly"
# description = "Token for nginx container"
# read_only = true
# expiry_days = 30
# }
# resource "cosmos_docker_service" "nginx" {
# name = "nginx-test"
# image = "nginx:latest"
# service_json = jsonencode({
# ports = ["8888:80"]
# environment = ["COSMOS_TOKEN=${cosmos_api_token.nginx_token.token}"]
# })
# }
# Initialize Constellation VPN
resource "cosmos_constellation" "vpn" {
device_name = "server"
hostname = "10.255.255.254,192.168.1.102,169.254.83.107"
ip_range = "192.168.201.0/24"
is_lighthouse = true
}
# Device without nickname
resource "cosmos_constellation_device" "cosmos-2" {
device_name = "cosmos-2"
ip = "192.168.201.3"
is_lighthouse = true
public_hostname = "192.168.1.204"
cosmos_node = 1
depends_on = [cosmos_constellation.vpn]
}
+21 -4
View File
@@ -277,12 +277,29 @@ func API_RClone_OperationsAbout(w http.ResponseWriter, req *http.Request) {
}
ctx := context.Background()
fsPath := payload.Fs
if !strings.HasSuffix(fsPath, ":") && !strings.Contains(fsPath, ":/") {
fsPath = fsPath + ":"
ensureRCloneConfig()
// payload.Fs must be a bare, admin-configured remote name because command can be injected otherwise
name := strings.TrimSuffix(strings.TrimSuffix(payload.Fs, "/"), ":")
if name == "" || strings.ContainsAny(name, ":,/") {
utils.HTTPError(w, "Invalid remote name", http.StatusBadRequest, "RCL006")
return
}
f, err := fs.NewFs(ctx, fsPath)
allowed := false
for _, n := range config.GetRemoteNames() {
if n == name {
allowed = true
break
}
}
if !allowed {
utils.HTTPError(w, "Unknown remote", http.StatusBadRequest, "RCL006")
return
}
f, err := fs.NewFs(ctx, name+":")
if err != nil {
utils.HTTPError(w, "Failed to access remote: "+err.Error(), http.StatusInternalServerError, "RCL007")
return