Add uguu.se artwork upload for private Navidrome instances #4

Merged
deluan merged 5 commits from coverart-fallback into main 2026-02-07 12:27:32 -07:00
2 changed files with 3 additions and 2 deletions
Showing only changes of commit a6386d0fc9 - Show all commits
+2 -1
View File
2
@@ -4,6 +4,7 @@ import (
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"fmt" "fmt"
"net/url"
"strings" "strings"
"github.com/navidrome/navidrome/plugins/pdk/go/host" "github.com/navidrome/navidrome/plugins/pdk/go/host"
1
@@ -115,7 +116,7 @@ func getImageViaUguu(username, trackID string) string {
// uploadToImgbb uploads image data to imgbb and returns the display URL. // uploadToImgbb uploads image data to imgbb and returns the display URL.
func uploadToImgbb(apiKey string, imageData []byte) (string, error) { func uploadToImgbb(apiKey string, imageData []byte) (string, error) {
encoded := base64.StdEncoding.EncodeToString(imageData) encoded := base64.StdEncoding.EncodeToString(imageData)
body := fmt.Sprintf("key=%s&image=%s&expiration=86400", apiKey, encoded) body := fmt.Sprintf("key=%s&image=%s&expiration=86400", url.QueryEscape(apiKey), url.QueryEscape(encoded))
req := pdk.NewHTTPRequest(pdk.MethodPost, "https://api.imgbb.com/1/upload") req := pdk.NewHTTPRequest(pdk.MethodPost, "https://api.imgbb.com/1/upload")
req.SetHeader("Content-Type", "application/x-www-form-urlencoded") req.SetHeader("Content-Type", "application/x-www-form-urlencoded")
+1 -1
View File
1
@@ -46,7 +46,7 @@
"type": "string", "type": "string",
"title": "Image Hosting Service", "title": "Image Hosting Service",
"description": "Upload artwork to a public image host so Discord can display it. Required when Navidrome is not publicly accessible.", "description": "Upload artwork to a public image host so Discord can display it. Required when Navidrome is not publicly accessible.",
"enum": ["imgbb", "uguu"] "enum": ["", "imgbb", "uguu"]
}, },
"imgbbapikey": { "imgbbapikey": {
"type": "string", "type": "string",