Improve modlist.html generation performance by using the ID redirect URL

This commit is contained in:
comp500 2021-04-19 16:46:19 +01:00
parent f1009a3289
commit 6557719c1f

View File

@ -9,6 +9,7 @@ import (
"github.com/spf13/viper"
"os"
"path/filepath"
"strconv"
"github.com/comp500/packwiz/core"
"github.com/spf13/cobra"
@ -308,16 +309,7 @@ func createModlist(zw *zip.Writer, mods []core.Mod) error {
continue
}
project := projectRaw.(cfUpdateData)
// TODO: store this in the metadata
modInfo, err := getModInfo(project.ProjectID)
if err != nil {
_, err = w.WriteString("<li>" + mod.Name + "</li>\r\n")
if err != nil {
return err
}
continue
}
_, err = w.WriteString("<li><a href=\"" + modInfo.WebsiteURL + "\">" + mod.Name + "</a></li>\r\n")
_, err = w.WriteString("<li><a href=\"https://www.curseforge.com/projects/" + strconv.Itoa(project.ProjectID) + "\">" + mod.Name + "</a></li>\r\n")
if err != nil {
return err
}