From 7e4094f56d05eecbb27e735edb52419da44058ee Mon Sep 17 00:00:00 2001 From: studiokaiji Date: Wed, 25 Oct 2023 20:13:43 +0900 Subject: [PATCH] =?UTF-8?q?=E7=94=BB=E5=83=8F=E3=81=AE=E3=82=A2=E3=83=83?= =?UTF-8?q?=E3=83=97=E3=83=AD=E3=83=BC=E3=83=89=E6=A9=9F=E8=83=BD=E3=82=92?= =?UTF-8?q?=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hostr/cmd/deploy/deploy.go | 83 ++++++++--------- hostr/cmd/deploy/media.go | 179 ++++++++++++++++++++++++++----------- hostr/cmd/deploy/nostr.go | 18 ++-- 3 files changed, 173 insertions(+), 107 deletions(-) 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" { //