Setting up the model resolution design.
This commit is contained in:
25
src/model/spec/artifact.ts
Normal file
25
src/model/spec/artifact.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
export interface Artifact {
|
||||
|
||||
/**
|
||||
* The size of the artifact.
|
||||
*/
|
||||
size: number
|
||||
|
||||
/**
|
||||
* The MD5 hash of the artifact. This will be used to validate local artifacts.
|
||||
*/
|
||||
MD5: string
|
||||
|
||||
/**
|
||||
* The artifact's download url.
|
||||
*/
|
||||
url: string
|
||||
|
||||
/**
|
||||
* A relative path to where the file will be saved. This is appended to the base
|
||||
* path for the module's declared type.
|
||||
* If this is not specified, the path will be resolved based on the module's ID.
|
||||
*/
|
||||
path?: string
|
||||
|
||||
}
|
||||
35
src/model/spec/distribution.ts
Normal file
35
src/model/spec/distribution.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { Server } from './server'
|
||||
|
||||
export interface Distribution {
|
||||
|
||||
version: string
|
||||
|
||||
/**
|
||||
* Global settings for Discord Rich Presence.
|
||||
*/
|
||||
discord?: {
|
||||
/**
|
||||
* Client ID for the Application registered with Discord.
|
||||
*/
|
||||
clientId: string,
|
||||
/**
|
||||
* Tootltip for the smallImageKey.
|
||||
*/
|
||||
smallImageText: string,
|
||||
/**
|
||||
* Name of the uploaded image for the small profile artwork.
|
||||
*/
|
||||
smallImageKey: string
|
||||
}
|
||||
|
||||
/**
|
||||
* A URL to a RSS feed. Used for loading news.
|
||||
*/
|
||||
rss: string
|
||||
|
||||
/**
|
||||
* Array of server objects.
|
||||
*/
|
||||
servers: Server[]
|
||||
|
||||
}
|
||||
51
src/model/spec/module.ts
Normal file
51
src/model/spec/module.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { Artifact } from './artifact'
|
||||
import { Required } from './required'
|
||||
import { Type } from './type'
|
||||
|
||||
export interface Module {
|
||||
|
||||
/**
|
||||
* The ID of the module. All modules that are not of type File MUST use a maven identifier.
|
||||
* Version information and other metadata is pulled from the identifier. Modules which are
|
||||
* stored maven style use the identifier to resolve the destination path. If the extension
|
||||
* is not provided, it defaults to jar.
|
||||
*
|
||||
* Template
|
||||
*
|
||||
* my.group:arifact:version@extension
|
||||
*
|
||||
* my/group/artifact/version/artifact-version.extension
|
||||
*
|
||||
* If the module's artifact does not declare the path property, its path will be resolved from the ID.
|
||||
*/
|
||||
id: string
|
||||
|
||||
/**
|
||||
* The name of the module. Used on the UI.
|
||||
*/
|
||||
name: string
|
||||
|
||||
/**
|
||||
* The type of the module.
|
||||
*/
|
||||
type: Type
|
||||
|
||||
/**
|
||||
* Defines whether or not the module is required. If omitted, then the module will be required.
|
||||
*/
|
||||
required?: Required
|
||||
|
||||
/**
|
||||
* The download artifact for the module.
|
||||
*/
|
||||
artifact: Artifact
|
||||
|
||||
/**
|
||||
* An array of sub modules declared by this module. Typically, files which require other files
|
||||
* are declared as submodules. A quick example would be a mod, and the configuration file for
|
||||
* that mod. Submodules can also declare submodules of their own. The file is parsed recursively,
|
||||
* so there is no limit.
|
||||
*/
|
||||
subModules?: Module[]
|
||||
|
||||
}
|
||||
14
src/model/spec/required.ts
Normal file
14
src/model/spec/required.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export interface Required {
|
||||
|
||||
/**
|
||||
* If the module is required. Defaults to true if this property is omited.
|
||||
*/
|
||||
value?: boolean
|
||||
|
||||
/**
|
||||
* If the module is enabled by default. Has no effect unless Required.value
|
||||
* is false. Defaults to true if this property is omited.
|
||||
*/
|
||||
def?: boolean
|
||||
|
||||
}
|
||||
81
src/model/spec/server.ts
Normal file
81
src/model/spec/server.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import { Module } from './module'
|
||||
|
||||
export interface Server {
|
||||
|
||||
/**
|
||||
* The ID of the server. The launcher saves mod configurations and selected servers
|
||||
* by ID. If the ID changes, all data related to the old ID will be wiped.
|
||||
*/
|
||||
id: string
|
||||
|
||||
/**
|
||||
* The name of the server. This is what users see on the UI.
|
||||
*/
|
||||
name: string
|
||||
|
||||
/**
|
||||
* A brief description of the server. Displayed on the UI to provide users more information.
|
||||
*/
|
||||
description: string
|
||||
|
||||
/**
|
||||
* A URL to the server's icon. Will be displayed on the UI.
|
||||
*/
|
||||
icon: string
|
||||
|
||||
/**
|
||||
* The version of the server configuration.
|
||||
*/
|
||||
version: string
|
||||
|
||||
/**
|
||||
* The server's IP address.
|
||||
*/
|
||||
address: string
|
||||
|
||||
/**
|
||||
* The version of minecraft that the server is running.
|
||||
*/
|
||||
minecraftVersion: string
|
||||
|
||||
/**
|
||||
* Server specific settings used for Discord Rich Presence.
|
||||
*/
|
||||
discord?: {
|
||||
/**
|
||||
* Short ID for the server. Displayed on the second status line as Server: shortId.
|
||||
*/
|
||||
shortId: string,
|
||||
/**
|
||||
* Ttooltip for the largeImageKey.
|
||||
*/
|
||||
largeImageText: string
|
||||
/**
|
||||
* Name of the uploaded image for the large profile artwork.
|
||||
*/
|
||||
largeImageKey: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Only one server in the array should have the mainServer property enabled. This
|
||||
* will tell the launcher that this is the default server to select if either the
|
||||
* previously selected server is invalid, or there is no previously selected server.
|
||||
* If this field is not defined by any server (avoid this), the first server will
|
||||
* be selected as the default. If multiple servers have mainServer enabled, the first
|
||||
* one the launcher finds will be the effective value. Servers which are not the default
|
||||
* may omit this property rather than explicitly setting it to false.
|
||||
*/
|
||||
mainServer?: boolean
|
||||
|
||||
/**
|
||||
* Whether or not the server can be autoconnected to. If false, the server will
|
||||
* not be autoconnected to even when the user has the autoconnect setting enabled.
|
||||
*/
|
||||
autoconnect: boolean
|
||||
|
||||
/**
|
||||
* An array of module objects.
|
||||
*/
|
||||
modules: Module[]
|
||||
|
||||
}
|
||||
45
src/model/spec/type.ts
Normal file
45
src/model/spec/type.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
export const Types: {[property: string]: Type} = {
|
||||
|
||||
Library: {
|
||||
id: 'Library',
|
||||
defaultExtension: 'jar'
|
||||
},
|
||||
/**
|
||||
* @deprecated Will be replaced by Types.Forge.
|
||||
*/
|
||||
ForgeHosted: {
|
||||
id: 'ForgeHosted',
|
||||
defaultExtension: 'jar'
|
||||
},
|
||||
Forge: {
|
||||
id: 'Forge',
|
||||
defaultExtension: 'jar'
|
||||
},
|
||||
LiteLoader: {
|
||||
id: 'LiteLoader',
|
||||
defaultExtension: 'jar'
|
||||
},
|
||||
ForgeMod: {
|
||||
id: 'ForgeMod',
|
||||
defaultExtension: 'jar'
|
||||
},
|
||||
LiteMod: {
|
||||
id: 'LiteMod',
|
||||
defaultExtension: 'litemod'
|
||||
},
|
||||
File: {
|
||||
id: 'File'
|
||||
},
|
||||
VersionManifest: {
|
||||
id: 'VersionManifest',
|
||||
defaultExtension: 'json'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface Type {
|
||||
|
||||
id: string
|
||||
defaultExtension?: string
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user