diff --git a/CloudronManifest.json b/CloudronManifest.json index eb00b29..2d1de40 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -15,7 +15,8 @@ "logoutRedirectUri": "/login", "tokenSignatureAlgorithm": "RS256" }, - "redis": { "noPassword": true } + "redis": { "noPassword": true }, + "turn":{} }, "website":"https://romm.app/", "icon":"file://logo.png", diff --git a/Dockerfile b/Dockerfile index 9a5a9ff..40bd114 100644 --- a/Dockerfile +++ b/Dockerfile @@ -159,6 +159,7 @@ ENV PATH="/app/code/.venv/bin:${PATH}" COPY start.sh /app/pkg/ COPY env.sh.template /app/pkg/ +COPY config.yml.template /app/pkg/ CMD [ "/app/pkg/start.sh" ] diff --git a/config.yml.template b/config.yml.template new file mode 100644 index 0000000..5485a7c --- /dev/null +++ b/config.yml.template @@ -0,0 +1,170 @@ +# Only uncomment the lines you want to use/modify, or add new ones where needed + +# exclude: +# # Exclude platforms to be scanned +# platforms: +# - excluded_folder_a +# - excluded_folder_b + +# # Exclude roms or parts of roms to be scanned +# roms: +# # Single file games section. +# # Will not apply to files that are in sub-folders (multi-disc roms, games with updates, DLC, patches, etc.) +# single_file: +# # Exclude all files with certain extensions to be scanned +# extensions: +# - xml +# - txt + +# # Exclude matched file names to be scanned +# # Supports unix filename pattern matching +# names: +# - 'info.txt' +# - '._*' +# - '*.nfo' + +# # Multi files games section +# # Will apply to files that are in sub-folders (multi-disc roms, games with updates, DLC, patches, etc.) +# multi_file: +# # Exclude matched 'folder' names to be scanned (RomM identifies folders as multi file games) +# # Common ES-DE media folders are listed below +# names: +# - 3dboxes +# - backcovers +# - covers +# - fanart +# - manuals +# - marquees +# - miximages +# - physicalmedia +# - screenshots +# - titlescreens +# - videos +# - downloaded_media +# - media + +# # Exclude files within sub-folders. +# parts: +# # Exclude matched file names to be scanned from multi file roms +# # Keep in mind that RomM doesn't scan folders inside multi files games, +# # so there is no need to exclude folders from inside of multi files games. +# names: +# - 'data.xml' +# - '._*' # Supports unix filename pattern matching + +# # Exclude all files with certain extensions to be scanned from multi file roms +# extensions: +# - xml +# - txt + +# system: +# # Asociate different platform names to your current file system platform names +# # [your custom platform folder name]: [RomM platform name] +# # In this example if you have a 'gc' folder, RomM will treat it like the 'ngc' folder +# platforms: +# gc: ngc +# ps1: psx + +# # Asociate one platform to it's main version (IGDB only) +# versions: +# naomi: arcade + +# The folder name where your roms are located +# filesystem: +# roms_folder: 'roms' # For example if your folder structure is /home/user/library/roms_folder +# skip_hash_calculation: false # Skip file hash calculations on low power devices (eg. Raspberry PI) + +# scan: +# # Metadata priority during scans +# priority: +# # Below are the default priority values used +# metadata: # Top-level metadata source priority +# - "igdb" # IGDB (highest priority) +# - "moby" # MobyGames +# - "ss" # Screenscraper +# - "ra" # RetroAchievements +# - "launchbox" # Launchbox +# - "gamelist" # ES-DE gamelist.xml +# - "hasheous" # Hasheous +# - "flashpoint" # Flashpoint Project +# - "hltb" # HowLongToBeat (lowest priority) +# artwork: # Cover art and screenshots +# - "igdb" # IGDB +# - "moby" # MobyGames +# - "ss" # Screenscraper +# - "ra" # RetroAchievements +# - "launchbox" # Launchbox +# - "gamelist" # ES-DE gamelist.xml +# - "hasheous" # Hasheous +# - "flashpoint" # Flashpoint Project +# - "hltb" # HowLongToBeat +# region: # Used by IGDB and ScreenScraper for regional variants +# - "us" +# - "wor" +# - "ss" +# - "eu" +# - "jp" +# language: # Used by ScreenScraper for descriptions +# - "en" +# - "fr" +# # Media assets to download +# # Only used by Screenscraper and ES-DE gamelist.xml +# media: +# # Used as alternative cover art +# - box2d # Normal cover art (always enabled) +# - box3d # 3D box art +# - miximage # Mixed image of multiple media +# - physical # Disc, cartridge, etc. +# # Added to the screenshots carousel +# - screenshot # Screenshot (enabled by default) +# - title_screen # Title screen +# - fanart # User uploaded artwork +# # Bezel displayed around the emulatorjs window +# - bezel +# # Manual in PDF format +# - manual # Manual (enabled by default) +# # Gameplay video +# - video # Video (warning: large file size) +# # Media used for batocera gamelist.xml export +# - box2d_back # Back cover art +# - logo # Transparent logo +# # Other media assets (might be used in the future) +# - marquee # Custom marquee + +# EmulatorJS per-core options +# emulatorjs: +# debug: true # Available options will be logged to the browser console +# cache_limit: null # Cache limit per ROM (in bytes) +# disable_batch_bootup: false +# disable_auto_unload: false +# settings: +# parallel_n64: # Use the exact core name +# vsync: disabled +# snes9x: +# snes9x_region: ntsc +# default: # These settings apply to all cores +# fps: show +# netplay: +# enabled: true +# ice_servers: +# - urls: "stun:stun.relay.metered.ca:80" +# - urls: "turn:global.relay.metered.ca:80" +# username: "" +# credential: "" +# controls: # https://emulatorjs.org/docs4devs/control-mapping/ +# snes9x: +# 0: # Player 1 +# 0: # A MAPPING FOR EACH BUTTON MUST BE SET! +# value: x # Mapping for keyboard +# value2: BUTTON_2 # Mapping for connected controller +# 1: # Player 2 +# 2: # Player 3 +# 3: # Player 4 + +netplay: + enabled: true + ice_servers: + - urls: "stun:$CLOUDRON_STUN_SERVER:$CLOUDRON_STUN_PORT" + - urls: "turn:$CLOUDRON_TURN_SERVER:$CLOUDRON_TURN_PORT" + username: "$turn_username" + credential: "$turn_password" diff --git a/start.sh b/start.sh index 161c306..2a3a2b2 100755 --- a/start.sh +++ b/start.sh @@ -4,7 +4,27 @@ set -eu mkdir -p /app/data/library /app/data/config /app/data/assets /app/data/resources mkdir -p /tmp/vite-temp /tmp/vite /tmp/cache -touch /app/data/config/config.yml +CONFIG_TEMPLATE_FILE="/app/pkg/config.yml.template" +CONFIG_FILE="/app/data/config/config.yml" + +# Check if config file exists in /app/data/config +if [ -f "$CONFIG_FILE" ]; then + echo "config.yml already exists in $CONFIG_FILE" +else + # Copy the template to the target location + echo "Copying $CONFIG_TEMPLATE_FILE to $CONFIG_FILE" + cp "$CONFIG_TEMPLATE_FILE" "$CONFIG_FILE" + + # Add in TURN + readonly time=$(date +%s) + readonly expiry=512640 # one year in seconds + export turn_username=$(( $time + $expiry )) + export turn_password=$(echo -n $turn_username | openssl dgst -binary -sha1 -hmac ${CLOUDRON_TURN_SECRET} | openssl base64) + + envsubst < $CONFIG_TEMPLATE_FILE > $CONFIG_FILE + + echo "Successfully created $CONFIG_FILE from template" +fi # ensure that data directory is owned by 'cloudron' user chown -R cloudron:cloudron /app/data /tmp/vite-temp /tmp/vite /tmp/cache @@ -31,7 +51,7 @@ export REDIS_PORT=${CLOUDRON_REDIS_PORT} export ROMM_BASE_PATH=/app/data export ROMM_TMP_PATH=/tmp -TEMPLATE_FILE="/app/pkg/env.sh.template" +ENV_TEMPLATE_FILE="/app/pkg/env.sh.template" ENV_FILE="/app/data/env.sh" # Check if env.sh exists in /app/data @@ -39,8 +59,8 @@ if [ -f "$ENV_FILE" ]; then echo "env.sh already exists in $ENV_FILE" else # Copy the template to the target location - echo "Copying $TEMPLATE_FILE to $ENV_FILE" - cp "$TEMPLATE_FILE" "$ENV_FILE" + echo "Copying $ENV_TEMPLATE_FILE to $ENV_FILE" + cp "$ENV_TEMPLATE_FILE" "$ENV_FILE" chmod +x "$ENV_FILE" # Generate a new secret key using openssl