From 70f1fea4cffc9e8230aa9261bbaf1d6e129dfcc3 Mon Sep 17 00:00:00 2001 From: studiokaiji Date: Thu, 26 Oct 2023 21:25:34 +0900 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E6=9B=B8=E3=81=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E3=82=92=E3=83=AD=E3=83=BC=E3=83=AB=E3=83=90=E3=83=83=E3=82=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hostr/cmd/deploy/deploy.go | 19 +++++++++---------- hostr/main.go | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/hostr/cmd/deploy/deploy.go b/hostr/cmd/deploy/deploy.go index 1d05d86..d84beed 100644 --- a/hostr/cmd/deploy/deploy.go +++ b/hostr/cmd/deploy/deploy.go @@ -23,7 +23,7 @@ func isExternalURL(urlStr string) bool { return err == nil && u.Scheme != "" && u.Host != "" } -func Deploy(basePath string, replaceable bool, htmlIdentifier string) (string, string, error) { +func Deploy(basePath string, replaceable bool, htmlIdentifier string) (string, string, string, error) { // 引数からデプロイしたいサイトのパスを受け取る。 filePath := filepath.Join(basePath, "index.html") @@ -31,26 +31,26 @@ func Deploy(basePath string, replaceable bool, htmlIdentifier string) (string, s content, err := os.ReadFile(filePath) if err != nil { fmt.Println("❌ Failed to read index.html:", err) - return "", "", err + return "", "", "", err } // HTMLの解析 doc, err := html.Parse(bytes.NewReader(content)) if err != nil { fmt.Println("❌ Failed to parse index.html:", err) - return "", "", err + return "", "", "", err } // Eventの取得に必要になるキーペアを取得 priKey, err := keystore.GetSecret() if err != nil { fmt.Println("❌ Failed to get private key:", err) - return "", "", err + return "", "", "", err } pubKey, err := nostr.GetPublicKey(priKey) if err != nil { fmt.Println("❌ Failed to get public key:", err) - return "", "", err + return "", "", "", err } // htmlIdentifierの存在チェック @@ -70,15 +70,14 @@ 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 + return "", "", "", err } - // basePath以下のMedia Fileのパスを全て羅列しアップロード err = uploadAllValidStaticMediaFiles(priKey, pubKey, basePath) if err != nil { fmt.Println("❌ Failed to upload media:", err) - return "", "", err + return "", "", "", err } // リンクの解析と変換 @@ -106,14 +105,14 @@ func Deploy(basePath string, replaceable bool, htmlIdentifier string) (string, s event, err := getEvent(priKey, pubKey, strHtml, indexHtmlKind, tags) if err != nil { fmt.Println("❌ Failed to get public key:", err) - return "", "", err + return "", "", "", err } addNostrEventQueue(event) fmt.Println("Added", filePath, "event to publish queue") eventId, encoded := publishEventsFromQueue(replaceable) - return eventId, encoded, err + return eventId, encoded, htmlIdentifier, err } func convertLinks( diff --git a/hostr/main.go b/hostr/main.go index a55174e..4107dc3 100644 --- a/hostr/main.go +++ b/hostr/main.go @@ -49,7 +49,7 @@ func main() { replaceable := ctx.Bool("replaceable") dTag := ctx.String("identifier") - _, encoded, err := deploy.Deploy(path, replaceable, dTag) + _, encoded, dTag, err := deploy.Deploy(path, replaceable, dTag) if err == nil { fmt.Println("🌐 Deploy Complete!")