From bd9f5dbebcb4decea404e736952a0f096e2ba13f Mon Sep 17 00:00:00 2001 From: comp500 Date: Sun, 14 Mar 2021 16:21:58 +0000 Subject: [PATCH] Fix mod URLs in modlist.html export --- curseforge/export.go | 16 +++++++++++----- curseforge/request.go | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/curseforge/export.go b/curseforge/export.go index 7eca332..d25241c 100644 --- a/curseforge/export.go +++ b/curseforge/export.go @@ -5,12 +5,10 @@ import ( "bufio" "encoding/json" "fmt" + "github.com/comp500/packwiz/curseforge/packinterop" "github.com/spf13/viper" "os" "path/filepath" - "strconv" - - "github.com/comp500/packwiz/curseforge/packinterop" "github.com/comp500/packwiz/core" "github.com/spf13/cobra" @@ -310,8 +308,16 @@ func createModlist(zw *zip.Writer, mods []core.Mod) error { continue } project := projectRaw.(cfUpdateData) - projIDString := strconv.Itoa(project.ProjectID) - _, err = w.WriteString("
  • " + mod.Name + "
  • \r\n") + // TODO: store this in the metadata + modInfo, err := getModInfo(project.ProjectID) + if err != nil { + _, err = w.WriteString("
  • " + mod.Name + "
  • \r\n") + if err != nil { + return err + } + continue + } + _, err = w.WriteString("
  • " + mod.Name + "
  • \r\n") if err != nil { return err } diff --git a/curseforge/request.go b/curseforge/request.go index 030a40e..288c9a1 100644 --- a/curseforge/request.go +++ b/curseforge/request.go @@ -118,6 +118,7 @@ const ( type modInfo struct { Name string `json:"name"` Slug string `json:"slug"` + WebsiteURL string `json:"websiteUrl"` ID int `json:"id"` LatestFiles []modFileInfo `json:"latestFiles"` GameVersionLatestFiles []struct {