-
-
Save wmbest2/e9c73fa2ad6940f724eb718e9d206890 to your computer and use it in GitHub Desktop.
Plutonium patch script for the felddy/foundryvtt container.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| services: | |
| foundry: | |
| image: felddy/foundryvtt:13 | |
| restart: unless-stopped | |
| volumes: | |
| - ./data:/data | |
| ports: | |
| - 30000:30000 | |
| environment: | |
| - CONTAINER_CACHE=/data/container_cache | |
| - CONTAINER_PATCH_URLS=https://gist.githubusercontent.com/zuedev/00330e597fbea6c4d7be942be5522916/raw/plutoniumpatch.sh | |
| - CONTAINER_VERBOSE=true | |
| - CONTAINER_PRESERVE_CONFIG=true | |
| - FOUNDRY_COMPRESS_WEBSOCKET=true | |
| - FOUNDRY_USERNAME= | |
| - FOUNDRY_PASSWORD= | |
| - FOUNDRY_ADMIN_KEY= | |
| - FOUNDRY_HOME=/home/node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| MAIN_JS="${FOUNDRY_HOME}/resources/app/main.mjs" | |
| MODULE_BACKEND_JS="/data/Data/modules/plutonium/server/v13/plutonium-backend.mjs" | |
| MODULE_LOGIN_JS="/data/Data/modules/plutonium/server/v13/plutonium-backend-addon-custom-login.mjs" | |
| MODULE_DIR="/data/Data/modules" | |
| MODULE_DOC_URL="https://wiki.5e.tools/index.php/FoundryTool_Install" | |
| MODULE_URL="https://raw.githubusercontent.com/TheGiddyLimit/plutonium-next/master/plutonium-foundry13.zip" | |
| SUPPORTED_VERSIONS="2.11.0" | |
| WORKDIR=$(mktemp -d) | |
| ZIP_FILE="${WORKDIR}/plutonium.zip" | |
| log "Installing Plutonium module and backend." | |
| log "See: ${MODULE_DOC_URL}" | |
| if [ -z "${SUPPORTED_VERSIONS##*$FOUNDRY_VERSION*}" ] ; then | |
| log "This patch has been tested with Foundry Virtual Tabletop ${FOUNDRY_VERSION}" | |
| else | |
| log_warn "This patch has not been tested with Foundry Virtual Tabletop ${FOUNDRY_VERSION}" | |
| fi | |
| if [ ! -f $MODULE_BACKEND_JS ]; then | |
| log "Downloading Plutonium module." | |
| curl --output "${ZIP_FILE}" "${MODULE_URL}" 2>&1 | tr "\r" "\n" | |
| log "Ensuring module directory exists." | |
| mkdir -p "${MODULE_DIR}" | |
| log "Installing Plutonium module." | |
| unzip -o "${ZIP_FILE}" -d "${MODULE_DIR}" | |
| fi | |
| log "Installing Plutonium backend." | |
| cp "${MODULE_BACKEND_JS}" "${FOUNDRY_HOME}/resources/app/" | |
| log "Patching ${MAIN_JS} to use plutonium-backend." | |
| patch --backup --quiet --batch ${MAIN_JS} << PATCH_FILE | |
| 31c31 | |
| < init.default({ | |
| --- | |
| > await init.default({ | |
| 36c36,37 | |
| < }); | |
| --- | |
| > }); | |
| > (await import("./plutonium-backend.mjs")).Plutonium.init(); | |
| PATCH_FILE | |
| patch_result=$? | |
| if [ $patch_result = 0 ]; then | |
| log "Plutonium backend patch was applied successfully." | |
| log "Plutonium art and media tools will be enabled." | |
| else | |
| log_error "Plutonium backend patch could not be applied." | |
| log_error "main.js did not contain the expected source lines." | |
| log_warn "Foundry Virtual Tabletop will still operate without the art and media tools enabled." | |
| log_warn "Update this patch file to a version that supports Foundry Virtual Tabletop ${FOUNDRY_VERSION}." | |
| mv "${MAIN_JS}.orig" "${MAIN_JS}" | |
| fi | |
| log "Cleaning up." | |
| cp "/data/Data/modules/plutonium/server/v13/plutonium-backend-addon-custom-login.mjs" "${FOUNDRY_HOME}/resources/app/" | |
| log "Copied Login CSS" | |
| rm -r ${WORKDIR} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment