Compare commits
No commits in common. "d0384b177809b60ce1dc05c504402d4a173385b9" and "6179e669dfd998a023ca948f272aa7ae20a40495" have entirely different histories.
d0384b1778
...
6179e669df
@ -1,57 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Fabric struct {
|
||||
|
||||
}
|
||||
|
||||
|
||||
type FabricDefinition struct {
|
||||
Separator string
|
||||
Build int
|
||||
Maven string
|
||||
Version string
|
||||
Stable bool
|
||||
}
|
||||
|
||||
type FabricLibrary struct {
|
||||
Name string
|
||||
Url string
|
||||
}
|
||||
|
||||
type FabricLibraries struct {
|
||||
Client []FabricLibrary
|
||||
Common []FabricLibrary
|
||||
Server []FabricLibrary
|
||||
}
|
||||
|
||||
type FabricMeta struct {
|
||||
Version int
|
||||
Libraries FabricLibraries
|
||||
MainClass map[string]string
|
||||
}
|
||||
|
||||
type FabricVersion struct {
|
||||
Loader FabricDefinition
|
||||
Intermediary FabricDefinition
|
||||
LauncherMeta FabricMeta
|
||||
}
|
||||
|
||||
func (Fabric)GetFabricVersions(mcVersion string) ([]FabricVersion, error) {
|
||||
resp, err := http.Get("https://meta.fabricmc.net/v2/versions/loader/"+mcVersion)
|
||||
if err != nil {
|
||||
return []FabricVersion{}, fmt.Errorf("Unable to pull fabric version manifest: %s\n", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
data, _ := io.ReadAll(resp.Body)
|
||||
versions := []FabricVersion{}
|
||||
json.Unmarshal(data, &versions)
|
||||
fmt.Printf("fabric versions found for %s: %+v\n", mcVersion, versions)
|
||||
return versions, nil
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
import {GetModpacks, GetModpack} from '../wailsjs/go/main/ModpackManager.js'
|
||||
import {InstallVanilla, LaunchInstance, GetInstances, CheckUpdate} from '../wailsjs/go/main/InstanceManager.js'
|
||||
import {GetVersions} from '../wailsjs/go/main/App.js'
|
||||
import {GetFabricVersions} from '../wailsjs/go/main/Fabric.js'
|
||||
import {onMount} from 'svelte'
|
||||
import {loading} from './global.ts'
|
||||
import {slide} from 'svelte/transition'
|
||||
@ -13,16 +12,12 @@
|
||||
let instance: string
|
||||
let addingInstance: boolean = false
|
||||
let name: string = "New Modpack"
|
||||
let loader: string = "none"
|
||||
let fabric_ver: string = ""
|
||||
let fab_versions: string[] = []
|
||||
|
||||
function updateLists(){
|
||||
GetVersions().then((result) => {
|
||||
modpacks = result
|
||||
pack = modpacks[0]
|
||||
name = modpacks[0]
|
||||
updateLoaders()
|
||||
})
|
||||
GetInstances().then((result) => {
|
||||
instances = result
|
||||
@ -30,15 +25,6 @@
|
||||
})
|
||||
}
|
||||
|
||||
function updateLoaders(){
|
||||
GetFabricVersions(pack).then((result) => {
|
||||
result.forEach((ver) => {
|
||||
fab_versions.push(ver.Loader.Version)
|
||||
})
|
||||
fabric_ver = fab_versions[0]
|
||||
})
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
updateLists()
|
||||
})
|
||||
@ -61,8 +47,6 @@
|
||||
|
||||
function onchange(event){
|
||||
name = event.target.value
|
||||
pack = event.target.value
|
||||
updateLoaders()
|
||||
}
|
||||
|
||||
|
||||
@ -83,25 +67,8 @@
|
||||
<option value={pack}>{pack}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<input type="radio" bind:group={loader} checked id="noLoader" name="Loader" value="none" />
|
||||
<label for="noLoader">None</label>
|
||||
<input type="radio" bind:group={loader} id="fabric" name="Loader" value="fabric" />
|
||||
<label for="fabric">Fabric</label>
|
||||
<input type="radio" bind:group={loader} id="forge" name="Loader" value="forge" />
|
||||
<label for="forge">Forge</label>
|
||||
<input type="radio" bind:group={loader} id="neoforge" name="Loader" value="neoforge" />
|
||||
<label for="neoforge">NeoForge</label>
|
||||
<input type="radio" bind:group={loader} id="quilt" name="Loader" value="quilt" />
|
||||
<label for="quilt">Quilt</label>
|
||||
<br/>
|
||||
<input bind:value={name} />
|
||||
{#if loader == "fabric"}
|
||||
<select id="fabric_ver" bind:value={fabric_ver} name="fabric_ver">Select Fabric Version:
|
||||
{#each fab_versions as ver}
|
||||
<option value={ver}>{ver}</option>
|
||||
{/each}
|
||||
</select>
|
||||
{/if}
|
||||
<br/>
|
||||
<button on:click={install}>Install</button>
|
||||
<button on:click={() => {addingInstance = false}}>Cancel</button>
|
||||
|
@ -1,5 +0,0 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
import {main} from '../models';
|
||||
|
||||
export function GetFabricVersions(arg1:string):Promise<Array<main.FabricVersion>>;
|
@ -1,7 +0,0 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export function GetFabricVersions(arg1) {
|
||||
return window['go']['main']['Fabric']['GetFabricVersions'](arg1);
|
||||
}
|
@ -1,142 +1,5 @@
|
||||
export namespace main {
|
||||
|
||||
export class FabricDefinition {
|
||||
Separator: string;
|
||||
Build: number;
|
||||
Maven: string;
|
||||
Version: string;
|
||||
Stable: boolean;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new FabricDefinition(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.Separator = source["Separator"];
|
||||
this.Build = source["Build"];
|
||||
this.Maven = source["Maven"];
|
||||
this.Version = source["Version"];
|
||||
this.Stable = source["Stable"];
|
||||
}
|
||||
}
|
||||
export class FabricLibrary {
|
||||
Name: string;
|
||||
Url: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new FabricLibrary(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.Name = source["Name"];
|
||||
this.Url = source["Url"];
|
||||
}
|
||||
}
|
||||
export class FabricLibraries {
|
||||
Client: FabricLibrary[];
|
||||
Common: FabricLibrary[];
|
||||
Server: FabricLibrary[];
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new FabricLibraries(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.Client = this.convertValues(source["Client"], FabricLibrary);
|
||||
this.Common = this.convertValues(source["Common"], FabricLibrary);
|
||||
this.Server = this.convertValues(source["Server"], FabricLibrary);
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
export class FabricMeta {
|
||||
Version: number;
|
||||
Libraries: FabricLibraries;
|
||||
MainClass: {[key: string]: string};
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new FabricMeta(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.Version = source["Version"];
|
||||
this.Libraries = this.convertValues(source["Libraries"], FabricLibraries);
|
||||
this.MainClass = source["MainClass"];
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class FabricVersion {
|
||||
Loader: FabricDefinition;
|
||||
Intermediary: FabricDefinition;
|
||||
LauncherMeta: FabricMeta;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new FabricVersion(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.Loader = this.convertValues(source["Loader"], FabricDefinition);
|
||||
this.Intermediary = this.convertValues(source["Intermediary"], FabricDefinition);
|
||||
this.LauncherMeta = this.convertValues(source["LauncherMeta"], FabricMeta);
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class Instance {
|
||||
InstanceName: string;
|
||||
ModpackId: string;
|
||||
|
@ -31,7 +31,6 @@ func main() {
|
||||
&app.PrismLauncher,
|
||||
&app.Java,
|
||||
&app.Modpacks,
|
||||
&Fabric{},
|
||||
},
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user