Git Product home page Git Product logo

magma's Introduction

Magma

Magma is a CLI tool for Arma 3 server mod managment that works both on Windows and Linux.

oclif Version Codecov Downloads/week License

Features

  • Downloads mods from Steam Workshop, moves to directories, installs keys, updates config files
  • Windows and Linux server support
  • Server mod support (-serverMod=...)
  • Client-side mod support (only installs keys)
  • Fully supports non-interactive shells
  • Support for a cron job (or task scheduler on Windows) that checks for mod updates and if found notifies Discord
  • Ability to update and remove mods
  • Supports mod activation and deactivation (doesn't remove them from disk)
  • Supports Steam Guard
  • Local mod support

Requirements

  • Node >= v10

Windows

npm install --global --production windows-build-tools

The following is also required:

  • Windows SDK - only the "Desktop C++ Apps" components are needed to be installed

Linux

To build Magma on Linux, make, python and build-essential is required.

sudo apt install -y make python build-essential

Usage

$ npm install -g @creeppork/magma
$ magma COMMAND
running command...
$ magma (-v|--version|version)
@creeppork/magma/3.0.0-beta.9 linux-x64 node-v16.13.0
$ magma --help [COMMAND]
USAGE
  $ magma COMMAND
...

Commands

magma activate [ID]

Activates mods by adding their symlinks and keys back.

USAGE
  $ magma activate [ID]

ARGUMENTS
  ID  Steam Workshop item IDs.

OPTIONS
  -n, --nonInteractive  Do not prompt for any input.

EXAMPLES
  magma activate
  magma activate 723217262
  magma activate 450814997 723217262 713709341

See code: src/commands/activate.ts

magma add IDS

Adds Steam Workshop items to the configuration files (does not download them).

USAGE
  $ magma add IDS

ARGUMENTS
  IDS  Steam Workshop item IDs.

OPTIONS
  -n, --nonInteractive          Do not prompt for any input.
  -t, --type=all|client|server  [default: all]

EXAMPLES
  magma add 723217262 --type client
  magma add 450814997 723217262 713709341 --type all client server

See code: src/commands/add/index.ts

magma add:local PATHS

Adds local mods to the configuration files.

USAGE
  $ magma add:local PATHS

ARGUMENTS
  PATHS  File paths.

OPTIONS
  -n, --nonInteractive          Do not prompt for any input.
  -t, --type=all|client|server  [default: all]

EXAMPLES
  magma add:local /home/arma/@client --type client
  magma add:local /home/arma/@all /home/arma/@client /home/arma/@server --type all client server

See code: src/commands/add/local.ts

magma configure

Allows to modify the existing configuration file. In interactive mode all flags will be ignored (except Steam Guard).

USAGE
  $ magma configure

OPTIONS
  -b, --batchScript=batchScript                        Absolute path to the Batch script starting your server, where it
                                                       has your mods (only supported on Windows)

  -c, --steamCmd=steamCmd                              Absolute path to the SteamCMD executable (including the file
                                                       itself).

  -g, --steamGuard=steamGuard                          Steam Guard code to use when authenticating.

  -l, --linuxGsmInstanceConfig=linuxGsmInstanceConfig  Absolute path to the LinuxGSM instance configuration file (where
                                                       it handles mods/servermods) (only supported on Linux)

  -n, --nonInteractive                                 Do not prompt for any input.

  -p, --password=password                              Steam user password.

  -s, --server=server                                  Absolute path to the directory where the server is (where the
                                                       server executable is).

  -u, --username=username                              Steam username.

  -w, --webhookUrl=webhookUrl                          Webhook URL to which the magma cron command will respond to.

ALIASES
  $ magma config

EXAMPLES
  magma configure
  magma configure --steamCmd "/var/steamcmd"
  magma configure -n -u UserName

See code: src/commands/configure.ts

magma cron

A command designed to be run in a time-based job scheduler to notify on social platforms for mod updates. Each time it is run, it will query the Steam Web API. Do not run this command too frequently so not to get rate-limited.

USAGE
  $ magma cron

OPTIONS
  -t, --test  Enabling will send a simple test message to your specified webhook.

EXAMPLE
  magma cron

See code: src/commands/cron.ts

magma deactivate [ID]

Deactivates mods by removing their symlinks and keys.

USAGE
  $ magma deactivate [ID]

ARGUMENTS
  ID  Steam Workshop item IDs.

OPTIONS
  -n, --nonInteractive  Do not prompt for any input.

EXAMPLES
  magma deactivate
  magma deactivate 723217262
  magma deactivate 450814997 723217262 713709341

See code: src/commands/deactivate.ts

magma help [COMMAND]

display help for magma

USAGE
  $ magma help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

magma initialize

Initializes the configuration data required for Magma to operate.

USAGE
  $ magma initialize

OPTIONS
  -b, --batchScript=batchScript                        Absolute path to the Batch script starting your server, where it
                                                       has your mods (only supported on Windows)

  -c, --steamCmd=steamCmd                              Absolute path to the SteamCMD executable (including the file
                                                       itself).

  -f, --force                                          Skip the check for the magma.json file. If it exists, it will be
                                                       overwritten.

  -g, --steamGuard=steamGuard                          Steam Guard code to use when authenticating.

  -l, --linuxGsmInstanceConfig=linuxGsmInstanceConfig  Absolute path to the LinuxGSM instance configuration file (where
                                                       it handles mods/servermods) (only supported on Linux)

  -n, --nonInteractive                                 Do not prompt for any input.

  -p, --password=password                              Steam user password.

  -s, --server=server                                  Absolute path to the directory where the server is (where the
                                                       server executable is).

  -u, --username=username                              Steam username.

  -v, --verbose                                        Output additional information for debugging purposes.

  -w, --webhookUrl=webhookUrl                          Webhook URL to which the magma cron command will respond to.

ALIASES
  $ magma init

See code: src/commands/initialize.ts

magma install

Downloads and installs mods that have not been previously installed.

USAGE
  $ magma install

See code: src/commands/install.ts

magma list

Lists all mods that have been added or installed by Magma.

USAGE
  $ magma list

See code: src/commands/list.ts

magma login

Helps to fix any Steam issues when it fails to log you in.

USAGE
  $ magma login

OPTIONS
  -g, --steamGuard=steamGuard  Steam Guard code to use when authenticating.
  -n, --nonInteractive         Do not prompt for any input.
  -p, --password=password      Steam user password.
  -u, --username=username      Steam username.
  -v, --verbose                Output additional information for debugging purposes.

EXAMPLES
  magma login
  magma login username password

See code: src/commands/login.ts

magma remove [ID]

Removes mod files from disk.

USAGE
  $ magma remove [ID]

ARGUMENTS
  ID  Item IDs.

OPTIONS
  -n, --nonInteractive  Do not prompt for any input.

ALIASES
  $ magma uninstall

EXAMPLES
  magma remove
  magma remove 1
  magma remove 14 3 9

See code: src/commands/remove.ts

magma update

Updates currently downloaded mods from Steam Workshop.

USAGE
  $ magma update

See code: src/commands/update.ts

magma upgrade

Upgrades Magma configuration file to match the newest version.

USAGE
  $ magma upgrade

See code: src/commands/upgrade.ts

Testing

npm test

Contributing

Please see CONTRIBUTING.md for details.

Security

If you discover any security-related issues, please e-mail [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see the License file for more information.

magma's People

Contributors

creeppork avatar dependabot-preview[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

aussie-battler

magma's Issues

For a very large PBO, .toString() would cause a heap out of memory exception

return await Crypto.createChecksum(fs.readFileSync(file).toString());

✔ Logging in
✔ Processing item
✔ Waiting for Steam to copy files
✔ Waiting for Steam to copy files
⠋ Comparing signatures and updating mod data
<--- Last few GCs --->

[20823:0x3681a70]    49302 ms: Mark-sweep 33.1 (39.1) -> 33.1 (39.1) MB, 12.4 / 0.0 ms  (average mu = 0.996, current mu = 0.002) allocation failure GC in old space requested
[20823:0x3681a70]    49318 ms: Mark-sweep 33.1 (39.1) -> 33.1 (39.1) MB, 16.6 / 0.0 ms  (average mu = 0.994, current mu = 0.001) last resort GC in old space requested
[20823:0x3681a70]    49335 ms: Mark-sweep 33.1 (39.1) -> 33.1 (39.1) MB, 16.9 / 0.0 ms  (average mu = 0.988, current mu = 0.001) last resort GC in old space requested


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x32b5b7fdbe1d]
Security context: 0x2a909511e6e9 <JSObject>
    1: toString [0x3c1344b9fcb9] [buffer.js:645] [bytecode=0x211746d8f0c9 offset=31](this=0x1690c8215701 <Uint8Array map = 0x2f3ca44d5b89>,encoding=0x0ca2e3a026f1 <undefined>,start=0x0ca2e3a026f1 <undefined>,end=0x0ca2e3a026f1 <undefined>)
    2: arguments adaptor frame: 0->3
    3: getChecksumForFile [0xfcab1929169] [/home/creeppork/code/Magma/src/file.ts:3...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 0x8f9d10 node::Abort() [node]
 2: 0x8f9d5c  [node]
 3: 0xaffd0e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xafff44 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xef4152  [node]
 6: 0xf0396f v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node]
 7: 0xed351b v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [node]
 8: 0xed3e22 v8::internal::Factory::NewStringFromUtf8(v8::internal::Vector<char const>, v8::internal::PretenureFlag) [node]
 9: 0xb0dd59 v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) [node]
10: 0x9c1518 node::StringBytes::Encode(v8::Isolate*, char const*, unsigned long, node::encoding, v8::Local<v8::Value>*) [node]
11: 0x916160  [node]
12: 0xb8dfef  [node]
13: 0xb8eb59 v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node]
14: 0x32b5b7fdbe1d 
[1]    20823 abort (core dumped)  ./bin/run download 763003641

Add mod enable/disable commands

This would allow mods to be quickly enabled/disabled without them being removed from disk and redownloaded when enabled again.

SteamCMD displaying an error is not caught as an error and Magma continues

✔ Logging in
⠼ Processing your requestError: ENOENT: no such file or directory, scandir '/home/arma/s3/serverfiles/steamapps/workshop/content/107410/763003641'
    at klawSync (~/.npm-global/lib/node_modules/@creeppork/magma/node_modules/klaw-sync/klaw-sync.js:13:25)
    at Function.getAllDirectoriesRecursively (~/.npm-global/lib/node_modules/@creeppork/magma/lib/file.js:31:16)
    at SteamCmd.everythingToLowercase (~/.npm-global/lib/node_modules/@creeppork/magma/lib/steam/cmd.js:229:37)
    at SteamCmd.updateFiles (~/.npm-global/lib/node_modules/@creeppork/magma/lib/steam/cmd.js:207:14)
    at SteamCmd.downloadMods (~/.npm-global/lib/node_modules/@creeppork/magma/lib/steam/cmd.js:142:24)
    at <anonymous>
⠴ Processing your request

Add mod profiles

Allows configuring multiple mod profiles to quickly switch between mod presets.

  • preset - displays the active preset
  • preset:add <name> <...item ids> - add mods to a preset
  • preset:create <name> - creates a new preset
  • preset:delete <name> - deletes a created preset
  • preset:detach <name> <...item ids> - removes mods from a preset
  • preset:generate <name> - exports a Arma 3 Launcher preset
  • preset:list - lists all presets, their mods and names
  • preset:import <name> <url/file> - import from a URL/disk an Arma 3 Launcher mod preset
  • preset:select <name> - sets the active preset

Timeout with Large Mods

This is a SteamCMD issue, but wondering if there's a way to get a work around into magma.

Basically anything above a few hundred MB times out when trying to download no matter what. I get the same issue in steamCMD directly so I know it's not an issue with magma. The "fix" for steamCMD online has been adding +validate at the end of the command to download and keep trying until it finishes. Obnoxious but steam wont fix their broke stuff. In testing I've not been able to download anything above 500mb successfully.

Is there a way to support something like that with magma? I didn't see anything in the official docs. And managing my mods using this tool and steamCMD directly is a little weird.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.