x-minecraft-launcher icon indicating copy to clipboard operation
x-minecraft-launcher copied to clipboard

Instance Auto Update

Open ci010 opened this issue 2 years ago • 1 comments

Support pulls instance configs/mods, other files from server.

Client Design Thought

Client can fetch a manifest file from url, to get such info

  • files, each file contains hash, path, and download url
  • versions, like minecraft, forge, or fabric

/**
 * The addon representing the runtime for the modpack, like forge
 */
export interface GameAddon {
  id: string
  version: string
}

/**
 * Represent a file from curseforge
 */
export interface InstanceFileCurseforge {
  type: 'curse'
  projectID: number
  fileID: number
  path?: string
  hash?: string
}

/**
 * Represent a file from fileApi
 */
export interface InstanceFileUrl {
  type: 'addon'
  path: string
  hash: string
  url: string
}

export interface InstanceFileModrinth {
  type: 'modrinth'
  projectId: string
  versionId: string
  path?: string
  hash?: string
}

/**
 * The minimum info required to update instance
 */
export interface InstanceManifest {
  /**
   * The addon/runtime of the modpack
   */
  addons: GameAddon[]

  files: Array<InstanceFileCurseforge | InstanceFileUrl | InstanceFileModrinth>

  /**
   * The suggested launcher info
   */
  launchInfo?: {
    minMemory?: number
    supportJava?: number[]
    launchArgument?: string[]
    javaArgument?: string[]
  }
}

Server Design Thought

Server should support such REST API:

  • upload file by batch (will generate the manifest background)
  • response fetch manifest request

Server can use Microsoft identity to user, so we don't need another user auth system.

Work Items

  • [x] POC of pulling manifest & download files from server
  • [ ] Simple Nodejs server to publish manifest & files together
  • [ ] Support download files from CDN (server hoster need to upload file to cdn by themselves)

ci010 avatar Apr 09 '22 12:04 ci010

is this feature similar to HMCL's auto-updated modpack?

SeasonPhan avatar Jun 14 '22 03:06 SeasonPhan