33import cc .hyperium .installer .api .entities .InstallerManifest ;
44import cc .hyperium .installer .utils .JsonHolder ;
55import com .google .gson .Gson ;
6+ import com .google .gson .JsonArray ;
7+ import com .google .gson .JsonElement ;
68import org .apache .commons .io .IOUtils ;
79import org .apache .http .client .HttpClient ;
810import org .apache .http .client .methods .HttpGet ;
1517import java .net .URL ;
1618import java .net .URLClassLoader ;
1719import java .security .MessageDigest ;
20+ import java .util .Iterator ;
1821import java .util .Locale ;
1922
2023/*
@@ -55,10 +58,6 @@ else if (OS.contains("nux"))
5558 return os ;
5659 }
5760
58- public enum OSType {
59- Windows , MacOS , Linux , Other
60- }
61-
6261 public static JsonHolder get (String url ) {
6362 try {
6463 return new JsonHolder (getRaw (url ));
@@ -77,8 +76,18 @@ public static InstallerManifest getManifest() {
7776 Gson gson = new Gson ();
7877
7978 try {
80- InstallerManifest im = gson .fromJson (get ("https://api.hyperium.cc/versions" ).getObject (), InstallerManifest .class );
81- manifest = new InstallerManifest (im .getLatest (), im .getVersions (), gson .fromJson (InstallerUtils .getRaw ("https://raw.githubusercontent.com/HyperiumClient/Hyperium-Repo/master/installer/addons.json" ), InstallerManifest .class ).getAddons ());
79+ JsonHolder jsonHolder = get ("https://api.hyperium.cc/versions" );
80+ JsonArray versions = jsonHolder .optJSONArray ("versions" );
81+ Iterator <JsonElement > iterator = versions .iterator ();
82+ while (iterator .hasNext ()) {
83+ JsonHolder jsonHolder1 = new JsonHolder (iterator .next ().getAsJsonObject ());
84+ if (jsonHolder1 .optBoolean ("beta" )) {
85+ iterator .remove ();
86+ }
87+ }
88+ InstallerManifest im = gson .fromJson (jsonHolder .getObject (), InstallerManifest .class );
89+
90+ manifest = new InstallerManifest (im .getLatest (), im .getLatest_beta (), im .getVersions (), gson .fromJson (InstallerUtils .getRaw ("https://raw.githubusercontent.com/HyperiumClient/Hyperium-Repo/master/installer/addons.json" ), InstallerManifest .class ).getAddons ());
8291 } catch (Exception e ) {
8392 e .printStackTrace ();
8493 }
@@ -116,4 +125,8 @@ public static Class<?> loadClass(URL url, String c) throws ClassNotFoundExceptio
116125 return new URLClassLoader (new URL []{url }).loadClass (c );
117126 }
118127
128+ public enum OSType {
129+ Windows , MacOS , Linux , Other
130+ }
131+
119132}
0 commit comments