Browse Source

Fixed bug preventing ACL from being able to upload to other servers.

wildcard
Ruel Tmeizeh - RuhNet 6 months ago
parent
commit
94442a72ef
3 changed files with 9 additions and 5 deletions
  1. +7
    -3
      actions.go
  2. +1
    -1
      leapi_config.json.sample
  3. +1
    -1
      main.go

+ 7
- 3
actions.go View File

@ -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
}


+ 1
- 1
leapi_config.json.sample View File

@ -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",


+ 1
- 1
main.go View File

@ -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"


Loading…
Cancel
Save