feat: add support for more url aliases

This commit is contained in:
Tricked 2022-06-15 16:15:31 +02:00 committed by unilock
parent 8c97b3e73b
commit cb9550f4a6
2 changed files with 9 additions and 10 deletions

View File

@ -29,6 +29,7 @@ var installCmd = &cobra.Command{
Args: cobra.ArbitraryArgs,
Run: func(cmd *cobra.Command, args []string) {
pack, err := core.LoadPack()
if err != nil {
fmt.Println(err)
os.Exit(1)
@ -45,6 +46,14 @@ var installCmd = &cobra.Command{
slug := strings.Replace(args[0], "https://github.com/", "", 1)
if len(strings.Split(args[0], "/")) == 1 {
slug = args[0]
}
if strings.Contains(slug, "/releases") {
slug = strings.Split(slug, "/releases")[0]
}
mod, err := fetchMod(slug)
installMod(mod, pack)
@ -198,11 +207,6 @@ func installVersion(mod Mod, version ModReleases, pack core.Pack) error {
return err
}
// side := mod.getSide()
// if side == "" {
// return errors.New("version doesn't have a side that's supported. Server: " + mod.ServerSide + " Client: " + mod.ClientSide)
// }
hash, error := file.getSha256()
if error != nil || hash == "" {
return errors.New("file doesn't have a hash")

View File

@ -45,11 +45,6 @@ func (u ghUpdater) CheckUpdate(mods []core.Mod, mcVersion string, pack core.Pack
continue
}
// if newVersion.ID == "" { //There is no version available for this minecraft version or loader.
// results[i] = core.UpdateCheck{UpdateAvailable: false}
// continue
// }
if newVersion.TagName == data.InstalledVersion { //The latest version from the site is the same as the installed one
results[i] = core.UpdateCheck{UpdateAvailable: false}
continue