diff --git a/hostr/cmd/deploy/deploy.go b/hostr/cmd/deploy/deploy.go index b7279bd..1d05d86 100644 --- a/hostr/cmd/deploy/deploy.go +++ b/hostr/cmd/deploy/deploy.go @@ -3,9 +3,7 @@ package deploy import ( "bufio" "bytes" - "encoding/json" "fmt" - "net/http" "net/url" "os" "path/filepath" @@ -71,19 +69,21 @@ func Deploy(basePath string, replaceable bool, htmlIdentifier string) (string, s // リレーを取得 allRelays, err = relays.GetAllRelays() if err != nil { + fmt.Println("❌ Failed to get all relays:", err) + return "", "", err + } + + + // basePath以下のMedia Fileのパスを全て羅列しアップロード + err = uploadAllValidStaticMediaFiles(priKey, pubKey, basePath) + if err != nil { + fmt.Println("❌ Failed to upload media:", err) return "", "", err } // リンクの解析と変換 convertLinks(priKey, pubKey, basePath, replaceable, htmlIdentifier, doc) - if len(mediaUploadRequestQueue) > 0 { - // メディアのアップロード - fmt.Println("📷 Uploading media files") - uploadMediaFilesFromQueue() - fmt.Println("📷 Media upload finished.") - } - // 更新されたHTML var buf bytes.Buffer html.Render(&buf, doc) @@ -116,7 +116,12 @@ func Deploy(basePath string, replaceable bool, htmlIdentifier string) (string, s return eventId, encoded, err } -func convertLinks(priKey, pubKey, basePath string, replaceable bool, indexHtmlIdentifier string, n *html.Node) { +func convertLinks( + priKey, pubKey, basePath string, + replaceable bool, + indexHtmlIdentifier string, + n *html.Node, +) { if n.Type == html.ElementNode { if n.Data == "link" || n.Data == "script" { //