From 94442a72effbb15e03f5201c334ff79c1baf7abf Mon Sep 17 00:00:00 2001 From: Ruel Tmeizeh - RuhNet Date: Tue, 10 Jun 2025 12:38:48 -0400 Subject: [PATCH] Fixed bug preventing ACL from being able to upload to other servers. --- actions.go | 10 +++++++--- leapi_config.json.sample | 2 +- main.go | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/actions.go b/actions.go index 1aefcbb..7c65ccb 100644 --- a/actions.go +++ b/actions.go @@ -96,13 +96,17 @@ func sendFileToServer(filePath, server, cert_idx string) error { log.Println("Send file " + filePath + " to " + server + " starting...") _, fileName := path.Split(filePath) - fileType := strings.SplitN(fileName, "__", 2)[0] //cert__abcdef1234567890.tmpfile --> "cert" + fileTypeOrACL := strings.SplitN(fileName, "__", 2)[0] //cert__abcdef1234567890.tmpfile --> "cert" data, err := os.Open(filePath) if err != nil { return errors.New("sendFileToServer: Could not open temporary file " + filePath + ": " + err.Error()) } + //url := syncScheme + server + ":" + syncPort + "/api/file/upload/" + fileType + "/" + fmt.Sprintf("%02d", cert_idx) - url := syncScheme + server + ":" + syncPort + "/api/file/upload/" + fileType + "/" + cert_idx + url := syncScheme + server + ":" + syncPort + "/api/file/upload/" + fileTypeOrACL + "/" + cert_idx + if len(cert_idx) == 0 { // file is missing cert index number string, so is an ACL file + url = syncScheme + server + ":" + syncPort + "/api/file/upload/" + fileTypeOrACL + } log.Println("Send file '" + filePath + "' to " + url + "...") req, err := http.NewRequest("PUT", url, data) @@ -134,7 +138,7 @@ func sendFileToServer(filePath, server, cert_idx string) error { log.Println(errorString) return errors.New(errorString) } - log.Println("Upload [" + fileType + "] to " + server + " success!") + log.Println("Upload [" + fileTypeOrACL + "] to " + server + " success!") return nil } diff --git a/leapi_config.json.sample b/leapi_config.json.sample index b47d79b..a756840 100644 --- a/leapi_config.json.sample +++ b/leapi_config.json.sample @@ -11,7 +11,7 @@ "debug":false, "frontend_url":"admin.mydomain.net", //the frontend URL, if any (for CORS). Use "-" if none. "http_server_port":"-", //set to 80 if you are not using a separate web server or proxy. "-" will assume port 80. - "https_server_enable":false, //set to false to disable HTTPS listener (for initial setup, or for using a separate web server/proxy) + "https_server_enable":true, //set to false to disable HTTPS listener (for initial setup, or for using a separate web server/proxy) "https_server_port":"-", //the port your HTTPS server is running on, whether LEAPI or an external web server/proxy. Set to "-" for default (port 443) "tls_cert_path_prefix":"/etc/ssl/leapi/cert", //file paths DO NOT INCLUDE EXTENSION. "/etc/ssl/cert" will write files "/etc/ssl/cert01.crt", "/etc/ssl/cert02.crt", etc. "tls_key_path_prefix":"/etc/ssl/leapi/privkey", diff --git a/main.go b/main.go index f65d800..58eef5d 100644 --- a/main.go +++ b/main.go @@ -23,7 +23,7 @@ import ( ) const appname string = "leapi" -const version string = "1.3.2" +const version string = "1.3.3" const serverVersion string = "RuhNet LE API v" + version const apiVersion int = 1 const website string = "https://ruhnet.co"