Skip to content
ngld edited this page Nov 20, 2014 · 2 revisions

Every page loaded in Knossos' web browser has access to a global fs2mod object. This object has the following methods:

  • getVersion(): str

    Returns fs2mod-py's version

  • isFsoInstalled(): bool

    Returns true if fs2_open is installed and configured.

  • isFs2PathSet(): bool

    Returns true if the path to the FS2 directory is set.

  • selectFs2path(): void

    Prompts the user to select their FS2 directory.

  • runGogInstaller(): void

    Launches the GOGExtract wizard.

  • getMods(): list of mod objects

    Returns a list of all available mods (see the generated section of schema.txt).

  • getInstalledMods(): list of mod objects

    Returns a list of all installed mods (see the generated section of schema.txt).

  • getUpdates(): object

    Returns a map which follows this syntax: result[mid][local_version] = most_recent_version

  • isInstalled(mid, spec?): bool

    Returns true if the given mod is installed. The parameters are the same as query()'s.

  • query(mid, spec?): mod object

    Allows the web page to query the local mod cache. The first parameter is the mod ID. The second parameter is optional and can specify a version requirement. (i.e. ">=3.0.*")
    If no matching mod is found, null is returned.

  • fetchModlist(): void

    Update the local mod cache.

  • addRepo(name, link): void

    Adds a new repository.

  • getRepos(): list of [<name>, <link>]

    Returns a list of all configured repositories.

  • install(mid, spec?, pkgs?): int

    Installs the given mod. The first two parameters are the same as query()'s. The third parameter is optional and contains the names of all packages which should be installed (defaults to all required).
    Returns -1 if the mod wasn't found, -2 if some of the given packages are missing, 0 if the install failed and 1 on success.

  • uninstall(mid, pkgs?): bool

    Uninstalls the given mod. The first parameter is the mod's ID. The second parameter should be used if only some packages should be uninstalled.
    Returns true on success.

  • runMod(mid): void

    Launch fs2_open with the given mod selected.

  • abortDownload(mid): void

    Aborts the download for the given mod.

  • showSettings(mid?): void

    Open the settings window for the given mod or fs2_open if no mid is given.
    Returns -1 if the mod wasn't found, -2 if the spec is invalid and 1 on success.

  • showPackageList(mid, spec?): int

    Open a window which allows the user to install and uninstall packages for the given mod.
    Returns -1 if the mod wasn't found, -2 if the spec is invalid and 1 on success.

  • vercmp(a, b): int

    Compares two versions

All methods mentioned on this page are implemented in knossos/web.py

Clone this wiki locally