From 3614f4232c4bc55b836d4c6667f5117e9ae5c699 Mon Sep 17 00:00:00 2001 From: Seth Wade Date: Mon, 30 Nov 2026 22:27:52 -0500 Subject: [PATCH] Initial commit: RomM Companion NextUI Pak v0.1.0 --- .gitea/workflows/ci.yml | 44 + .gitignore | 11 + Cargo.lock | 1741 +++++++++++++++++++++++++++++++++++++++ Cargo.toml | 29 + README.md | 51 ++ build-pak.sh | 84 ++ openapi.json | 1 + pak/launch.sh | 296 +++++++ pak/pak.json | 9 + src/config.rs | 193 +++++ src/main.rs | 370 +++++++++ src/matcher.rs | 381 +++++++++ src/nextui.rs | 310 +++++++ src/romm_api.rs | 671 +++++++++++++++ src/sync_engine.rs | 579 +++++++++++++ src/web_setup.rs | 725 ++++++++++++++++ 16 files changed, 5495 insertions(+) create mode 100644 .gitea/workflows/ci.yml create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 README.md create mode 100755 build-pak.sh create mode 100644 openapi.json create mode 100755 pak/launch.sh create mode 100644 pak/pak.json create mode 100644 src/config.rs create mode 100644 src/main.rs create mode 100644 src/matcher.rs create mode 100644 src/nextui.rs create mode 100644 src/romm_api.rs create mode 100644 src/sync_engine.rs create mode 100644 src/web_setup.rs diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..5c219b8 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI & Pak Build + +on: + push: + branches: [main] + tags: ["v*"] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Validate shell scripts + run: | + sh -n pak/launch.sh + bash -n build-pak.sh + - name: Run unit tests + run: cargo test + + build-pak: + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: aarch64-unknown-linux-musl + - name: Install zig & cargo-zigbuild + run: | + pip3 install ziglang + cargo install cargo-zigbuild --locked + - name: Build NextUI Pak + run: ./build-pak.sh + - name: Zip Pak artifact + run: | + cd dist + zip -r "../RomM-Companion-NextUI.pak.zip" "RomM Companion.pak" + - uses: actions/upload-artifact@v4 + with: + name: RomM-Companion-NextUI-pak + path: RomM-Companion-NextUI.pak.zip diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ad03968 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# Rust & Pak build outputs +target/ +dist/ +vendor/ + +# OS & editor files +.DS_Store +Thumbs.db +*.log +.vscode/ +.idea/ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..421b9bb --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1741 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "arbitrary" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" + +[[package]] +name = "bytes" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c" + +[[package]] +name = "cc" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95e45cf2980b2d467be49a9ed942c9179b701063a7ca3d037de7ee9bd67f8d66" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd9ae8fcb3ea71b0b26338b4ffb13006bb175de8fd07921089a906ce7e5e6945" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "derive_arbitrary" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b034bd7d5f032402a2479444dcc6f74e36a03f31854d41680fb240ef682a1ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "errno" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e44f110d1777dc6559a51e7d45083945ded4f1bf3305494350f693b6d20b9c8" + +[[package]] +name = "flate2" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "rand_core", + "wasm-bindgen", +] + +[[package]] +name = "hashbrown" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229c6ff5584df4c6becbfe00567128bac768c8cd32ebc8a8366bd81ed072e8f3" +dependencies = [ + "atomic-waker", + "bytes", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "ipnet" +version = "2.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "007d6e6b91097094791302ccc6cd0588e0700ddac5c6829035bcd71eff4dc433" + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "js-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "log" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" + +[[package]] +name = "lru-slab" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mime" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5848f5a9e8117cf94f2f90faac24a87ff81600ff8628c1e3deaab572e76bfa1" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20521a903f02b0a573cd6840e9d0a5a0cc043d361fe924092cd70f8556cc9c4a" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quinn" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe" +dependencies = [ + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.61.2", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_pcg" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb95882a1e14462c69aea9984bb261293ccfe6022ef8de0eda18bd5afb0052df" +dependencies = [ + "rand_core", +] + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tokio-util", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "romm-nextui" +version = "0.1.0" +dependencies = [ + "chrono", + "futures-util", + "hex", + "reqwest", + "serde", + "serde_json", + "sha2", + "tokio", + "uuid", + "walkdir", + "zip", +] + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "102f35f7de7b06d8c61f1cff6592f5253e0dea431c74867aad5dfd70f44663fb" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a0760a887c14823fca5a1c970b01d47c328c696c0c64829d1df50e8f853fd5" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicase" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + +[[package]] +name = "uuid" +version = "1.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c14b15dffa2f4bd712103e857140aa04a4f2ff6e955c77d7eb8e53ee02a3b64" +dependencies = [ + "getrandom 0.4.3", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42e295b7452c4604982280d8586001fcad9b8b201cac67bca9771e7a7475403" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" +dependencies = [ + "cfg-if", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.10", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-streams" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7265c9301c16a8711c992c2d8da90ee77ef54b1ed51482d6dfeb00dc756b1297" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "zip" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dcb24d0152526ae49b9b96c1dcf71850ca1e0b882e4e28ed898a93c41334744" +dependencies = [ + "arbitrary", + "crc32fast", + "crossbeam-utils", + "flate2", + "indexmap", + "memchr", + "zopfli", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zopfli" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf7fc5d30c28483d93805c4a5e12b05bbb52407fa67c5f8bd552374cd01fb11" +dependencies = [ + "bumpalo", + "crc32fast", + "log", + "simd-adler32", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..5a2a9bf --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "romm-nextui" +version = "0.1.0" +description = "RomM 5.1.0 Companion Pak for NextUI handhelds (TrimUI Brick, Smart Pro, Smart Pro S)" +authors = ["RomM Companion"] +edition = "2021" + +[[bin]] +name = "romm-nextui" +path = "src/main.rs" + +[dependencies] +serde = { version = "1", features = ["derive"] } +serde_json = "1" +tokio = { version = "1", features = ["rt-multi-thread", "macros", "net", "io-util", "fs", "time", "signal"] } +reqwest = { version = "0.12", default-features = false, features = ["json", "multipart", "stream", "rustls-tls"] } +chrono = { version = "0.4", features = ["serde"] } +walkdir = "2" +sha2 = "0.10" +hex = "0.4" +uuid = { version = "1", features = ["v4"] } +futures-util = "0.3" +zip = { version = "2", default-features = false, features = ["deflate"] } + +[profile.release] +opt-level = "z" +lto = true +codegen-units = 1 +strip = true diff --git a/README.md b/README.md new file mode 100644 index 0000000..3612bbd --- /dev/null +++ b/README.md @@ -0,0 +1,51 @@ +# RomM Companion for NextUI + +A dedicated **NextUI `.pak`** fork of RomM Companion built in Rust for Linux handhelds running [LoveRetro/NextUI](https://github.com/LoveRetro/NextUI) — including the **TrimUI Brick (`tg5040`)**, **TrimUI Smart Pro (`tg5040`)**, and **TrimUI Smart Pro S (`tg5050`)**. + +## Features + +- **Native NextUI D-Pad Menu** (`launch.sh` using `minui-list` & `minui-presenter`) +- **Phone / PC Web Setup Server** (`http://:8765`) — pair your handheld with **RomM 5.1.0** from your phone without typing URLs or tokens on a D-pad! +- **NextUI SD Card Auto-Discovery** + - Automatically scans `/Roms/* ()/` and `/Saves//` + - Maps NextUI tags (`GB`, `GBC`, `GBA`, `FC`, `SFC`, `N64`, `NDS`, `PS`, `PSP`, `MD`, `SMS`, `GG`, `DC`, `PCE`, `NGP`, `WSC`, `FBN`, etc.) to RomM platform slugs + - Supports **both** NextUI save formats: + - MinUI double-extension style (`Game.gba.sav`, `Game.gba.state0`) + - RetroArch style (`Game.srm`, `Game.state.0`) + - Zips folder-per-game saves (such as `/Saves/PSP/PSP/SAVEDATA/*`) automatically +- **RomM 5.1.0 Two-Way Save Sync & Save States** + - Uses `/api/sync/negotiate`, `/api/saves`, `/api/saves/{id}/downloaded`, `/api/sync/sessions/{id}/complete`, and `/api/states` + - Creates timestamped backups on your SD card (`/.userdata/shared/romm-companion/backups/`) before overwriting any local save + - Resolve conflicts either directly on the handheld or from your phone +- **On-Device ROM Downloader** + - Browse your RomM platforms & ROMs on the handheld and download directly into the matching `/Roms/ ()/` folder! + +## Building the `.pak` for TrimUI (`tg5040` / `tg5050`) + +Both `tg5040` and `tg5050` use **ARM64 (`aarch64`) Linux**, so a single static `aarch64-unknown-linux-musl` binary works on all of them: + +```bash +# Recommended on macOS: install zig + cargo-zigbuild once +brew install zig +export PATH="$HOME/.cargo/bin:$PATH" +cargo install cargo-zigbuild + +# Build the ready-to-copy Pak +./build-pak.sh +``` + +Copy `dist/RomM Companion.pak/` to your NextUI SD card: +- **TrimUI Brick / TrimUI Smart Pro**: `/Tools/tg5040/RomM Companion.pak/` +- **TrimUI Smart Pro S**: `/Tools/tg5050/RomM Companion.pak/` + +> Note: NextUI includes `minui-list` and `minui-presenter` (or you can place their `tg5040`/`tg5050` binaries inside `RomM Companion.pak/bin/`). If `minui-list` is absent, `launch.sh` falls back to running an immediate sync. + +## Local Testing on macOS / Linux + +```bash +export PATH="$HOME/.cargo/bin:$PATH" +cargo test + +# Test the phone/PC web setup UI locally against a mock SD card folder: +SDCARD_PATH=/tmp/mock-nextui cargo run -- web-setup --port 8765 +``` diff --git a/build-pak.sh b/build-pak.sh new file mode 100755 index 0000000..34181c7 --- /dev/null +++ b/build-pak.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Builds a self-contained NextUI Pak (`dist/RomM Companion.pak/`) +# for TrimUI Brick / Smart Pro (tg5040) and TrimUI Smart Pro S (tg5050), +# including bundled NextUI-themed minui-list & minui-presenter binaries. + +TARGET="aarch64-unknown-linux-musl" +OUT_DIR="dist/RomM Companion.pak" +VENDOR_DIR="vendor/nextui-ui" + +MINUI_LIST_VER="0.16.0" +MINUI_PRESENTER_VER="0.14.0" + +echo "==> Checking Rust target: $TARGET" +export PATH="$HOME/.cargo/bin:$PATH" + +if command -v cargo-zigbuild >/dev/null 2>&1; then + echo "==> Building static ARM64 binary with cargo-zigbuild..." + rustup target add "$TARGET" >/dev/null 2>&1 || true + cargo zigbuild --release --target "$TARGET" + BIN_PATH="target/$TARGET/release/romm-nextui" +elif command -v cross >/dev/null 2>&1; then + echo "==> Building static ARM64 binary with cross..." + cross build --release --target "$TARGET" + BIN_PATH="target/$TARGET/release/romm-nextui" +elif command -v aarch64-linux-musl-gcc >/dev/null 2>&1; then + echo "==> Building static ARM64 binary with aarch64-linux-musl-gcc..." + rustup target add "$TARGET" >/dev/null 2>&1 || true + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-musl-gcc \ + cargo build --release --target "$TARGET" + BIN_PATH="target/$TARGET/release/romm-nextui" +else + echo "ERROR: No ARM64 Linux musl cross-compiler found." + echo "Install one of the following on macOS/Linux:" + echo " 1) brew install zig && cargo install cargo-zigbuild (recommended)" + echo " 2) cargo install cross (requires Docker)" + echo " 3) brew install filosottile/musl-cross/musl-cross" + exit 1 +fi + +download_if_missing() { + local url="$1" + local dest="$2" + if [ ! -s "$dest" ]; then + echo "==> Downloading $(basename "$dest")..." + mkdir -p "$(dirname "$dest")" + curl -fsSL "$url" -o "$dest" + chmod +x "$dest" + fi +} + +echo "==> Fetching NextUI UI binaries (minui-list $MINUI_LIST_VER & minui-presenter $MINUI_PRESENTER_VER)..." +for plat in tg5040 tg5050; do + download_if_missing \ + "https://github.com/josegonzalez/minui-list/releases/download/${MINUI_LIST_VER}/minui-list-${plat}-nextui" \ + "$VENDOR_DIR/$plat/minui-list" + download_if_missing \ + "https://github.com/josegonzalez/minui-presenter/releases/download/${MINUI_PRESENTER_VER}/minui-presenter-${plat}-nextui" \ + "$VENDOR_DIR/$plat/minui-presenter" +done + +rm -rf "$OUT_DIR" +mkdir -p "$OUT_DIR/bin/tg5040" "$OUT_DIR/bin/tg5050" +cp pak/pak.json "$OUT_DIR/pak.json" +cp pak/launch.sh "$OUT_DIR/launch.sh" +cp "$BIN_PATH" "$OUT_DIR/bin/romm-nextui" +cp "$VENDOR_DIR/tg5040/minui-list" "$OUT_DIR/bin/tg5040/minui-list" +cp "$VENDOR_DIR/tg5040/minui-presenter" "$OUT_DIR/bin/tg5040/minui-presenter" +cp "$VENDOR_DIR/tg5050/minui-list" "$OUT_DIR/bin/tg5050/minui-list" +cp "$VENDOR_DIR/tg5050/minui-presenter" "$OUT_DIR/bin/tg5050/minui-presenter" +chmod +x \ + "$OUT_DIR/launch.sh" \ + "$OUT_DIR/bin/romm-nextui" \ + "$OUT_DIR/bin/tg5040/minui-list" \ + "$OUT_DIR/bin/tg5040/minui-presenter" \ + "$OUT_DIR/bin/tg5050/minui-list" \ + "$OUT_DIR/bin/tg5050/minui-presenter" + +echo "" +echo "✅ Built self-contained NextUI Pak at: $OUT_DIR" +echo "Copy '$OUT_DIR' to your SD card:" +echo " - TrimUI Brick / Smart Pro: /Tools/tg5040/RomM Companion.pak/" +echo " - TrimUI Smart Pro S: /Tools/tg5050/RomM Companion.pak/" diff --git a/openapi.json b/openapi.json new file mode 100644 index 0000000..ea22f5f --- /dev/null +++ b/openapi.json @@ -0,0 +1 @@ +{"openapi":"3.1.0","info":{"title":"RomM API","version":"5.1.0"},"paths":{"/api/heartbeat":{"get":{"tags":["system"],"summary":"Heartbeat","description":"Endpoint to set the CSRF token in cache and return all the basic RomM config\n\nReturns:\n HeartbeatReturn: TypedDict structure with all the defined values in the HeartbeatReturn class.","operationId":"heartbeat_api_heartbeat_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HeartbeatResponse"}}}}}}},"/api/heartbeat/metadata/{source}":{"get":{"tags":["system"],"summary":"Metadata Heartbeat","description":"Endpoint to return the heartbeat of the metadata sources","operationId":"metadata_heartbeat_api_heartbeat_metadata__source__get","parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string","title":"Source"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"boolean","title":"Response Metadata Heartbeat Api Heartbeat Metadata Source Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/setup/library":{"get":{"tags":["system"],"summary":"Get Setup Library Info","description":"Get library structure information for setup wizard.\n\nOnly accessible during initial setup (no admin users) or with authentication.\n\nReturns:\n - detected_structure: \"struct_a\" (roms/{platform}), \"struct_b\" ({platform}/roms), or None\n - existing_platforms: list of objects with fs_slug and rom_count\n - supported_platforms: list of all supported platforms with metadata","operationId":"get_setup_library_info_api_setup_library_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":[]},{"HTTPBasic":[]}]}},"/api/setup/platforms":{"post":{"tags":["system"],"summary":"Create Setup Platforms","description":"Create platform folders during setup wizard.\n\nOnly accessible during initial setup (no admin users) or with authentication.\n\nArgs:\n platform_slugs: List of platform fs_slugs to create\n\nReturns:\n - success: bool\n - created_count: number of platforms created\n - message: success or error message","operationId":"create_setup_platforms_api_setup_platforms_post","requestBody":{"content":{"application/json":{"schema":{"items":{"type":"string"},"type":"array","title":"Platform Slugs"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]},{"HTTPBasic":[]}]}},"/api/login":{"post":{"tags":["auth"],"summary":"Login","description":"Session login endpoint\n\nArgs:\n request (Request): Fastapi Request object\n credentials: Defaults to Depends(HTTPBasic()).\n\nRaises:\n CredentialsException: Invalid credentials\n UserDisabledException: Auth is disabled","operationId":"login_api_login_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBasic":[]}]}},"/api/logout":{"post":{"tags":["auth"],"summary":"Logout","description":"Session logout endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n Optional[dict]: When OIDC RP-Initiated Logout is enabled and the session\n contains an OIDC id_token, returns a dict with the OIDC end-session URL\n so the client can redirect the browser to log out of the OIDC provider.","operationId":"logout_api_logout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/OIDCLogoutResponse"},{"type":"null"}],"title":"Response Logout Api Logout Post"}}}}}}},"/api/token":{"post":{"tags":["auth"],"summary":"Token","description":"OAuth2 token endpoint\n\nArgs:\n form_data (Annotated[OAuth2RequestForm, Depends): Form Data with OAuth2 info\n\nRaises:\n HTTPException: Missing refresh token\n HTTPException: Invalid refresh token\n HTTPException: Missing username or password\n HTTPException: Invalid username or password\n HTTPException: Client credentials are not yet supported\n HTTPException: Invalid or unsupported grant type\n HTTPException: Insufficient scope\n\nReturns:\n TokenResponse: TypedDict with the new generated token info","operationId":"token_api_token_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_token_api_token_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/login/openid":{"get":{"tags":["auth"],"summary":"Login Via Openid","description":"OIDC login endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nRaises:\n OIDCDisabledException: OAuth is disabled\n OIDCNotConfiguredException: OAuth not configured\n\nReturns:\n RedirectResponse: Redirect to OIDC provider","operationId":"login_via_openid_api_login_openid_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/oauth/openid":{"get":{"tags":["auth"],"summary":"Auth Openid","description":"OIDC callback endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nRaises:\n OIDCDisabledException: OAuth is disabled\n OIDCNotConfiguredException: OAuth not configured\n AuthCredentialsException: Invalid credentials\n UserDisabledException: Auth is disabled\n\nReturns:\n RedirectResponse: Redirect to home page","operationId":"auth_openid_api_oauth_openid_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/forgot-password":{"post":{"tags":["auth"],"summary":"Request Password Reset","description":"Request a password reset link for the user.\n\nArgs:\n username (str): Username of the user requesting the reset\nReturns:\n None: Returns 200 OK status","operationId":"request_password_reset_api_forgot_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_request_password_reset_api_forgot_password_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/reset-password":{"post":{"tags":["auth"],"summary":"Reset Password","description":"Reset password using the token.\n\nArgs:\n token (str): Reset token from the URL\n new_password (str): New user password\n\nReturns:\n None: Returns 200 OK status","operationId":"reset_password_api_reset_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_reset_password_api_reset_password_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/activity":{"get":{"tags":["activity"],"summary":"Get All Activity","description":"Return every currently active play session across all users.","operationId":"get_all_activity_api_activity_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ActivityEntrySchema"},"type":"array","title":"Response Get All Activity Api Activity Get"}}}}},"security":[{"OAuth2PasswordBearer":["roms.user.read"]},{"HTTPBasic":[]}]}},"/api/activity/rom/{rom_id}":{"get":{"tags":["activity"],"summary":"Get Rom Activity","description":"Return all active play sessions for a specific ROM.","operationId":"get_rom_activity_api_activity_rom__rom_id__get","security":[{"OAuth2PasswordBearer":["roms.user.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"rom_id","in":"path","required":true,"schema":{"type":"integer","title":"Rom Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ActivityEntrySchema"},"title":"Response Get Rom Activity Api Activity Rom Rom Id Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/activity/heartbeat":{"post":{"tags":["activity"],"summary":"Device Heartbeat","description":"Heartbeat endpoint for external devices (muOS, Android, etc.).\n\nCalled periodically by devices while the user is playing a game. Writes\nactivity state to Redis and broadcasts an ``activity:update`` event over\nthe main Socket.IO namespace.","operationId":"device_heartbeat_api_activity_heartbeat_post","security":[{"OAuth2PasswordBearer":["roms.user.write"]},{"HTTPBasic":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceHeartbeatPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityEntrySchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["activity"],"summary":"Clear Device Activity","description":"Immediately clear an active session for a device (e.g. on graceful exit).","operationId":"clear_device_activity_api_activity_heartbeat_delete","security":[{"OAuth2PasswordBearer":["roms.user.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"device_id","in":"query","required":true,"schema":{"type":"string","title":"Device Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/users":{"get":{"tags":["users"],"summary":"Get Users","description":"Get all users endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n list[UserSchema]: All users stored in the RomM's database","operationId":"get_users_api_users_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/UserSchema"},"type":"array","title":"Response Get Users Api Users Get"}}}}},"security":[{"OAuth2PasswordBearer":["users.read"]},{"HTTPBasic":[]}]},"post":{"tags":["users"],"summary":"Add User","description":"Create user endpoint\n\nArgs:\n request (Request): Fastapi Requests object\n username (str): User username\n password (str): User password\n email (str): User email\n role (str): RomM Role object represented as string\n\nReturns:\n UserSchema: Newly created user","operationId":"add_user_api_users_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_add_user_api_users_post"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]},{"HTTPBasic":[]}]}},"/api/users/invite-link":{"post":{"tags":["users"],"summary":"Create Invite Link","description":"Create an invite link for a user.\n\nArgs:\n request (Request): FastAPI Request object\n role (str): The role of the user\n expiration (int | None): Token expiration in seconds. Defaults to\n the INVITE_TOKEN_EXPIRY_SECONDS environment variable.\n\nReturns:\n InviteLinkSchema: Invite link","operationId":"create_invite_link_api_users_invite_link_post","security":[{"OAuth2PasswordBearer":[]},{"HTTPBasic":[]}],"parameters":[{"name":"role","in":"query","required":true,"schema":{"type":"string","title":"Role"}},{"name":"expiration","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expiration"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteLinkSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/users/register":{"post":{"tags":["users"],"summary":"Create User From Invite","description":"Create user endpoint with invite link\n\nArgs:\n username (str): User username\n email (str): User email\n password (str): User password\n token (str): Invite link token\n\nReturns:\n UserSchema: Newly created user","operationId":"create_user_from_invite_api_users_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_create_user_from_invite_api_users_register_post"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/users/identifiers":{"get":{"tags":["users"],"summary":"Get User Identifiers","description":"Get all user identifiers endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n list[int]: All user ids stored in the RomM's database","operationId":"get_user_identifiers_api_users_identifiers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"integer"},"type":"array","title":"Response Get User Identifiers Api Users Identifiers Get"}}}}},"security":[{"OAuth2PasswordBearer":["users.read"]},{"HTTPBasic":[]}]}},"/api/users/me":{"get":{"tags":["users"],"summary":"Get Current User","description":"Get current user endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n UserSchema | None: Current user","operationId":"get_current_user_api_users_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UserSchema"},{"type":"null"}],"title":"Response Get Current User Api Users Me Get"}}}}},"security":[{"OAuth2PasswordBearer":["me.read"]},{"HTTPBasic":[]}]}},"/api/users/{id}":{"get":{"tags":["users"],"summary":"Get User","description":"Get user endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n UserSchem: User stored in the RomM's database","operationId":"get_user_api_users__id__get","security":[{"OAuth2PasswordBearer":["users.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["users"],"summary":"Update User","description":"Update user endpoint\n\nArgs:\n request (Request): Fastapi Requests object\n user_id (int): User internal id\n form_data (Annotated[UserUpdateForm, Depends): Form Data with user updated info\n\nRaises:\n HTTPException: User is not found in database\n HTTPException: Username already in use by another user\n\nReturns:\n UserSchema: Updated user info","operationId":"update_user_api_users__id__put","security":[{"OAuth2PasswordBearer":["me.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/UserForm"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["users"],"summary":"Delete User","description":"Delete a user by ID.\n\nRaises:\n HTTPException: User is not found in database\n HTTPException: User deleting itself\n HTTPException: User is the last admin user","operationId":"delete_user_api_users__id__delete","security":[{"OAuth2PasswordBearer":["users.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"User internal id.","title":"Id"},"description":"User internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request"},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/users/{id}/avatar":{"get":{"tags":["users"],"summary":"Get User Avatar","description":"Serve a user's avatar image. Avatars are public to any authenticated\nuser (rendered next to community content, activity, and user lists).","operationId":"get_user_avatar_api_users__id__avatar_get","security":[{"OAuth2PasswordBearer":["assets.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"User internal id.","title":"Id"},"description":"User internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/users/{id}/ra/refresh":{"post":{"tags":["users"],"summary":"Refresh RetroAchievements","description":"Refresh RetroAchievements progression data for a user.","operationId":"refresh_retro_achievements_api_users__id__ra_refresh_post","security":[{"OAuth2PasswordBearer":["me.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"User internal id.","title":"Id"},"description":"User internal id."}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_refresh_retro_achievements_api_users__id__ra_refresh_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/client-tokens":{"get":{"tags":["client-tokens"],"summary":"List Tokens","operationId":"list_tokens_api_client_tokens_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ClientTokenSchema"},"type":"array","title":"Response List Tokens Api Client Tokens Get"}}}}},"security":[{"OAuth2PasswordBearer":["me.read"]},{"HTTPBasic":[]}]},"post":{"tags":["client-tokens"],"summary":"Create Token","operationId":"create_token_api_client_tokens_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientTokenCreatePayload"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientTokenCreateSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["me.write"]},{"HTTPBasic":[]}]}},"/api/client-tokens/{token_id}":{"delete":{"tags":["client-tokens"],"summary":"Delete Token","operationId":"delete_token_api_client_tokens__token_id__delete","security":[{"OAuth2PasswordBearer":["me.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"token_id","in":"path","required":true,"schema":{"type":"integer","title":"Token Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/client-tokens/{token_id}/regenerate":{"put":{"tags":["client-tokens"],"summary":"Regenerate Token","operationId":"regenerate_token_api_client_tokens__token_id__regenerate_put","security":[{"OAuth2PasswordBearer":["me.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"token_id","in":"path","required":true,"schema":{"type":"integer","title":"Token Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientTokenCreateSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/client-tokens/{token_id}/pair":{"post":{"tags":["client-tokens"],"summary":"Pair Token","operationId":"pair_token_api_client_tokens__token_id__pair_post","security":[{"OAuth2PasswordBearer":["me.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"token_id","in":"path","required":true,"schema":{"type":"integer","title":"Token Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientTokenPairSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/client-tokens/pair/{code}/status":{"get":{"tags":["client-tokens"],"summary":"Pair Status","operationId":"pair_status_api_client_tokens_pair__code__status_get","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/client-tokens/exchange":{"post":{"tags":["client-tokens"],"summary":"Exchange Pair Code","operationId":"exchange_pair_code_api_client_tokens_exchange_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientTokenExchangePayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientTokenCreateSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/client-tokens/all":{"get":{"tags":["client-tokens"],"summary":"List All Tokens","operationId":"list_all_tokens_api_client_tokens_all_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ClientTokenAdminSchema"},"type":"array","title":"Response List All Tokens Api Client Tokens All Get"}}}}},"security":[{"OAuth2PasswordBearer":["users.read"]},{"HTTPBasic":[]}]}},"/api/client-tokens/{token_id}/admin":{"delete":{"tags":["client-tokens"],"summary":"Admin Delete Token","operationId":"admin_delete_token_api_client_tokens__token_id__admin_delete","security":[{"OAuth2PasswordBearer":["users.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"token_id","in":"path","required":true,"schema":{"type":"integer","title":"Token Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/devices":{"get":{"tags":["devices"],"summary":"Get Devices","operationId":"get_devices_api_devices_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/DeviceSchema"},"type":"array","title":"Response Get Devices Api Devices Get"}}}}},"security":[{"OAuth2PasswordBearer":["devices.read"]},{"HTTPBasic":[]}]},"post":{"tags":["devices"],"summary":"Register Device","operationId":"register_device_api_devices_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceCreatePayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceCreateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["devices.write"]},{"HTTPBasic":[]}]}},"/api/devices/{device_id}":{"get":{"tags":["devices"],"summary":"Get Device","operationId":"get_device_api_devices__device_id__get","security":[{"OAuth2PasswordBearer":["devices.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"device_id","in":"path","required":true,"schema":{"type":"string","title":"Device Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["devices"],"summary":"Update Device","operationId":"update_device_api_devices__device_id__put","security":[{"OAuth2PasswordBearer":["devices.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"device_id","in":"path","required":true,"schema":{"type":"string","title":"Device Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceUpdatePayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["devices"],"summary":"Delete Device","operationId":"delete_device_api_devices__device_id__delete","security":[{"OAuth2PasswordBearer":["devices.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"device_id","in":"path","required":true,"schema":{"type":"string","title":"Device Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/device/init":{"post":{"tags":["device-auth"],"summary":"Device Auth Init","description":"Device-initiated: start a new pairing flow. Open endpoint, rate-limited.","operationId":"device_auth_init_api_auth_device_init_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceAuthInitPayload"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceAuthInitResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/device/pending/{user_code}":{"get":{"tags":["device-auth"],"summary":"Get Pending","description":"Fetch a pending request's metadata for the approval screen.","operationId":"get_pending_api_auth_device_pending__user_code__get","security":[{"OAuth2PasswordBearer":["me.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"user_code","in":"path","required":true,"schema":{"type":"string","title":"User Code"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceAuthPendingSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/device/approve":{"post":{"tags":["device-auth"],"summary":"Approve","description":"Create the Device + bound ClientToken and mark the request approved.","operationId":"approve_api_auth_device_approve_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceAuthApprovePayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceAuthApproveResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["me.write"]},{"HTTPBasic":[]}]}},"/api/auth/device/deny":{"post":{"tags":["device-auth"],"summary":"Deny","operationId":"deny_api_auth_device_deny_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceAuthDenyPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["me.write"]},{"HTTPBasic":[]}]}},"/api/auth/device/token":{"post":{"tags":["device-auth"],"summary":"Token","description":"Device-facing polling endpoint. Open, rate-limited per-IP and per-code.","operationId":"token_api_auth_device_token_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceAuthTokenPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceAuthTokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/play-sessions":{"post":{"tags":["play-sessions"],"summary":"Ingest Play Sessions","operationId":"ingest_play_sessions_api_play_sessions_post","security":[{"OAuth2PasswordBearer":["roms.user.write"]},{"HTTPBasic":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaySessionIngestPayload"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaySessionIngestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["play-sessions"],"summary":"Get Play Sessions","operationId":"get_play_sessions_api_play_sessions_get","security":[{"OAuth2PasswordBearer":["roms.user.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"rom_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rom Id"}},{"name":"device_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Id"}},{"name":"start_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Start After"}},{"name":"end_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"End Before"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PlaySessionSchema"},"title":"Response Get Play Sessions Api Play Sessions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/play-sessions/{session_id}":{"delete":{"tags":["play-sessions"],"summary":"Delete Play Session","operationId":"delete_play_session_api_play_sessions__session_id__delete","security":[{"OAuth2PasswordBearer":["roms.user.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","title":"Session Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/platforms":{"post":{"tags":["platforms"],"summary":"Add Platform","description":"Create a platform.","operationId":"add_platform_api_platforms_post","security":[{"OAuth2PasswordBearer":["platforms.write"]},{"HTTPBasic":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_add_platform_api_platforms_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["platforms"],"summary":"Get Platforms","description":"Retrieve platforms.","operationId":"get_platforms_api_platforms_get","security":[{"OAuth2PasswordBearer":["platforms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"updated_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter platforms updated after this datetime (ISO 8601 format with timezone information).","title":"Updated After"},"description":"Filter platforms updated after this datetime (ISO 8601 format with timezone information)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PlatformSchema"},"title":"Response Get Platforms Api Platforms Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/platforms/identifiers":{"get":{"tags":["platforms"],"summary":"Get Platform Identifiers","description":"Retrieve platform identifiers.","operationId":"get_platform_identifiers_api_platforms_identifiers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"integer"},"type":"array","title":"Response Get Platform Identifiers Api Platforms Identifiers Get"}}}}},"security":[{"OAuth2PasswordBearer":["platforms.read"]},{"HTTPBasic":[]}]}},"/api/platforms/supported":{"get":{"tags":["platforms"],"summary":"Get Supported Platforms Endpoint","description":"Retrieve the list of supported platforms.","operationId":"get_supported_platforms_endpoint_api_platforms_supported_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/PlatformSchema"},"type":"array","title":"Response Get Supported Platforms Endpoint Api Platforms Supported Get"}}}}},"security":[{"OAuth2PasswordBearer":["platforms.read"]},{"HTTPBasic":[]}]}},"/api/platforms/filesystem":{"get":{"tags":["platforms"],"summary":"Get Filesystem Platforms Endpoint","description":"Retrieve platform folders on disk that have no database row yet.","operationId":"get_filesystem_platforms_endpoint_api_platforms_filesystem_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/PlatformSchema"},"type":"array","title":"Response Get Filesystem Platforms Endpoint Api Platforms Filesystem Get"}}}}},"security":[{"OAuth2PasswordBearer":["platforms.read"]},{"HTTPBasic":[]}]}},"/api/platforms/{id}":{"get":{"tags":["platforms"],"summary":"Get Platform","description":"Retrieve a platform by ID.","operationId":"get_platform_api_platforms__id__get","security":[{"OAuth2PasswordBearer":["platforms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Platform id.","title":"Id"},"description":"Platform id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["platforms"],"summary":"Update Platform","description":"Update a platform.","operationId":"update_platform_api_platforms__id__put","security":[{"OAuth2PasswordBearer":["platforms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Platform id.","title":"Id"},"description":"Platform id."}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_update_platform_api_platforms__id__put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["platforms"],"summary":"Delete Platform","description":"Delete a platform by ID.","operationId":"delete_platform_api_platforms__id__delete","security":[{"OAuth2PasswordBearer":["platforms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Platform id.","title":"Id"},"description":"Platform id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/upload/start":{"post":{"tags":["roms","upload"],"summary":"Start Chunked Upload","description":"Initiate a chunked ROM upload session.","operationId":"start_chunked_upload_api_roms_upload_start_post","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"x-upload-platform","in":"header","required":true,"schema":{"type":"integer","minimum":1,"title":"X-Upload-Platform"}},{"name":"x-upload-filename","in":"header","required":true,"schema":{"type":"string","title":"X-Upload-Filename"}},{"name":"x-upload-total-size","in":"header","required":true,"schema":{"type":"integer","minimum":1,"title":"X-Upload-Total-Size"}},{"name":"x-upload-total-chunks","in":"header","required":true,"schema":{"type":"integer","minimum":1,"title":"X-Upload-Total-Chunks"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Start Chunked Upload Api Roms Upload Start Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/upload/{upload_id}":{"put":{"tags":["roms","upload"],"summary":"Upload Chunk","description":"Upload a single chunk of a ROM file.","operationId":"upload_chunk_api_roms_upload__upload_id__put","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","title":"Upload Id"}},{"name":"x-chunk-index","in":"header","required":true,"schema":{"type":"integer","minimum":0,"title":"X-Chunk-Index"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Upload Chunk Api Roms Upload Upload Id Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/upload/{upload_id}/complete":{"post":{"tags":["roms","upload"],"summary":"Complete Chunked Upload","description":"Assemble all chunks into the final ROM file.","operationId":"complete_chunked_upload_api_roms_upload__upload_id__complete_post","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","title":"Upload Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/upload/{upload_id}/cancel":{"post":{"tags":["roms","upload"],"summary":"Cancel Chunked Upload","description":"Cancel a chunked upload session and clean up temp files.","operationId":"cancel_chunked_upload_api_roms_upload__upload_id__cancel_post","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","title":"Upload Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/files":{"get":{"tags":["roms"],"summary":"Get Romfile","description":"Retrieve a rom file by ID.","operationId":"get_romfile_api_roms__id__files_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom file internal id.","title":"Id"},"description":"Rom file internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RomFileSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/files/content/{file_name}":{"get":{"tags":["roms"],"summary":"Get Romfile Content","description":"Download a rom file.","operationId":"get_romfile_content_api_roms__id__files_content__file_name__get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom file internal id.","title":"Id"},"description":"Rom file internal id."},{"name":"file_name","in":"path","required":true,"schema":{"type":"string","description":"File name to download","title":"File Name"},"description":"File name to download"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{rom_id}/files/{file_id}":{"delete":{"tags":["roms"],"summary":"Delete Rom File","description":"Delete a single file from a ROM.","operationId":"delete_rom_file_api_roms__rom_id__files__file_id__delete","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"rom_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Rom Id"},"description":"Rom internal id."},{"name":"file_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom file internal id.","title":"File Id"},"description":"Rom file internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/manuals":{"post":{"tags":["roms"],"summary":"Add Rom Manuals","description":"Upload manuals for a rom.","operationId":"add_rom_manuals_api_roms__id__manuals_post","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"x-upload-filename","in":"header","required":true,"schema":{"type":"string","description":"The name of the file being uploaded.","title":"X-Upload-Filename"},"description":"The name of the file being uploaded."}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["roms"],"summary":"Delete Rom Manuals","description":"Delete manuals for a rom.","operationId":"delete_rom_manuals_api_roms__id__manuals_delete","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/manuals/redownload":{"post":{"tags":["roms"],"summary":"Redownload Rom Manual","description":"Re-download a rom's manual from its scraped URL (e.g. screenscraper.fr).","operationId":"redownload_rom_manual_api_roms__id__manuals_redownload_post","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"400":{"description":"Bad Request"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/manuals/files":{"post":{"tags":["roms"],"summary":"Add Rom Manual File","description":"Upload a manual PDF into the ROM's own manual/ subfolder.","operationId":"add_rom_manual_file_api_roms__id__manuals_files_post","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"x-upload-filename","in":"header","required":true,"schema":{"type":"string","description":"The name of the file being uploaded.","title":"X-Upload-Filename"},"description":"The name of the file being uploaded."}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"400":{"description":"Bad Request"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/manuals/files/{file_id}":{"delete":{"tags":["roms"],"summary":"Delete Rom Manual File","description":"Delete a single manual file from a ROM's manual/ subfolder.","operationId":"delete_rom_manual_file_api_roms__id__manuals_files__file_id__delete","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"file_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom file internal id.","title":"File Id"},"description":"Rom file internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/soundtracks/metadata":{"get":{"tags":["roms"],"summary":"Get Rom Soundtrack Metadata","description":"Return compact audio metadata for every soundtrack file of a ROM.","operationId":"get_rom_soundtrack_metadata_api_roms__id__soundtracks_metadata_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SoundtrackTrackMetaSchema"},"title":"Response Get Rom Soundtrack Metadata Api Roms Id Soundtracks Metadata Get"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/soundtracks":{"post":{"tags":["roms"],"summary":"Add Rom Soundtracks","description":"Upload a soundtrack audio file for a multi-file ROM.","operationId":"add_rom_soundtracks_api_roms__id__soundtracks_post","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"x-upload-filename","in":"header","required":true,"schema":{"type":"string","description":"The name of the file being uploaded.","title":"X-Upload-Filename"},"description":"The name of the file being uploaded."}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/soundtracks/{file_id}":{"delete":{"tags":["roms"],"summary":"Delete Rom Soundtrack","description":"Delete a single soundtrack file from a ROM.","operationId":"delete_rom_soundtrack_api_roms__id__soundtracks__file_id__delete","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"file_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom file internal id.","title":"File Id"},"description":"Rom file internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/screenshots":{"post":{"tags":["roms"],"summary":"Add Rom Screenshots","description":"Upload a screenshot image for a multi-file ROM.","operationId":"add_rom_screenshots_api_roms__id__screenshots_post","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"x-upload-filename","in":"header","required":true,"schema":{"type":"string","description":"The name of the file being uploaded.","title":"X-Upload-Filename"},"description":"The name of the file being uploaded."}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/screenshots/{file_id}":{"delete":{"tags":["roms"],"summary":"Delete Rom Screenshot","description":"Delete a single screenshot file from a ROM.","operationId":"delete_rom_screenshot_api_roms__id__screenshots__file_id__delete","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"file_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom file internal id.","title":"File Id"},"description":"Rom file internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/notes":{"get":{"tags":["roms"],"summary":"Get Rom Notes","description":"Get all notes for a ROM.","operationId":"get_rom_notes_api_roms__id__notes_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"public_only","in":"query","required":false,"schema":{"type":"boolean","description":"Only return public notes","default":false,"title":"Public Only"},"description":"Only return public notes"},{"name":"search","in":"query","required":false,"schema":{"type":"string","description":"Search notes by title or content","title":"Search"},"description":"Search notes by title or content"},{"name":"tags","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"},"description":"Filter by tags","title":"Tags"},"description":"Filter by tags"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserNoteSchema"},"title":"Response Get Rom Notes Api Roms Id Notes Get"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["roms"],"summary":"Create Rom Note","description":"Create a new note for a ROM.","operationId":"create_rom_note_api_roms__id__notes_post","security":[{"OAuth2PasswordBearer":["roms.user.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Note Data"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserNoteSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/notes/identifiers":{"get":{"tags":["roms"],"summary":"Get Rom Note Identifiers","description":"Get all note identifiers for a ROM.","operationId":"get_rom_note_identifiers_api_roms__id__notes_identifiers_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"integer"},"title":"Response Get Rom Note Identifiers Api Roms Id Notes Identifiers Get"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/notes/{note_id}":{"put":{"tags":["roms"],"summary":"Update Rom Note","description":"Update a ROM note.","operationId":"update_rom_note_api_roms__id__notes__note_id__put","security":[{"OAuth2PasswordBearer":["roms.user.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"note_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Note id.","title":"Note Id"},"description":"Note id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Note Data"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserNoteSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["roms"],"summary":"Delete Rom Note","description":"Delete a ROM note.","operationId":"delete_rom_note_api_roms__id__notes__note_id__delete","security":[{"OAuth2PasswordBearer":["roms.user.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"note_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Note id.","title":"Note Id"},"description":"Note id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Rom Note Api Roms Id Notes Note Id Delete"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/patch":{"post":{"tags":["roms"],"summary":"Patch Rom","description":"Apply a patch to a ROM file server-side and return the patched file.\n\nThe base ROM file must exist in the library. The patch is supplied either\nas ``patch_file_id`` (a patch already in the library) or as an uploaded\n``patch_file`` (never stored in the library). Exactly one must be provided.\nThe patched ROM is streamed back as a download.","operationId":"patch_rom_api_roms__id__patch_post","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"ROM file ID (the base game file).","title":"Id"},"description":"ROM file ID (the base game file)."}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_patch_rom_api_roms__id__patch_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"400":{"description":"Bad Request"},"404":{"description":"Not Found"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms":{"get":{"tags":["roms"],"summary":"Get Roms","description":"Retrieve roms.","operationId":"get_roms_api_roms_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"with_char_index","in":"query","required":false,"schema":{"type":"boolean","description":"Whether to get the char index.","default":true,"title":"With Char Index"},"description":"Whether to get the char index."},{"name":"with_filter_values","in":"query","required":false,"schema":{"type":"boolean","description":"Whether to return filter values.","default":true,"title":"With Filter Values"},"description":"Whether to return filter values."},{"name":"with_rom_id_index","in":"query","required":false,"schema":{"type":"boolean","description":"Whether to return the full ordered rom id index that backs virtual scroll.","default":true,"title":"With Rom Id Index"},"description":"Whether to return the full ordered rom id index that backs virtual scroll."},{"name":"search_term","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search term to filter roms.","title":"Search Term"},"description":"Search term to filter roms."},{"name":"platform_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"integer"}},{"type":"null"}],"description":"Platform internal ids. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned.","title":"Platform Ids"},"description":"Platform internal ids. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned."},{"name":"collection_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Collection internal id.","title":"Collection Id"},"description":"Collection internal id."},{"name":"virtual_collection_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Virtual collection internal id.","title":"Virtual Collection Id"},"description":"Virtual collection internal id."},{"name":"smart_collection_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Smart collection internal id.","title":"Smart Collection Id"},"description":"Smart collection internal id."},{"name":"matched","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Whether the rom matched at least one metadata source.","title":"Matched"},"description":"Whether the rom matched at least one metadata source."},{"name":"favorite","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Whether the rom is marked as favorite.","title":"Favorite"},"description":"Whether the rom is marked as favorite."},{"name":"duplicate","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Whether the rom is marked as duplicate.","title":"Duplicate"},"description":"Whether the rom is marked as duplicate."},{"name":"last_played","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Whether the rom has a last played value for the current user.","title":"Last Played"},"description":"Whether the rom has a last played value for the current user."},{"name":"playable","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Whether the rom is playable from the browser.","title":"Playable"},"description":"Whether the rom is playable from the browser."},{"name":"missing","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Whether the rom is missing from the filesystem.","title":"Missing"},"description":"Whether the rom is missing from the filesystem."},{"name":"has_ra","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Whether the rom has RetroAchievements data.","title":"Has Ra"},"description":"Whether the rom has RetroAchievements data."},{"name":"has_saves","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Whether the rom has saves for the current user.","title":"Has Saves"},"description":"Whether the rom has saves for the current user."},{"name":"has_states","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Whether the rom has save states for the current user.","title":"Has States"},"description":"Whether the rom has save states for the current user."},{"name":"verified","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Whether the rom is verified by Hasheous.","title":"Verified"},"description":"Whether the rom is verified by Hasheous."},{"name":"has_soundtrack","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Whether the rom has any soundtrack files.","title":"Has Soundtrack"},"description":"Whether the rom has any soundtrack files."},{"name":"group_by_meta_id","in":"query","required":false,"schema":{"type":"boolean","description":"Whether to group roms by metadata ID (IGDB / Moby / ScreenScraper / RetroAchievements / LaunchBox).","default":false,"title":"Group By Meta Id"},"description":"Whether to group roms by metadata ID (IGDB / Moby / ScreenScraper / RetroAchievements / LaunchBox)."},{"name":"genres","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Associated genre. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned.","title":"Genres"},"description":"Associated genre. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned."},{"name":"franchises","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Associated franchise. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned.","title":"Franchises"},"description":"Associated franchise. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned."},{"name":"collections","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Associated collection. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned.","title":"Collections"},"description":"Associated collection. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned."},{"name":"companies","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Associated company. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned.","title":"Companies"},"description":"Associated company. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned."},{"name":"age_ratings","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Associated age rating. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned.","title":"Age Ratings"},"description":"Associated age rating. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned."},{"name":"statuses","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Game status, set by the current user. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned.","title":"Statuses"},"description":"Game status, set by the current user. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned."},{"name":"regions","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Associated region tag. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned.","title":"Regions"},"description":"Associated region tag. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned."},{"name":"languages","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Associated language tag. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned.","title":"Languages"},"description":"Associated language tag. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned."},{"name":"player_counts","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Associated player count. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned.","title":"Player Counts"},"description":"Associated player count. Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned."},{"name":"metadata_providers","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Matched metadata provider (igdb, moby, ss, ra, launchbox, hasheous, flashpoint, hltb, gamelist, libretro). Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned.","title":"Metadata Providers"},"description":"Matched metadata provider (igdb, moby, ss, ra, launchbox, hasheous, flashpoint, hltb, gamelist, libretro). Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned."},{"name":"tags","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Associated custom tag (parsed from the filename, e.g. Proto, Beta, Demo). Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned.","title":"Tags"},"description":"Associated custom tag (parsed from the filename, e.g. Proto, Beta, Demo). Multiple values are allowed by repeating the parameter, and results that match any of the values will be returned."},{"name":"genres_logic","in":"query","required":false,"schema":{"type":"string","description":"Logic operator for genres filter: 'any' (OR), 'all' (AND) or 'none' (NOT).","default":"any","title":"Genres Logic"},"description":"Logic operator for genres filter: 'any' (OR), 'all' (AND) or 'none' (NOT)."},{"name":"franchises_logic","in":"query","required":false,"schema":{"type":"string","description":"Logic operator for franchises filter: 'any' (OR), 'all' (AND) or 'none' (NOT).","default":"any","title":"Franchises Logic"},"description":"Logic operator for franchises filter: 'any' (OR), 'all' (AND) or 'none' (NOT)."},{"name":"collections_logic","in":"query","required":false,"schema":{"type":"string","description":"Logic operator for collections filter: 'any' (OR), 'all' (AND) or 'none' (NOT).","default":"any","title":"Collections Logic"},"description":"Logic operator for collections filter: 'any' (OR), 'all' (AND) or 'none' (NOT)."},{"name":"companies_logic","in":"query","required":false,"schema":{"type":"string","description":"Logic operator for companies filter: 'any' (OR), 'all' (AND) or 'none' (NOT).","default":"any","title":"Companies Logic"},"description":"Logic operator for companies filter: 'any' (OR), 'all' (AND) or 'none' (NOT)."},{"name":"age_ratings_logic","in":"query","required":false,"schema":{"type":"string","description":"Logic operator for age ratings filter: 'any' (OR), 'all' (AND) or 'none' (NOT).","default":"any","title":"Age Ratings Logic"},"description":"Logic operator for age ratings filter: 'any' (OR), 'all' (AND) or 'none' (NOT)."},{"name":"regions_logic","in":"query","required":false,"schema":{"type":"string","description":"Logic operator for regions filter: 'any' (OR), 'all' (AND) or 'none' (NOT).","default":"any","title":"Regions Logic"},"description":"Logic operator for regions filter: 'any' (OR), 'all' (AND) or 'none' (NOT)."},{"name":"languages_logic","in":"query","required":false,"schema":{"type":"string","description":"Logic operator for languages filter: 'any' (OR), 'all' (AND) or 'none' (NOT).","default":"any","title":"Languages Logic"},"description":"Logic operator for languages filter: 'any' (OR), 'all' (AND) or 'none' (NOT)."},{"name":"statuses_logic","in":"query","required":false,"schema":{"type":"string","description":"Logic operator for statuses filter: 'any' (OR), 'all' (AND) or 'none' (NOT).","default":"any","title":"Statuses Logic"},"description":"Logic operator for statuses filter: 'any' (OR), 'all' (AND) or 'none' (NOT)."},{"name":"player_counts_logic","in":"query","required":false,"schema":{"type":"string","description":"Logic operator for player counts filter: 'any' (OR), 'all' (AND) or 'none' (NOT).","default":"any","title":"Player Counts Logic"},"description":"Logic operator for player counts filter: 'any' (OR), 'all' (AND) or 'none' (NOT)."},{"name":"metadata_providers_logic","in":"query","required":false,"schema":{"type":"string","description":"Logic operator for metadata providers filter: 'any' (OR), 'all' (AND) or 'none' (NOT).","default":"any","title":"Metadata Providers Logic"},"description":"Logic operator for metadata providers filter: 'any' (OR), 'all' (AND) or 'none' (NOT)."},{"name":"tags_logic","in":"query","required":false,"schema":{"type":"string","description":"Logic operator for tags filter: 'any' (OR), 'all' (AND) or 'none' (NOT).","default":"any","title":"Tags Logic"},"description":"Logic operator for tags filter: 'any' (OR), 'all' (AND) or 'none' (NOT)."},{"name":"order_by","in":"query","required":false,"schema":{"type":"string","description":"Field to order results by. Leave empty to order by search relevance when a search term is given on MySQL/MariaDB; other databases fall back to name.","default":"","title":"Order By"},"description":"Field to order results by. Leave empty to order by search relevance when a search term is given on MySQL/MariaDB; other databases fall back to name."},{"name":"order_dir","in":"query","required":false,"schema":{"type":"string","description":"Order direction, either 'asc' or 'desc'.","default":"asc","title":"Order Dir"},"description":"Order direction, either 'asc' or 'desc'."},{"name":"updated_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter roms updated after this datetime (ISO 8601 format with timezone information).","title":"Updated After"},"description":"Filter roms updated after this datetime (ISO 8601 format with timezone information)."},{"name":"with_files","in":"query","required":false,"schema":{"type":"boolean","description":"Whether to include each rom's file entries.","default":false,"title":"With Files"},"description":"Whether to include each rom's file entries."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":1,"description":"Page size limit","default":50,"title":"Limit"},"description":"Page size limit"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Page offset","default":0,"title":"Offset"},"description":"Page offset"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomLimitOffsetPage_SimpleRomSchema_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/identifiers":{"get":{"tags":["roms"],"summary":"Get Rom Identifiers","description":"Retrieve rom identifiers.","operationId":"get_rom_identifiers_api_roms_identifiers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"integer"},"type":"array","title":"Response Get Rom Identifiers Api Roms Identifiers Get"}}}}},"security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}]}},"/api/roms/download":{"get":{"tags":["roms"],"summary":"Download Roms","description":"Download a list of roms as a zip file.","operationId":"download_roms_api_roms_download_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"rom_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated list of ROM IDs to download as a zip file.","title":"Rom Ids"},"description":"Comma-separated list of ROM IDs to download as a zip file."},{"name":"platform_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Download every ROM in this platform as a zip file.","title":"Platform Id"},"description":"Download every ROM in this platform as a zip file."},{"name":"collection_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Download every ROM in this collection as a zip file.","title":"Collection Id"},"description":"Download every ROM in this collection as a zip file."},{"name":"virtual_collection_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Download every ROM in this virtual collection as a zip file.","title":"Virtual Collection Id"},"description":"Download every ROM in this virtual collection as a zip file."},{"name":"smart_collection_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Download every ROM in this smart collection as a zip file.","title":"Smart Collection Id"},"description":"Download every ROM in this smart collection as a zip file."},{"name":"filename","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Name for the zip file (optional).","title":"Filename"},"description":"Name for the zip file (optional)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/by-metadata-provider":{"get":{"tags":["roms"],"summary":"Get Rom By Metadata Provider","description":"Retrieve a rom by metadata ID.","operationId":"get_rom_by_metadata_provider_api_roms_by_metadata_provider_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"igdb_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"IGDB ID to search by","title":"Igdb Id"},"description":"IGDB ID to search by"},{"name":"moby_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"MobyGames ID to search by","title":"Moby Id"},"description":"MobyGames ID to search by"},{"name":"ss_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"ScreenScraper ID to search by","title":"Ss Id"},"description":"ScreenScraper ID to search by"},{"name":"ra_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"RetroAchievements ID to search by","title":"Ra Id"},"description":"RetroAchievements ID to search by"},{"name":"launchbox_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"LaunchBox ID to search by","title":"Launchbox Id"},"description":"LaunchBox ID to search by"},{"name":"hasheous_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Hasheous ID to search by","title":"Hasheous Id"},"description":"Hasheous ID to search by"},{"name":"tgdb_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"TGDB ID to search by","title":"Tgdb Id"},"description":"TGDB ID to search by"},{"name":"flashpoint_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Flashpoint ID to search by","title":"Flashpoint Id"},"description":"Flashpoint ID to search by"},{"name":"hltb_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"HLTB ID to search by","title":"Hltb Id"},"description":"HLTB ID to search by"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetailedRomSchema"}}}},"404":{"description":"Not Found"},"400":{"description":"Bad Request"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/by-hash":{"get":{"tags":["roms"],"summary":"Get Rom By Hash","operationId":"get_rom_by_hash_api_roms_by_hash_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"crc_hash","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"CRC hash value","title":"Crc Hash"},"description":"CRC hash value"},{"name":"md5_hash","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"MD5 hash value","title":"Md5 Hash"},"description":"MD5 hash value"},{"name":"sha1_hash","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"SHA1 hash value","title":"Sha1 Hash"},"description":"SHA1 hash value"},{"name":"ra_hash","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"RetroAchievements hash value","title":"Ra Hash"},"description":"RetroAchievements hash value"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetailedRomSchema"}}}},"404":{"description":"Not Found"},"400":{"description":"Bad Request"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/filters":{"get":{"tags":["roms"],"summary":"Get Rom Filters","operationId":"get_rom_filters_api_roms_filters_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RomFiltersDict"}}}}},"security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}]}},"/api/roms/{id}/simple":{"get":{"tags":["roms"],"summary":"Get Rom Simple","description":"Retrieve a rom by ID with the lightweight schema — no eager-loaded\n`user_saves` / `user_states` / `user_screenshots` / `user_collections` /\n`all_user_notes` arrays. Designed for the v2 gallery card which only\nneeds the indicator flags (`has_notes`, `ra_id`, status, etc.) already\npresent on `SimpleRomSchema`. The full `DetailedRomSchema` is only\nfetched on user-driven detail interactions (game details page, quick-\nnote dialog open, achievements panel).","operationId":"get_rom_simple_api_roms__id__simple_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimpleRomSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}":{"get":{"tags":["roms"],"summary":"Get Rom","description":"Retrieve a rom by ID.","operationId":"get_rom_api_roms__id__get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetailedRomSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["roms"],"summary":"Update Rom","description":"Update a rom.","operationId":"update_rom_api_roms__id__put","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"remove_cover","in":"query","required":false,"schema":{"type":"boolean","description":"Whether to remove the cover image for this rom.","default":false,"title":"Remove Cover"},"description":"Whether to remove the cover image for this rom."},{"name":"unmatch_metadata","in":"query","required":false,"schema":{"type":"boolean","description":"Whether to remove the metadata matches for this game.","default":false,"title":"Unmatch Metadata"},"description":"Whether to remove the metadata matches for this game."}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_update_rom_api_roms__id__put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetailedRomSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/content/{file_name}":{"head":{"tags":["roms"],"summary":"Head Rom Content","description":"Retrieve head information for a rom file download.","operationId":"head_rom_content_api_roms__id__content__file_name__head","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"file_name","in":"path","required":true,"schema":{"type":"string","description":"File name to download","title":"File Name"},"description":"File name to download"},{"name":"file_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated list of file ids to download for multi-part roms.","title":"File Ids"},"description":"Comma-separated list of file ids to download for multi-part roms."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["roms"],"summary":"Get Rom Content","description":"Download a rom.\n\nThis endpoint serves the content of the requested rom, as:\n- A single file for single file roms.\n- A zipped file for multi-part roms, including a .m3u file if applicable.","operationId":"get_rom_content_api_roms__id__content__file_name__get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"file_name","in":"path","required":true,"schema":{"type":"string","description":"Zip file output name","title":"File Name"},"description":"Zip file output name"},{"name":"file_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated list of file ids to download for multi-part roms.","title":"File Ids"},"description":"Comma-separated list of file ids to download for multi-part roms."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/{id}/convert-to-folder":{"post":{"tags":["roms"],"summary":"Convert Rom To Folder","description":"Promote a single-file ROM to a folder ROM in place.\n\nKeeps the same id and all relations; no rescan. A no-op (clean success) if\nthe ROM is already folder-based. Returns 409 on a folder-name collision.","operationId":"convert_rom_to_folder_api_roms__id__convert_to_folder_post","security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetailedRomSchema"}}}},"404":{"description":"Not Found"},"409":{"description":"Conflict"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roms/delete":{"post":{"tags":["roms"],"summary":"Delete Roms","description":"Delete roms.","operationId":"delete_roms_api_roms_delete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_delete_roms_api_roms_delete_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkOperationResponse"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["roms.write"]},{"HTTPBasic":[]}]}},"/api/roms/{id}/props":{"put":{"tags":["roms"],"summary":"Update Rom User","description":"Update rom data associated to the current user.","operationId":"update_rom_user_api_roms__id__props_put","security":[{"OAuth2PasswordBearer":["roms.user.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Rom internal id.","title":"Id"},"description":"Rom internal id."},{"name":"update_last_played","in":"query","required":false,"schema":{"type":"boolean","description":"Set last played timestamp to now.","default":false,"title":"Update Last Played"},"description":"Set last played timestamp to now."},{"name":"remove_last_played","in":"query","required":false,"schema":{"type":"boolean","description":"Clear the last played timestamp.","default":false,"title":"Remove Last Played"},"description":"Clear the last played timestamp."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RomUserData"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RomUserSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/music/tracks":{"get":{"tags":["music"],"summary":"Get Music Tracks","description":"Flat, filterable, paginated list of soundtrack tracks.","operationId":"get_music_tracks_api_music_tracks_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Substring match on title/artist/album.","title":"Search"},"description":"Substring match on title/artist/album."},{"name":"artist","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact artist.","title":"Artist"},"description":"Exact artist."},{"name":"album","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact album.","title":"Album"},"description":"Exact album."},{"name":"genre","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact genre.","title":"Genre"},"description":"Exact genre."},{"name":"platform_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"integer"}},{"type":"null"}],"description":"Restrict to these platform ids.","title":"Platform Ids"},"description":"Restrict to these platform ids."},{"name":"rom_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Restrict to one rom's tracks.","title":"Rom Id"},"description":"Restrict to one rom's tracks."},{"name":"year","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Exact release year.","title":"Year"},"description":"Exact release year."},{"name":"min_duration","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Minimum duration in seconds.","title":"Min Duration"},"description":"Minimum duration in seconds."},{"name":"max_duration","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Maximum duration in seconds.","title":"Max Duration"},"description":"Maximum duration in seconds."},{"name":"order_by","in":"query","required":false,"schema":{"type":"string","description":"title/artist/album/duration/year/platform/added.","default":"title","title":"Order By"},"description":"title/artist/album/duration/year/platform/added."},{"name":"order_dir","in":"query","required":false,"schema":{"type":"string","description":"asc or desc.","default":"asc","title":"Order Dir"},"description":"asc or desc."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":1,"description":"Page size limit","default":50,"title":"Limit"},"description":"Page size limit"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Page offset","default":0,"title":"Offset"},"description":"Page offset"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicPage_MusicTrackSchema_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/music/favorites":{"get":{"tags":["music"],"summary":"Get Music Favorites","description":"The requesting user's favorite tracks; same shape and filters as /tracks.","operationId":"get_music_favorites_api_music_favorites_get","security":[{"OAuth2PasswordBearer":["playlists.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Substring match on title/artist/album.","title":"Search"},"description":"Substring match on title/artist/album."},{"name":"artist","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact artist.","title":"Artist"},"description":"Exact artist."},{"name":"album","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact album.","title":"Album"},"description":"Exact album."},{"name":"genre","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Exact genre.","title":"Genre"},"description":"Exact genre."},{"name":"platform_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"integer"}},{"type":"null"}],"description":"Restrict to these platform ids.","title":"Platform Ids"},"description":"Restrict to these platform ids."},{"name":"year","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Exact release year.","title":"Year"},"description":"Exact release year."},{"name":"min_duration","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Minimum duration in seconds.","title":"Min Duration"},"description":"Minimum duration in seconds."},{"name":"max_duration","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Maximum duration in seconds.","title":"Max Duration"},"description":"Maximum duration in seconds."},{"name":"order_by","in":"query","required":false,"schema":{"type":"string","description":"title/artist/album/duration/year/platform/added.","default":"title","title":"Order By"},"description":"title/artist/album/duration/year/platform/added."},{"name":"order_dir","in":"query","required":false,"schema":{"type":"string","description":"asc or desc.","default":"asc","title":"Order Dir"},"description":"asc or desc."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":1,"description":"Page size limit","default":50,"title":"Limit"},"description":"Page size limit"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Page offset","default":0,"title":"Offset"},"description":"Page offset"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicPage_MusicTrackSchema_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["music"],"summary":"Add Music Favorites","description":"Mark tracks as favorites; already-favorited tracks are ignored.","operationId":"add_music_favorites_api_music_favorites_post","security":[{"OAuth2PasswordBearer":["playlists.write"]},{"HTTPBasic":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicTrackIdsPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Add Music Favorites Api Music Favorites Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["music"],"summary":"Remove Music Favorites","description":"Unmark tracks as favorites.","operationId":"remove_music_favorites_api_music_favorites_delete","security":[{"OAuth2PasswordBearer":["playlists.write"]},{"HTTPBasic":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicTrackIdsPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Remove Music Favorites Api Music Favorites Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/music/artists":{"get":{"tags":["music"],"summary":"Get Music Artists","description":"Distinct artists (with counts); both a browse list and a typeahead.","operationId":"get_music_artists_api_music_artists_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Typeahead on artist.","title":"Search"},"description":"Typeahead on artist."},{"name":"album","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Album"}},{"name":"genre","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Genre"}},{"name":"platform_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"integer"}},{"type":"null"}],"title":"Platform Ids"}},{"name":"year","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Year"}},{"name":"min_duration","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min Duration"}},{"name":"max_duration","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max Duration"}},{"name":"order_by","in":"query","required":false,"schema":{"type":"string","description":"count or value.","default":"count","title":"Order By"},"description":"count or value."},{"name":"order_dir","in":"query","required":false,"schema":{"type":"string","default":"desc","title":"Order Dir"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":1,"description":"Page size limit","default":50,"title":"Limit"},"description":"Page size limit"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Page offset","default":0,"title":"Offset"},"description":"Page offset"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicPage_FacetValueSchema_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/music/albums":{"get":{"tags":["music"],"summary":"Get Music Albums","description":"Distinct albums (with counts); both a browse list and a typeahead.","operationId":"get_music_albums_api_music_albums_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Typeahead on album.","title":"Search"},"description":"Typeahead on album."},{"name":"artist","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Artist"}},{"name":"genre","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Genre"}},{"name":"platform_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"integer"}},{"type":"null"}],"title":"Platform Ids"}},{"name":"year","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Year"}},{"name":"min_duration","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min Duration"}},{"name":"max_duration","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max Duration"}},{"name":"order_by","in":"query","required":false,"schema":{"type":"string","description":"count or value.","default":"count","title":"Order By"},"description":"count or value."},{"name":"order_dir","in":"query","required":false,"schema":{"type":"string","default":"desc","title":"Order Dir"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":1,"description":"Page size limit","default":50,"title":"Limit"},"description":"Page size limit"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Page offset","default":0,"title":"Offset"},"description":"Page offset"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicPage_FacetValueSchema_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/music/genres":{"get":{"tags":["music"],"summary":"Get Music Genres","description":"Distinct genres (with counts); both a browse list and a typeahead.","operationId":"get_music_genres_api_music_genres_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Typeahead on genre.","title":"Search"},"description":"Typeahead on genre."},{"name":"artist","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Artist"}},{"name":"album","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Album"}},{"name":"platform_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"integer"}},{"type":"null"}],"title":"Platform Ids"}},{"name":"year","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Year"}},{"name":"min_duration","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min Duration"}},{"name":"max_duration","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max Duration"}},{"name":"order_by","in":"query","required":false,"schema":{"type":"string","description":"count or value.","default":"count","title":"Order By"},"description":"count or value."},{"name":"order_dir","in":"query","required":false,"schema":{"type":"string","default":"desc","title":"Order Dir"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":1,"description":"Page size limit","default":50,"title":"Limit"},"description":"Page size limit"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Page offset","default":0,"title":"Offset"},"description":"Page offset"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicPage_FacetValueSchema_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/music/years":{"get":{"tags":["music"],"summary":"Get Music Years","description":"Distinct years (with counts); both a browse list and a typeahead.","operationId":"get_music_years_api_music_years_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Typeahead on year.","title":"Search"},"description":"Typeahead on year."},{"name":"artist","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Artist"}},{"name":"album","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Album"}},{"name":"genre","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Genre"}},{"name":"platform_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"integer"}},{"type":"null"}],"title":"Platform Ids"}},{"name":"min_duration","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min Duration"}},{"name":"max_duration","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max Duration"}},{"name":"order_by","in":"query","required":false,"schema":{"type":"string","description":"count or value.","default":"count","title":"Order By"},"description":"count or value."},{"name":"order_dir","in":"query","required":false,"schema":{"type":"string","default":"desc","title":"Order Dir"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":1,"description":"Page size limit","default":50,"title":"Limit"},"description":"Page size limit"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Page offset","default":0,"title":"Offset"},"description":"Page offset"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicPage_FacetValueSchema_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/music/playlists":{"get":{"tags":["music"],"summary":"Get Playlists","description":"The requesting user's playlists plus other users' public playlists.","operationId":"get_playlists_api_music_playlists_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/MusicPlaylistSchema"},"type":"array","title":"Response Get Playlists Api Music Playlists Get"}}}}},"security":[{"OAuth2PasswordBearer":["playlists.read"]},{"HTTPBasic":[]}]},"post":{"tags":["music"],"summary":"Add Playlist","operationId":"add_playlist_api_music_playlists_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicPlaylistCreateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicPlaylistSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["playlists.write"]},{"HTTPBasic":[]}]}},"/api/music/playlists/{id}":{"get":{"tags":["music"],"summary":"Get Playlist","operationId":"get_playlist_api_music_playlists__id__get","security":[{"OAuth2PasswordBearer":["playlists.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Playlist internal id.","title":"Id"},"description":"Playlist internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicPlaylistSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["music"],"summary":"Update Playlist","operationId":"update_playlist_api_music_playlists__id__put","security":[{"OAuth2PasswordBearer":["playlists.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Playlist internal id.","title":"Id"},"description":"Playlist internal id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicPlaylistUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicPlaylistSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["music"],"summary":"Delete Playlist","operationId":"delete_playlist_api_music_playlists__id__delete","security":[{"OAuth2PasswordBearer":["playlists.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Playlist internal id.","title":"Id"},"description":"Playlist internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/music/playlists/{id}/tracks":{"get":{"tags":["music"],"summary":"Get Playlist Tracks","description":"Tracks of a playlist, in playlist order by default.\n\nEntries hidden from the viewer are omitted, so the page total can be lower\nthan the playlist's stored track_count.","operationId":"get_playlist_tracks_api_music_playlists__id__tracks_get","security":[{"OAuth2PasswordBearer":["playlists.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Playlist internal id.","title":"Id"},"description":"Playlist internal id."},{"name":"order_by","in":"query","required":false,"schema":{"type":"string","description":"position/title/artist/album/duration/year/platform.","default":"position","title":"Order By"},"description":"position/title/artist/album/duration/year/platform."},{"name":"order_dir","in":"query","required":false,"schema":{"type":"string","description":"asc or desc.","default":"asc","title":"Order Dir"},"description":"asc or desc."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":1,"description":"Page size limit","default":50,"title":"Limit"},"description":"Page size limit"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Page offset","default":0,"title":"Offset"},"description":"Page offset"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicPage_MusicTrackSchema_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["music"],"summary":"Add Playlist Tracks","description":"Append tracks to the playlist; tracks already present are ignored.","operationId":"add_playlist_tracks_api_music_playlists__id__tracks_post","security":[{"OAuth2PasswordBearer":["playlists.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Playlist internal id.","title":"Id"},"description":"Playlist internal id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicTrackIdsPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Add Playlist Tracks Api Music Playlists Id Tracks Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["music"],"summary":"Remove Playlist Tracks","operationId":"remove_playlist_tracks_api_music_playlists__id__tracks_delete","security":[{"OAuth2PasswordBearer":["playlists.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Playlist internal id.","title":"Id"},"description":"Playlist internal id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicTrackIdsPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Remove Playlist Tracks Api Music Playlists Id Tracks Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/music/playlists/{id}/tracks/order":{"put":{"tags":["music"],"summary":"Set Playlist Track Order","description":"Reorder the playlist to match the given rom_file_ids.\n\nEntries not covered by the payload keep their relative order after the\nlisted tracks.","operationId":"set_playlist_track_order_api_music_playlists__id__tracks_order_put","security":[{"OAuth2PasswordBearer":["playlists.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Playlist internal id.","title":"Id"},"description":"Playlist internal id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MusicTrackIdsPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/roms":{"get":{"tags":["search"],"summary":"Search Rom","description":"Search for rom in metadata providers\n\nArgs:\n request (Request): FastAPI request\n rom_id (int): Rom ID\n source (str): Source of the rom\n search_term (str, optional): Search term. Defaults to None.\n search_by (str, optional): Search by name or ID. Defaults to \"name\".\n search_extended (bool, optional): Search extended info. Defaults to False.\n\nReturns:\n list[SearchRomSchema]: List of matched roms","operationId":"search_rom_api_search_roms_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"rom_id","in":"query","required":true,"schema":{"type":"integer","title":"Rom Id"}},{"name":"search_term","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search Term"}},{"name":"search_by","in":"query","required":false,"schema":{"type":"string","default":"name","title":"Search By"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SearchRomSchema"},"title":"Response Search Rom Api Search Roms Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/search/cover":{"get":{"tags":["search"],"summary":"Search Cover","operationId":"search_cover_api_search_cover_get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"search_term","in":"query","required":false,"schema":{"type":"string","default":"","title":"Search Term"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SearchCoverSchema"},"title":"Response Search Cover Api Search Cover Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/saves":{"post":{"tags":["saves"],"summary":"Add Save","description":"Upload a save file for a ROM.","operationId":"add_save_api_saves_post","security":[{"OAuth2PasswordBearer":["assets.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"rom_id","in":"query","required":true,"schema":{"type":"integer","title":"Rom Id"}},{"name":"emulator","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emulator"}},{"name":"slot","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slot"}},{"name":"device_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Id"}},{"name":"session_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Session Id"}},{"name":"overwrite","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Overwrite"}},{"name":"autocleanup","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Autocleanup"}},{"name":"autocleanup_limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Autocleanup Limit"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_add_save_api_saves_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["saves"],"summary":"Get Saves","description":"Retrieve saves for the current user.","operationId":"get_saves_api_saves_get","security":[{"OAuth2PasswordBearer":["assets.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"rom_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rom Id"}},{"name":"platform_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Platform Id"}},{"name":"device_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Id"}},{"name":"slot","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slot"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SaveSchema"},"title":"Response Get Saves Api Saves Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/saves/identifiers":{"get":{"tags":["saves"],"summary":"Get Save Identifiers","description":"Retrieve save identifiers.","operationId":"get_save_identifiers_api_saves_identifiers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"integer"},"type":"array","title":"Response Get Save Identifiers Api Saves Identifiers Get"}}}}},"security":[{"OAuth2PasswordBearer":["assets.read"]},{"HTTPBasic":[]}]}},"/api/saves/summary":{"get":{"tags":["saves"],"summary":"Get Saves Summary","description":"Retrieve saves summary grouped by slot.","operationId":"get_saves_summary_api_saves_summary_get","security":[{"OAuth2PasswordBearer":["assets.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"rom_id","in":"query","required":true,"schema":{"type":"integer","title":"Rom Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveSummarySchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/saves/{id}":{"get":{"tags":["saves"],"summary":"Get Save","description":"Retrieve a save by ID.","operationId":"get_save_api_saves__id__get","security":[{"OAuth2PasswordBearer":["assets.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}},{"name":"device_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["saves"],"summary":"Update Save","description":"Update a save file.","operationId":"update_save_api_saves__id__put","security":[{"OAuth2PasswordBearer":["assets.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}},{"name":"device_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Id"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_update_save_api_saves__id__put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/saves/{id}/content":{"get":{"tags":["saves"],"summary":"Download Save","description":"Download a save file.","operationId":"download_save_api_saves__id__content_get","security":[{"OAuth2PasswordBearer":["assets.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}},{"name":"device_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Id"}},{"name":"session_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Session Id"}},{"name":"optimistic","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Optimistic"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/saves/{id}/downloaded":{"post":{"tags":["saves"],"summary":"Confirm Download","description":"Confirm a save was downloaded successfully.","operationId":"confirm_download_api_saves__id__downloaded_post","security":[{"OAuth2PasswordBearer":["devices.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_confirm_download_api_saves__id__downloaded_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/saves/{id}/visibility":{"put":{"tags":["saves"],"summary":"Update Save Visibility","description":"Toggle a save's public/private visibility (owner only).","operationId":"update_save_visibility_api_saves__id__visibility_put","security":[{"OAuth2PasswordBearer":["assets.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_update_save_visibility_api_saves__id__visibility_put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/saves/delete":{"post":{"tags":["saves"],"summary":"Delete Saves","description":"Delete saves.","operationId":"delete_saves_api_saves_delete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_delete_saves_api_saves_delete_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"integer"},"type":"array","title":"Response Delete Saves Api Saves Delete Post"}}}},"400":{"description":"Bad Request"},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["assets.write"]},{"HTTPBasic":[]}]}},"/api/saves/{id}/track":{"post":{"tags":["saves"],"summary":"Track Save","description":"Re-enable sync tracking for a save on a device.","operationId":"track_save_api_saves__id__track_post","security":[{"OAuth2PasswordBearer":["devices.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_track_save_api_saves__id__track_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/saves/{id}/untrack":{"post":{"tags":["saves"],"summary":"Untrack Save","description":"Disable sync tracking for a save on a device.","operationId":"untrack_save_api_saves__id__untrack_post","security":[{"OAuth2PasswordBearer":["devices.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_untrack_save_api_saves__id__untrack_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/states":{"post":{"tags":["states"],"summary":"Add State","operationId":"add_state_api_states_post","security":[{"OAuth2PasswordBearer":["assets.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"rom_id","in":"query","required":true,"schema":{"type":"integer","title":"Rom Id"}},{"name":"emulator","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emulator"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_add_state_api_states_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StateSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["states"],"summary":"Get States","operationId":"get_states_api_states_get","security":[{"OAuth2PasswordBearer":["assets.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"rom_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rom Id"}},{"name":"platform_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Platform Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/StateSchema"},"title":"Response Get States Api States Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/states/identifiers":{"get":{"tags":["states"],"summary":"Get State Identifiers","description":"Get state identifiers endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n list[int]: List of state IDs","operationId":"get_state_identifiers_api_states_identifiers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"integer"},"type":"array","title":"Response Get State Identifiers Api States Identifiers Get"}}}}},"security":[{"OAuth2PasswordBearer":["assets.read"]},{"HTTPBasic":[]}]}},"/api/states/{id}":{"get":{"tags":["states"],"summary":"Get State","operationId":"get_state_api_states__id__get","security":[{"OAuth2PasswordBearer":["assets.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StateSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["states"],"summary":"Update State","operationId":"update_state_api_states__id__put","security":[{"OAuth2PasswordBearer":["assets.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_update_state_api_states__id__put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StateSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/states/{id}/content":{"get":{"tags":["states"],"summary":"Download State","description":"Download a state file. Owner can download any of their states; everyone\nelse only public ones.","operationId":"download_state_api_states__id__content_get","security":[{"OAuth2PasswordBearer":["assets.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/states/{id}/visibility":{"put":{"tags":["states"],"summary":"Update State Visibility","description":"Toggle a state's public/private visibility (owner only).","operationId":"update_state_visibility_api_states__id__visibility_put","security":[{"OAuth2PasswordBearer":["assets.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_update_state_visibility_api_states__id__visibility_put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StateSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/states/delete":{"post":{"tags":["states"],"summary":"Delete States","description":"Delete states.","operationId":"delete_states_api_states_delete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_delete_states_api_states_delete_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"integer"},"type":"array","title":"Response Delete States Api States Delete Post"}}}},"400":{"description":"Bad Request"},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["assets.write"]},{"HTTPBasic":[]}]}},"/api/sync/negotiate":{"post":{"tags":["sync"],"summary":"Negotiate Sync","description":"Negotiate sync operations between a client device and the server.\n\nThe client sends its current save state, and the server returns a list of\noperations (upload, download, conflict, no_op) to bring both sides in sync.\n\nSaves are paired on (rom_id, slot). Clients that want a save to stay in sync\nshould send a stable, non-null slot name (e.g. \"autosave\"). Null-slot saves\nare treated as archival, manual uploads: they are excluded from pairing, so a\nnull-slot client save always negotiates as an \"upload\" even when an identical\nfile (same content_hash) already exists on the server under a slot. This is\nintentional, since saves can be cloned across slots and null slots overlap\nwith manual uploads.","operationId":"negotiate_sync_api_sync_negotiate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncNegotiatePayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncNegotiateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["assets.read","devices.read"]},{"HTTPBasic":[]}]}},"/api/sync/sessions/{session_id}/complete":{"post":{"tags":["sync"],"summary":"Complete Sync Session","description":"Mark a sync session as completed, optionally ingesting play sessions.","operationId":"complete_sync_session_api_sync_sessions__session_id__complete_post","security":[{"OAuth2PasswordBearer":["devices.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","title":"Session Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncCompletePayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncCompleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/sync/sessions":{"get":{"tags":["sync"],"summary":"Get Sync Sessions","description":"List sync sessions for the current user.","operationId":"get_sync_sessions_api_sync_sessions_get","security":[{"OAuth2PasswordBearer":["devices.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"device_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SyncSessionSchema"},"title":"Response Get Sync Sessions Api Sync Sessions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/sync/sessions/{session_id}":{"get":{"tags":["sync"],"summary":"Get Sync Session","description":"Get a specific sync session.","operationId":"get_sync_session_api_sync_sessions__session_id__get","security":[{"OAuth2PasswordBearer":["devices.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncSessionSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/sync/devices/{device_id}/push-pull":{"post":{"tags":["sync"],"summary":"Trigger Push Pull","description":"Manually trigger a push-pull sync for a specific device.","operationId":"trigger_push_pull_api_sync_devices__device_id__push_pull_post","security":[{"OAuth2PasswordBearer":["devices.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"device_id","in":"path","required":true,"schema":{"type":"string","title":"Device Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncSessionSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks":{"get":{"tags":["tasks"],"summary":"List Tasks","description":"List all available tasks grouped by task type.\n\nArgs:\n request (Request): FastAPI Request object\nReturns:\n GroupedTasksDict: Dictionary with tasks grouped by their type (scheduled, manual, watcher)","operationId":"list_tasks_api_tasks_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"items":{"$ref":"#/components/schemas/TaskInfo"},"type":"array"},"type":"object","title":"Response List Tasks Api Tasks Get"}}}}},"security":[{"OAuth2PasswordBearer":["tasks.run"]},{"HTTPBasic":[]}]}},"/api/tasks/status":{"get":{"tags":["tasks"],"summary":"Get Tasks Status","description":"Get all active, queued, completed, and failed tasks.\n\nArgs:\n request (Request): FastAPI Request object\nReturns:\n list[TaskStatusResponse]: List of all tasks with their current status","operationId":"get_tasks_status_api_tasks_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"anyOf":[{"$ref":"#/components/schemas/ScanTaskStatusResponse"},{"$ref":"#/components/schemas/ConversionTaskStatusResponse"},{"$ref":"#/components/schemas/UpdateTaskStatusResponse"},{"$ref":"#/components/schemas/CleanupTaskStatusResponse"},{"$ref":"#/components/schemas/SyncTaskStatusResponse"},{"$ref":"#/components/schemas/WatcherTaskStatusResponse"},{"$ref":"#/components/schemas/GenericTaskStatusResponse"}]},"type":"array","title":"Response Get Tasks Status Api Tasks Status Get"}}}}},"security":[{"OAuth2PasswordBearer":["tasks.run"]},{"HTTPBasic":[]}]}},"/api/tasks/{task_id}":{"get":{"tags":["tasks"],"summary":"Get Task By Id","description":"Get the status of a task by its job ID.\n\nArgs:\n request (Request): FastAPI Request object\n task_id (str): Job ID of the task to retrieve status for\nReturns:\n TaskStatusResponse: Task status information","operationId":"get_task_by_id_api_tasks__task_id__get","security":[{"OAuth2PasswordBearer":["tasks.run"]},{"HTTPBasic":[]}],"parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","title":"Task Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ScanTaskStatusResponse"},{"$ref":"#/components/schemas/ConversionTaskStatusResponse"},{"$ref":"#/components/schemas/UpdateTaskStatusResponse"},{"$ref":"#/components/schemas/CleanupTaskStatusResponse"},{"$ref":"#/components/schemas/SyncTaskStatusResponse"},{"$ref":"#/components/schemas/WatcherTaskStatusResponse"},{"$ref":"#/components/schemas/GenericTaskStatusResponse"}],"title":"Response Get Task By Id Api Tasks Task Id Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/run/{task_name}":{"post":{"tags":["tasks"],"summary":"Run Single Task","description":"Run a single task endpoint.\n\nArgs:\n request (Request): FastAPI Request object\n task_name (str): Name of the task to run\n task_kwargs (dict | None): Optional keyword arguments forwarded to the task's run() method\nReturns:\n TaskExecutionResponse: Task execution response with details","operationId":"run_single_task_api_tasks_run__task_name__post","security":[{"OAuth2PasswordBearer":["tasks.run"]},{"HTTPBasic":[]}],"parameters":[{"name":"task_name","in":"path","required":true,"schema":{"type":"string","title":"Task Name"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Task Kwargs"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskExecutionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feeds/webrcade":{"get":{"tags":["feeds"],"summary":"Platforms Webrcade Feed","description":"Get webrcade feed endpoint\nhttps://docs.webrcade.com/feeds/format/\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n WebrcadeFeedSchema: Webrcade feed object schema","operationId":"platforms_webrcade_feed_api_feeds_webrcade_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebrcadeFeedSchema"}}}}},"security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}]}},"/api/feeds/tinfoil":{"get":{"tags":["feeds"],"summary":"Tinfoil Index Feed","description":"Get tinfoil custom index feed endpoint\nhttps://blawar.github.io/tinfoil/custom_index/\n\nArgs:\n request (Request): Fastapi Request object\n slug (str, optional): Platform slug. Defaults to \"switch\".\n\nReturns:\n TinfoilFeedSchema: Tinfoil feed object schema","operationId":"tinfoil_index_feed_api_feeds_tinfoil_get","security":[{"OAuth2PasswordBearer":[]},{"HTTPBasic":[]}],"parameters":[{"name":"slug","in":"query","required":false,"schema":{"type":"string","default":"switch","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TinfoilFeedSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feeds/pkgi/ps3/{content_type}":{"get":{"tags":["feeds"],"summary":"Pkgi Ps3 Feed","description":"Get PKGi PS3 feed endpoint\nhttps://github.com/bucanero/pkgi-ps3\n\nArgs:\n request (Request): Fastapi Request object\n content_type (str): Content type (game, dlc, demo, update, patch, mod, translation, prototype)\n\nReturns:\n Response: txt file with PKGi PS3 database format","operationId":"pkgi_ps3_feed_api_feeds_pkgi_ps3__content_type__get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"content_type","in":"path","required":true,"schema":{"type":"string","description":"Content type","title":"Content Type"},"description":"Content type"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feeds/pkgi/psvita/{content_type}":{"get":{"tags":["feeds"],"summary":"Pkgi Psvita Feed","description":"Get PKGi PS Vita feed endpoint\nhttps://github.com/mmozeiko/pkgi\n\nArgs:\n request (Request): Fastapi Request object\n content_type (str): Content type (game, dlc, demo, update, patch, mod, translation, prototype)\n\nReturns:\n Response: txt file with PKGi PS Vita database format","operationId":"pkgi_psvita_feed_api_feeds_pkgi_psvita__content_type__get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"content_type","in":"path","required":true,"schema":{"type":"string","description":"Content type","title":"Content Type"},"description":"Content type"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feeds/pkgi/psp/{content_type}":{"get":{"tags":["feeds"],"summary":"Pkgi Psp Feed","description":"Get PKGi PSP feed endpoint\nhttps://github.com/bucanero/pkgi-psp\n\nArgs:\n request (Request): Fastapi Request object\n content_type (str): Content type (game, dlc, demo, update, patch, mod, translation, prototype)\n\nReturns:\n Response: txt file with PKGi PSP database format","operationId":"pkgi_psp_feed_api_feeds_pkgi_psp__content_type__get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"content_type","in":"path","required":true,"schema":{"type":"string","description":"Content type","title":"Content Type"},"description":"Content type"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feeds/fpkgi/{platform_slug}":{"get":{"tags":["feeds"],"summary":"Fpkgi Feed","description":"https://github.com/ItsJokerZz/FPKGi\n\nArgs:\n request (Request): Fastapi Request object\n platform_slug (str): Platform slug (ps4, ps5)\n content_type (str | None): Optional rom file category filter\n\nReturns:\n Response: JSON file in FPKGi format","operationId":"fpkgi_feed_api_feeds_fpkgi__platform_slug__get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"platform_slug","in":"path","required":true,"schema":{"type":"string","title":"Platform Slug"}},{"name":"content_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Only list packages of this category (game, dlc, update, patch, demo)","title":"Content Type"},"description":"Only list packages of this category (game, dlc, update, patch, demo)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feeds/kekatsu/{platform_slug}":{"get":{"tags":["feeds"],"summary":"Kekatsu Ds Feed","description":"Get Kekatsu DS feed endpoint\nhttps://github.com/cavv-dev/Kekatsu-DS\n\nArgs:\n request (Request): Fastapi Request object\n platform_slug (str): Platform slug (nds, nintendo-ds, ds, gba, etc.)\n\nReturns:\n Response: Text file with Kekatsu DS database format","operationId":"kekatsu_ds_feed_api_feeds_kekatsu__platform_slug__get","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"platform_slug","in":"path","required":true,"schema":{"type":"string","title":"Platform Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/feeds/pkgj/psp/games":{"get":{"tags":["feeds"],"summary":"Pkgj Psp Games Feed","operationId":"pkgj_psp_games_feed_api_feeds_pkgj_psp_games_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}]}},"/api/feeds/pkgj/psp/dlc":{"get":{"tags":["feeds"],"summary":"Pkgj Psp Dlcs Feed","operationId":"pkgj_psp_dlcs_feed_api_feeds_pkgj_psp_dlc_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}]}},"/api/feeds/pkgj/psvita/games":{"get":{"tags":["feeds"],"summary":"Pkgj Psv Games Feed","operationId":"pkgj_psv_games_feed_api_feeds_pkgj_psvita_games_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}]}},"/api/feeds/pkgj/psvita/dlc":{"get":{"tags":["feeds"],"summary":"Pkgj Psv Dlcs Feed","operationId":"pkgj_psv_dlcs_feed_api_feeds_pkgj_psvita_dlc_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}]}},"/api/feeds/pkgj/psx/games":{"get":{"tags":["feeds"],"summary":"Pkgj Psx Games Feed","operationId":"pkgj_psx_games_feed_api_feeds_pkgj_psx_games_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}]}},"/api/config":{"get":{"tags":["config"],"summary":"Get Config","description":"Get config endpoint\n\nReturns:\n ConfigResponse: RomM's configuration","operationId":"get_config_api_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfigResponse"}}}}}}},"/api/config/system/platforms":{"post":{"tags":["config"],"summary":"Add Platform Binding","description":"Add platform binding to the configuration","operationId":"add_platform_binding_api_config_system_platforms_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformBindingPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["platforms.write"]},{"HTTPBasic":[]}]}},"/api/config/system/platforms/{fs_slug}":{"delete":{"tags":["config"],"summary":"Delete Platform Binding","description":"Delete platform binding from the configuration","operationId":"delete_platform_binding_api_config_system_platforms__fs_slug__delete","security":[{"OAuth2PasswordBearer":["platforms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"fs_slug","in":"path","required":true,"schema":{"type":"string","title":"Fs Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/config/system/versions":{"post":{"tags":["config"],"summary":"Add Platform Version","description":"Add platform version to the configuration","operationId":"add_platform_version_api_config_system_versions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformBindingPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["platforms.write"]},{"HTTPBasic":[]}]}},"/api/config/system/versions/{fs_slug}":{"delete":{"tags":["config"],"summary":"Delete Platform Version","description":"Delete platform version from the configuration","operationId":"delete_platform_version_api_config_system_versions__fs_slug__delete","security":[{"OAuth2PasswordBearer":["platforms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"fs_slug","in":"path","required":true,"schema":{"type":"string","title":"Fs Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/config/exclude":{"post":{"tags":["config"],"summary":"Add Exclusion","description":"Add platform exclusion to the configuration","operationId":"add_exclusion_api_config_exclude_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExclusionPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["platforms.write"]},{"HTTPBasic":[]}]}},"/api/config/exclude/{exclusion_type}/{exclusion_value}":{"delete":{"tags":["config"],"summary":"Delete Exclusion","description":"Delete platform binding from the configuration","operationId":"delete_exclusion_api_config_exclude__exclusion_type___exclusion_value__delete","security":[{"OAuth2PasswordBearer":["platforms.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"exclusion_type","in":"path","required":true,"schema":{"type":"string","title":"Exclusion Type"}},{"name":"exclusion_value","in":"path","required":true,"schema":{"type":"string","title":"Exclusion Value"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/config/scan":{"put":{"tags":["config"],"summary":"Update Scan Settings","description":"Replace the scan.* section of the configuration","operationId":"update_scan_settings_api_config_scan_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScanSettingsPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["platforms.write"]},{"HTTPBasic":[]}]}},"/api/stats":{"get":{"tags":["stats"],"summary":"Stats","description":"Endpoint to return the current RomM stats\n\nReturns:\n dict: Dictionary with all the stats","operationId":"stats_api_stats_get","parameters":[{"name":"include_platform_stats","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Platform Stats"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsReturn"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/logs":{"get":{"tags":["logs"],"summary":"Get Logs","description":"Return the most recent backend log lines for backfill (admin only).\n\nArgs:\n request (Request): FastAPI Request object.\n limit (int): Maximum number of recent lines to return.\n\nReturns:\n list[LogEntrySchema]: Recent log lines, oldest-first.","operationId":"get_logs_api_logs_get","security":[{"OAuth2PasswordBearer":["logs.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":1000,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/LogEntrySchema"},"title":"Response Get Logs Api Logs Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/screenshots":{"post":{"tags":["screenshots"],"summary":"Add Screenshot","description":"Upload a per-user gallery screenshot for a ROM.\n\nStored under the user's asset folder (not the ROM folder) and flagged\n`is_gallery=True` so it surfaces in the gallery; `is_public=False` so it\nstays private until the owner shares it.","operationId":"add_screenshot_api_screenshots_post","security":[{"OAuth2PasswordBearer":["assets.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"rom_id","in":"query","required":true,"schema":{"type":"integer","title":"Rom Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_add_screenshot_api_screenshots_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreenshotSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/screenshots/{id}/content":{"get":{"tags":["screenshots"],"summary":"Download Screenshot","description":"Download a screenshot file. Owner can download any of their screenshots;\neveryone else only public ones.","operationId":"download_screenshot_api_screenshots__id__content_get","security":[{"OAuth2PasswordBearer":["assets.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Screenshot internal id.","title":"Id"},"description":"Screenshot internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/screenshots/{id}":{"put":{"tags":["screenshots"],"summary":"Update Screenshot","description":"Toggle a gallery screenshot's public/private visibility (owner only).","operationId":"update_screenshot_api_screenshots__id__put","security":[{"OAuth2PasswordBearer":["assets.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Screenshot internal id.","title":"Id"},"description":"Screenshot internal id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_update_screenshot_api_screenshots__id__put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreenshotSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["screenshots"],"summary":"Delete Screenshot","description":"Delete a gallery screenshot — its file and DB row (owner only).","operationId":"delete_screenshot_api_screenshots__id__delete","security":[{"OAuth2PasswordBearer":["assets.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Screenshot internal id.","title":"Id"},"description":"Screenshot internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/firmware":{"post":{"tags":["firmware"],"summary":"Add Firmware","description":"Upload firmware files endpoint\n\nArgs:\n request (Request): Fastapi Request object\n platform_slug (str): Slug of the platform where to upload the files\n files (list[UploadFile], optional): List of files to upload\n\nRaises:\n HTTPException\n\nReturns:\n AddFirmwareResponse: Standard message response","operationId":"add_firmware_api_firmware_post","security":[{"OAuth2PasswordBearer":["firmware.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"platform_id","in":"query","required":true,"schema":{"type":"integer","title":"Platform Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_add_firmware_api_firmware_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddFirmwareResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["firmware"],"summary":"Get Platform Firmware","description":"Get firmware endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n list[FirmwareSchema]: Firmware stored in the database","operationId":"get_platform_firmware_api_firmware_get","security":[{"OAuth2PasswordBearer":["firmware.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"platform_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Platform Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FirmwareSchema"},"title":"Response Get Platform Firmware Api Firmware Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/firmware/identifiers":{"get":{"tags":["firmware"],"summary":"Get Firmware Identifiers","description":"Get firmware identifiers endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n list[int]: List of firmware IDs","operationId":"get_firmware_identifiers_api_firmware_identifiers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"integer"},"type":"array","title":"Response Get Firmware Identifiers Api Firmware Identifiers Get"}}}}},"security":[{"OAuth2PasswordBearer":["firmware.read"]},{"HTTPBasic":[]}]}},"/api/firmware/{id}":{"get":{"tags":["firmware"],"summary":"Get Firmware","description":"Get firmware endpoint\n\nArgs:\n request (Request): Fastapi Request object\n id (int): Firmware internal id\n\nReturns:\n FirmwareSchema: Firmware stored in the database","operationId":"get_firmware_api_firmware__id__get","security":[{"OAuth2PasswordBearer":["firmware.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FirmwareSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/firmware/{id}/content/{file_name}":{"head":{"tags":["firmware"],"summary":"Head Firmware Content","description":"Head firmware content endpoint\n\nArgs:\n request (Request): Fastapi Request object\n id (int): Rom internal id\n file_name (str): Required due to a bug in emulatorjs\n\nReturns:\n FileResponse: Returns the response with headers","operationId":"head_firmware_content_api_firmware__id__content__file_name__head","security":[{"OAuth2PasswordBearer":["firmware.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}},{"name":"file_name","in":"path","required":true,"schema":{"type":"string","title":"File Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["firmware"],"summary":"Get Firmware Content","description":"Download firmware endpoint\n\nArgs:\n request (Request): Fastapi Request object\n id (int): Rom internal id\n file_name (str): Required due to a bug in emulatorjs\n\nReturns:\n FileResponse: Returns the firmware file","operationId":"get_firmware_content_api_firmware__id__content__file_name__get","security":[{"OAuth2PasswordBearer":["firmware.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}},{"name":"file_name","in":"path","required":true,"schema":{"type":"string","title":"File Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/firmware/delete":{"post":{"tags":["firmware"],"summary":"Delete Firmware","description":"Delete firmware.","operationId":"delete_firmware_api_firmware_delete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_delete_firmware_api_firmware_delete_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkOperationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["firmware.write"]},{"HTTPBasic":[]}]}},"/api/collections":{"post":{"tags":["collections"],"summary":"Add Collection","description":"Create collection endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n CollectionSchema: Just created collection","operationId":"add_collection_api_collections_post","security":[{"OAuth2PasswordBearer":["collections.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"is_public","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Public"}},{"name":"is_favorite","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Favorite"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_add_collection_api_collections_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["collections"],"summary":"Get Collections","description":"Get collections endpoint\n\nArgs:\n request (Request): Fastapi Request object\n updated_after: Filter collections updated after this datetime\n\nReturns:\n list[CollectionSchema]: List of collections","operationId":"get_collections_api_collections_get","security":[{"OAuth2PasswordBearer":["collections.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"updated_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter collections updated after this datetime (ISO 8601 format with timezone information).","title":"Updated After"},"description":"Filter collections updated after this datetime (ISO 8601 format with timezone information)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CollectionSchema"},"title":"Response Get Collections Api Collections Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/collections/smart":{"post":{"tags":["collections"],"summary":"Add Smart Collection","description":"Create smart collection endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n SmartCollectionSchema: Just created smart collection","operationId":"add_smart_collection_api_collections_smart_post","security":[{"OAuth2PasswordBearer":["collections.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"is_public","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Public"}}],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_add_smart_collection_api_collections_smart_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmartCollectionSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["collections"],"summary":"Get Smart Collections","description":"Get smart collections endpoint\n\nArgs:\n request (Request): Fastapi Request object\n updated_after: Filter smart collections updated after this datetime\n\nReturns:\n list[SmartCollectionSchema]: List of smart collections","operationId":"get_smart_collections_api_collections_smart_get","security":[{"OAuth2PasswordBearer":["collections.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"updated_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter smart collections updated after this datetime (ISO 8601 format with timezone information).","title":"Updated After"},"description":"Filter smart collections updated after this datetime (ISO 8601 format with timezone information)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SmartCollectionSchema"},"title":"Response Get Smart Collections Api Collections Smart Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/collections/identifiers":{"get":{"tags":["collections"],"summary":"Get Collection Identifiers","description":"Get collections identifiers endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n list[int]: List of collection IDs","operationId":"get_collection_identifiers_api_collections_identifiers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"integer"},"type":"array","title":"Response Get Collection Identifiers Api Collections Identifiers Get"}}}}},"security":[{"OAuth2PasswordBearer":["collections.read"]},{"HTTPBasic":[]}]}},"/api/collections/virtual":{"get":{"tags":["collections"],"summary":"Get Virtual Collections","description":"Get virtual collections endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n list[VirtualCollectionSchema]: List of virtual collections","operationId":"get_virtual_collections_api_collections_virtual_get","security":[{"OAuth2PasswordBearer":["collections.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"type","in":"query","required":true,"schema":{"type":"string","title":"Type"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/VirtualCollectionSchema"},"title":"Response Get Virtual Collections Api Collections Virtual Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/collections/virtual/identifiers":{"get":{"tags":["collections"],"summary":"Get Virtual Collection Identifiers","description":"Get virtual collections identifiers endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n list[str]: List of generated virtual collection IDs","operationId":"get_virtual_collection_identifiers_api_collections_virtual_identifiers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"string"},"type":"array","title":"Response Get Virtual Collection Identifiers Api Collections Virtual Identifiers Get"}}}}},"security":[{"OAuth2PasswordBearer":["collections.read"]},{"HTTPBasic":[]}]}},"/api/collections/smart/identifiers":{"get":{"tags":["collections"],"summary":"Get Smart Collection Identifiers","description":"Get smart collections identifiers endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n list[int]: List of smart collection IDs","operationId":"get_smart_collection_identifiers_api_collections_smart_identifiers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"integer"},"type":"array","title":"Response Get Smart Collection Identifiers Api Collections Smart Identifiers Get"}}}}},"security":[{"OAuth2PasswordBearer":["collections.read"]},{"HTTPBasic":[]}]}},"/api/collections/{id}":{"get":{"tags":["collections"],"summary":"Get Collection","description":"Get collections endpoint\n\nArgs:\n request (Request): Fastapi Request object\n id (int, optional): Collection id. Defaults to None.\n\nReturns:\n CollectionSchema: Collection","operationId":"get_collection_api_collections__id__get","security":[{"OAuth2PasswordBearer":["collections.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["collections"],"summary":"Update Collection","description":"Update collection endpoint\n\nArgs:\n request (Request): Fastapi Request object\n\nReturns:\n CollectionSchema: Updated collection","operationId":"update_collection_api_collections__id__put","security":[{"OAuth2PasswordBearer":["collections.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}},{"name":"remove_cover","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Remove Cover"}},{"name":"is_public","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Public"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_update_collection_api_collections__id__put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["collections"],"summary":"Delete Collection","description":"Delete a collection by ID.","operationId":"delete_collection_api_collections__id__delete","security":[{"OAuth2PasswordBearer":["collections.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Collection internal id.","title":"Id"},"description":"Collection internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/collections/virtual/{id}":{"get":{"tags":["collections"],"summary":"Get Virtual Collection","description":"Get virtual collections endpoint\n\nArgs:\n request (Request): Fastapi Request object\n id (str): Virtual collection id\n\nReturns:\n VirtualCollectionSchema: Virtual collection","operationId":"get_virtual_collection_api_collections_virtual__id__get","security":[{"OAuth2PasswordBearer":["collections.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VirtualCollectionSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/collections/smart/{id}":{"get":{"tags":["collections"],"summary":"Get Smart Collection","description":"Get smart collection endpoint\n\nArgs:\n request (Request): Fastapi Request object\n id (int): Smart collection id\n\nReturns:\n SmartCollectionSchema: Smart collection","operationId":"get_smart_collection_api_collections_smart__id__get","security":[{"OAuth2PasswordBearer":["collections.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmartCollectionSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["collections"],"summary":"Update Smart Collection","description":"Update smart collection endpoint\n\nArgs:\n request (Request): Fastapi Request object\n id (int): Smart collection id\n\nReturns:\n SmartCollectionSchema: Updated smart collection","operationId":"update_smart_collection_api_collections_smart__id__put","security":[{"OAuth2PasswordBearer":["collections.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}},{"name":"is_public","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Public"}}],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_update_smart_collection_api_collections_smart__id__put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmartCollectionSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["collections"],"summary":"Delete Smart Collection","description":"Delete a smart collection by ID.","operationId":"delete_smart_collection_api_collections_smart__id__delete","security":[{"OAuth2PasswordBearer":["collections.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"description":"Smart collection internal id.","title":"Id"},"description":"Smart collection internal id."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/collections/{id}/roms":{"post":{"tags":["collections"],"summary":"Add Roms To Collection","description":"Atomically add ROMs to a collection without replacing the full list.\n\nArgs:\n request (Request): Fastapi Request object\n id (int): Collection id\n payload (CollectionRomsPayload): ROM IDs to add\n\nReturns:\n CollectionSchema: Updated collection","operationId":"add_roms_to_collection_api_collections__id__roms_post","security":[{"OAuth2PasswordBearer":["collections.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionRomsPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["collections"],"summary":"Remove Roms From Collection","description":"Atomically remove ROMs from a collection without replacing the full list.\n\nArgs:\n request (Request): Fastapi Request object\n id (int): Collection id\n payload (CollectionRomsPayload): ROM IDs to remove\n\nReturns:\n CollectionSchema: Updated collection","operationId":"remove_roms_from_collection_api_collections__id__roms_delete","security":[{"OAuth2PasswordBearer":["collections.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionRomsPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/export/gamelist-xml":{"post":{"tags":["export"],"summary":"Export Gamelist Xml","description":"Export platforms/ROMs to gamelist.xml format and write to platform directories","operationId":"export_gamelist_xml_api_export_gamelist_xml_post","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"platform_ids","in":"query","required":true,"schema":{"type":"array","items":{"type":"integer"},"description":"List of platform IDs to export","title":"Platform Ids"},"description":"List of platform IDs to export"},{"name":"local_export","in":"query","required":false,"schema":{"type":"boolean","description":"Use local paths instead of URLs","default":false,"title":"Local Export"},"description":"Use local paths instead of URLs"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/export/pegasus":{"post":{"tags":["export"],"summary":"Export Pegasus","description":"Export platforms/ROMs to Pegasus metadata.pegasus.txt format and write to platform directories","operationId":"export_pegasus_api_export_pegasus_post","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"platform_ids","in":"query","required":true,"schema":{"type":"array","items":{"type":"integer"},"description":"List of platform IDs to export","title":"Platform Ids"},"description":"List of platform IDs to export"},{"name":"local_export","in":"query","required":false,"schema":{"type":"boolean","description":"Use local paths instead of URLs","default":false,"title":"Local Export"},"description":"Use local paths instead of URLs"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/netplay/list":{"get":{"tags":["netplay"],"summary":"Get Rooms","operationId":"get_rooms_api_netplay_list_get","security":[{"OAuth2PasswordBearer":["assets.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"game_id","in":"query","required":true,"schema":{"type":"string","title":"Game Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/RoomsResponse"},"title":"Response Get Rooms Api Netplay List Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/permissions/me":{"get":{"tags":["permissions"],"summary":"Get My Permissions","description":"Return the caller's effective permissions for the UI to gate on.\n\nThe backend remains the source of truth; this is a UX hint. Includes the\ngranted action keys and the platform/rom ids hidden from the caller.","operationId":"get_my_permissions_api_permissions_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionsResponse"}}}}},"security":[{"OAuth2PasswordBearer":["me.read"]},{"HTTPBasic":[]}]}},"/api/permissions/catalog":{"get":{"tags":["permissions"],"summary":"Get Permission Catalog","description":"The entity/action vocabulary the admin UI renders its matrix from.","operationId":"get_permission_catalog_api_permissions_catalog_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionCatalogSchema"}}}}},"security":[{"OAuth2PasswordBearer":["users.read"]},{"HTTPBasic":[]}]}},"/api/permissions/groups":{"get":{"tags":["permissions"],"summary":"List Permission Groups","description":"List all permission groups with their grants.","operationId":"list_permission_groups_api_permissions_groups_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/PermissionGroupSchema"},"type":"array","title":"Response List Permission Groups Api Permissions Groups Get"}}}}},"security":[{"OAuth2PasswordBearer":["users.read"]},{"HTTPBasic":[]}]},"post":{"tags":["permissions"],"summary":"Create Permission Group","description":"Create a permission group.","operationId":"create_permission_group_api_permissions_groups_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionGroupCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionGroupSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["users.write"]},{"HTTPBasic":[]}]}},"/api/permissions/groups/{id}":{"put":{"tags":["permissions"],"summary":"Update Permission Group","description":"Update a permission group (name/description/default/grants).","operationId":"update_permission_group_api_permissions_groups__id__put","security":[{"OAuth2PasswordBearer":["users.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionGroupUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionGroupSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["permissions"],"summary":"Delete Permission Group","description":"Delete a permission group. Members fall back to the default group.","operationId":"delete_permission_group_api_permissions_groups__id__delete","security":[{"OAuth2PasswordBearer":["users.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/permissions/users/{user_id}":{"get":{"tags":["permissions"],"summary":"Get User Permissions","description":"A user's group membership, per-user overrides and hidden entities.","operationId":"get_user_permissions_api_permissions_users__user_id__get","security":[{"OAuth2PasswordBearer":["users.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserPermissionsSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["permissions"],"summary":"Update User Permissions","description":"Assign a user's group and/or replace their per-user overrides.","operationId":"update_user_permissions_api_permissions_users__user_id__put","security":[{"OAuth2PasswordBearer":["users.write"]},{"HTTPBasic":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserPermissionsUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserPermissionsSchema"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/permissions/hidden":{"post":{"tags":["permissions"],"summary":"Add Hidden Entity","description":"Hide an entity from a user OR a group (exactly one principal).","operationId":"add_hidden_entity_api_permissions_hidden_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HiddenEntityCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HiddenEntitySchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["users.write"]},{"HTTPBasic":[]}]},"delete":{"tags":["permissions"],"summary":"Remove Hidden Entity","description":"Un-hide an entity for a user OR a group.","operationId":"remove_hidden_entity_api_permissions_hidden_delete","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_remove_hidden_entity_api_permissions_hidden_delete"}}},"required":true},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["users.write"]},{"HTTPBasic":[]}]}},"/api/streaming/config":{"get":{"tags":["streaming"],"summary":"Get Config","description":"Return streaming configuration to the frontend","operationId":"get_config_api_streaming_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}]}},"/api/streaming/sessions":{"get":{"tags":["streaming"],"summary":"List Sessions","description":"Admin debug view, active sessions keyed by broker URL.","operationId":"list_sessions_api_streaming_sessions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}]},"post":{"tags":["streaming"],"summary":"Claim Session","description":"Claim a streaming session and tell the broker to load the ROM.\n\nThe ROM's filesystem path is derived server-side from its database row -\nthe client only supplies a ROM id, never a path.\nReturns 404 if the ROM doesn't exist or no container serves its platform.\nReturns 409 if the container is already occupied.\nReturns 502/503 if the broker rejects the launch or is unreachable.","operationId":"claim_session_api_streaming_sessions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimSessionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}]},"delete":{"tags":["streaming"],"summary":"Force Release All","description":"Force-release all active sessions.","operationId":"force_release_all_api_streaming_sessions_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}]}},"/api/streaming/sessions/{platform}/save-and-exit":{"post":{"tags":["streaming"],"summary":"Save And Exit Session","description":"Save game state then release the session.\nwait=true (default): blocks until broker confirms save+kill complete.\nwait=false: broker fires save+kill in background, returns immediately.","operationId":"save_and_exit_session_api_streaming_sessions__platform__save_and_exit_post","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"string","title":"Platform"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveAndExitRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/streaming/sessions/{platform}/volume":{"post":{"tags":["streaming"],"summary":"Set Volume","description":"Set emulator audio volume (0-100).","operationId":"set_volume_api_streaming_sessions__platform__volume_post","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"string","title":"Platform"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VolumeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/streaming/sessions/{platform}/mute":{"post":{"tags":["streaming"],"summary":"Set Mute","description":"Toggle or explicitly set mute state. Omit body to toggle.","operationId":"set_mute_api_streaming_sessions__platform__mute_post","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"string","title":"Platform"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MuteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/streaming/sessions/{platform}/save-state":{"post":{"tags":["streaming"],"summary":"Save State","description":"Save game state to a manual slot without stopping the emulator.","operationId":"save_state_api_streaming_sessions__platform__save_state_post","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"string","title":"Platform"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveStateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/streaming/sessions/{platform}/load-state":{"post":{"tags":["streaming"],"summary":"Load State","description":"Load game state from a manual slot or the platform's autosave slot.","operationId":"load_state_api_streaming_sessions__platform__load_state_post","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"string","title":"Platform"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoadStateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/streaming/sessions/{platform}":{"delete":{"tags":["streaming"],"summary":"Release Session","description":"Release a session and tell the broker to stop the emulator.","operationId":"release_session_api_streaming_sessions__platform__delete","security":[{"OAuth2PasswordBearer":["roms.read"]},{"HTTPBasic":[]}],"parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"string","title":"Platform"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ActionKey":{"type":"string","enum":["rom.view","rom.play","rom.download","rom.upload","rom.edit","rom.delete","rom.match","rom.refresh","rom.favorite","platform.view","platform.create","platform.edit","platform.delete","collection.view","collection.create","collection.edit","collection.delete","library.scan","user.view","user.create","user.edit","user.delete","app.admin"],"title":"ActionKey"},"ActivityEntrySchema":{"properties":{"user_id":{"type":"integer","title":"User Id"},"username":{"type":"string","title":"Username"},"avatar_path":{"type":"string","title":"Avatar Path"},"rom_id":{"type":"integer","title":"Rom Id"},"rom_name":{"type":"string","title":"Rom Name"},"rom_cover_path":{"type":"string","title":"Rom Cover Path","default":""},"screenshot_path":{"type":"string","title":"Screenshot Path","default":""},"platform_slug":{"type":"string","title":"Platform Slug"},"platform_name":{"type":"string","title":"Platform Name"},"device_id":{"type":"string","title":"Device Id"},"device_type":{"type":"string","title":"Device Type"},"started_at":{"type":"string","title":"Started At"}},"type":"object","required":["user_id","username","avatar_path","rom_id","rom_name","platform_slug","platform_name","device_id","device_type","started_at"],"title":"ActivityEntrySchema"},"AddFirmwareResponse":{"properties":{"uploaded":{"type":"integer","title":"Uploaded"},"firmware":{"items":{"$ref":"#/components/schemas/FirmwareSchema"},"type":"array","title":"Firmware"}},"type":"object","required":["uploaded","firmware"],"title":"AddFirmwareResponse"},"Body_add_collection_api_collections_post":{"properties":{"artwork":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Artwork","description":"Collection artwork file."},"name":{"type":"string","title":"Name","default":""},"description":{"type":"string","title":"Description","default":""},"url_cover":{"type":"string","title":"Url Cover","description":"Remote URL to fetch and use as cover artwork.","default":""}},"type":"object","title":"Body_add_collection_api_collections_post"},"Body_add_firmware_api_firmware_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"}},"type":"object","required":["files"],"title":"Body_add_firmware_api_firmware_post"},"Body_add_platform_api_platforms_post":{"properties":{"fs_slug":{"type":"string","title":"Fs Slug","description":"Platform slug."}},"type":"object","required":["fs_slug"],"title":"Body_add_platform_api_platforms_post"},"Body_add_save_api_saves_post":{"properties":{"saveFile":{"type":"string","contentMediaType":"application/octet-stream","title":"Savefile","description":"Save file to upload."},"screenshotFile":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Screenshotfile","description":"Screenshot file associated with this save."}},"type":"object","required":["saveFile"],"title":"Body_add_save_api_saves_post"},"Body_add_screenshot_api_screenshots_post":{"properties":{"screenshotFile":{"type":"string","contentMediaType":"application/octet-stream","title":"Screenshotfile","description":"Screenshot file to upload."}},"type":"object","required":["screenshotFile"],"title":"Body_add_screenshot_api_screenshots_post"},"Body_add_smart_collection_api_collections_smart_post":{"properties":{"name":{"type":"string","title":"Name","default":""},"description":{"type":"string","title":"Description","default":""},"filter_criteria":{"type":"string","title":"Filter Criteria","description":"Smart collection filters as a JSON string.","default":"{}"}},"type":"object","title":"Body_add_smart_collection_api_collections_smart_post"},"Body_add_state_api_states_post":{"properties":{"stateFile":{"type":"string","contentMediaType":"application/octet-stream","title":"Statefile","description":"State file to upload."},"screenshotFile":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Screenshotfile","description":"Screenshot file associated with this state."}},"type":"object","required":["stateFile"],"title":"Body_add_state_api_states_post"},"Body_add_user_api_users_post":{"properties":{"username":{"type":"string","title":"Username"},"email":{"type":"string","title":"Email"},"password":{"type":"string","title":"Password"},"role":{"type":"string","title":"Role"}},"type":"object","required":["username","email","password","role"],"title":"Body_add_user_api_users_post"},"Body_confirm_download_api_saves__id__downloaded_post":{"properties":{"device_id":{"type":"string","title":"Device Id"}},"type":"object","required":["device_id"],"title":"Body_confirm_download_api_saves__id__downloaded_post"},"Body_create_user_from_invite_api_users_register_post":{"properties":{"username":{"type":"string","title":"Username"},"email":{"type":"string","title":"Email"},"password":{"type":"string","title":"Password"},"token":{"type":"string","title":"Token"}},"type":"object","required":["username","email","password","token"],"title":"Body_create_user_from_invite_api_users_register_post"},"Body_delete_firmware_api_firmware_delete_post":{"properties":{"firmware":{"items":{"type":"integer"},"type":"array","title":"Firmware","description":"List of firmware ids to delete from database."},"delete_from_fs":{"items":{"type":"integer"},"type":"array","title":"Delete From Fs","description":"List of firmware ids to delete from filesystem."}},"type":"object","required":["firmware"],"title":"Body_delete_firmware_api_firmware_delete_post"},"Body_delete_roms_api_roms_delete_post":{"properties":{"roms":{"items":{"type":"integer"},"type":"array","title":"Roms","description":"List of rom ids to delete from database."},"delete_from_fs":{"items":{"type":"integer"},"type":"array","title":"Delete From Fs","description":"List of rom ids to delete from filesystem."}},"type":"object","required":["roms"],"title":"Body_delete_roms_api_roms_delete_post"},"Body_delete_saves_api_saves_delete_post":{"properties":{"saves":{"items":{"type":"integer"},"type":"array","title":"Saves","description":"List of save ids to delete from database."}},"type":"object","required":["saves"],"title":"Body_delete_saves_api_saves_delete_post"},"Body_delete_states_api_states_delete_post":{"properties":{"states":{"items":{"type":"integer"},"type":"array","title":"States","description":"List of states ids to delete from database."}},"type":"object","required":["states"],"title":"Body_delete_states_api_states_delete_post"},"Body_patch_rom_api_roms__id__patch_post":{"properties":{"patch_file_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Patch File Id","description":"ID of a library patch file (RomFile) to apply."},"output_file_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Output File Name","description":"Custom output file name. If omitted, derived from ROM + patch names."},"patch_file":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Patch File","description":"A patch file uploaded from the client, applied without being stored in the library."}},"type":"object","title":"Body_patch_rom_api_roms__id__patch_post"},"Body_refresh_retro_achievements_api_users__id__ra_refresh_post":{"properties":{"incremental":{"type":"boolean","title":"Incremental","description":"Whether to only retrieve RetroAchievements progression incrementally.","default":false}},"type":"object","title":"Body_refresh_retro_achievements_api_users__id__ra_refresh_post"},"Body_remove_hidden_entity_api_permissions_hidden_delete":{"properties":{"entity":{"$ref":"#/components/schemas/PermEntity"},"entity_id":{"type":"integer","title":"Entity Id"},"user_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"User Id"},"group_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Group Id"}},"type":"object","required":["entity","entity_id"],"title":"Body_remove_hidden_entity_api_permissions_hidden_delete"},"Body_request_password_reset_api_forgot_password_post":{"properties":{"username":{"type":"string","title":"Username"}},"type":"object","required":["username"],"title":"Body_request_password_reset_api_forgot_password_post"},"Body_reset_password_api_reset_password_post":{"properties":{"token":{"type":"string","title":"Token"},"new_password":{"type":"string","title":"New Password"}},"type":"object","required":["token","new_password"],"title":"Body_reset_password_api_reset_password_post"},"Body_token_api_token_post":{"properties":{"grant_type":{"type":"string","title":"Grant Type","default":"password"},"scope":{"type":"string","title":"Scope","default":""},"username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Username"},"password":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Password"},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"},"client_secret":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Secret"},"refresh_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Refresh Token"}},"type":"object","title":"Body_token_api_token_post"},"Body_track_save_api_saves__id__track_post":{"properties":{"device_id":{"type":"string","title":"Device Id"}},"type":"object","required":["device_id"],"title":"Body_track_save_api_saves__id__track_post"},"Body_untrack_save_api_saves__id__untrack_post":{"properties":{"device_id":{"type":"string","title":"Device Id"}},"type":"object","required":["device_id"],"title":"Body_untrack_save_api_saves__id__untrack_post"},"Body_update_collection_api_collections__id__put":{"properties":{"artwork":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Artwork","description":"Collection artwork file."},"rom_ids":{"type":"string","title":"Rom Ids","description":"Collection ROM IDs as a JSON array string (e.g. [1,2,3])."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"url_cover":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url Cover","description":"Updated remote cover URL."}},"type":"object","required":["rom_ids"],"title":"Body_update_collection_api_collections__id__put"},"Body_update_platform_api_platforms__id__put":{"properties":{"custom_name":{"anyOf":[{"type":"string","maxLength":400},{"type":"null"}],"title":"Custom Name","description":"Custom platform name."},"description":{"anyOf":[{"type":"string","maxLength":65535},{"type":"null"}],"title":"Description","description":"Custom platform description."}},"type":"object","title":"Body_update_platform_api_platforms__id__put"},"Body_update_rom_api_roms__id__put":{"properties":{"artwork":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Artwork","description":"Custom artwork to set as cover."},"igdb_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Igdb Id"},"sgdb_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sgdb Id"},"moby_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Moby Id"},"ss_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ss Id"},"ra_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ra Id"},"launchbox_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Launchbox Id"},"hasheous_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hasheous Id"},"tgdb_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tgdb Id"},"flashpoint_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Flashpoint Id"},"hltb_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hltb Id"},"libretro_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Libretro Id"},"raw_igdb_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Raw Igdb Metadata"},"raw_moby_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Raw Moby Metadata"},"raw_ss_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Raw Ss Metadata"},"raw_launchbox_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Raw Launchbox Metadata"},"raw_hasheous_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Raw Hasheous Metadata"},"raw_flashpoint_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Raw Flashpoint Metadata"},"raw_hltb_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Raw Hltb Metadata"},"raw_manual_metadata":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Raw Manual Metadata"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"name_sort_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name Sort Key"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"fs_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fs Name"},"url_cover":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url Cover"},"url_manual":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url Manual"}},"type":"object","title":"Body_update_rom_api_roms__id__put"},"Body_update_save_api_saves__id__put":{"properties":{"saveFile":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Savefile","description":"Updated save file content."},"screenshotFile":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Screenshotfile","description":"Updated screenshot file."}},"type":"object","title":"Body_update_save_api_saves__id__put"},"Body_update_save_visibility_api_saves__id__visibility_put":{"properties":{"is_public":{"type":"boolean","title":"Is Public"}},"type":"object","required":["is_public"],"title":"Body_update_save_visibility_api_saves__id__visibility_put"},"Body_update_screenshot_api_screenshots__id__put":{"properties":{"is_public":{"type":"boolean","title":"Is Public"}},"type":"object","required":["is_public"],"title":"Body_update_screenshot_api_screenshots__id__put"},"Body_update_smart_collection_api_collections_smart__id__put":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"filter_criteria":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filter Criteria","description":"Updated smart collection filters as a JSON string."}},"type":"object","title":"Body_update_smart_collection_api_collections_smart__id__put"},"Body_update_state_api_states__id__put":{"properties":{"stateFile":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Statefile","description":"Updated state file content."},"screenshotFile":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Screenshotfile","description":"Updated screenshot file."}},"type":"object","title":"Body_update_state_api_states__id__put"},"Body_update_state_visibility_api_states__id__visibility_put":{"properties":{"is_public":{"type":"boolean","title":"Is Public"}},"type":"object","required":["is_public"],"title":"Body_update_state_visibility_api_states__id__visibility_put"},"BulkOperationResponse":{"properties":{"successful_items":{"type":"integer","title":"Successful Items"},"failed_ids":{"items":{"type":"integer"},"type":"array","title":"Failed Ids"},"errors":{"items":{"type":"string"},"type":"array","title":"Errors"}},"type":"object","required":["successful_items","failed_ids","errors"],"title":"BulkOperationResponse"},"ClaimSessionRequest":{"properties":{"rom_id":{"type":"integer","minimum":1.0,"title":"Rom Id"}},"type":"object","required":["rom_id"],"title":"ClaimSessionRequest"},"CleanupTaskMeta":{"properties":{"cleanup_stats":{"anyOf":[{"$ref":"#/components/schemas/OrphanedResourcesCleanupStats"},{"$ref":"#/components/schemas/MissingRomsCleanupStats"},{"type":"null"}],"title":"Cleanup Stats"}},"type":"object","required":["cleanup_stats"],"title":"CleanupTaskMeta"},"CleanupTaskStatusResponse":{"properties":{"task_name":{"type":"string","title":"Task Name"},"task_id":{"type":"string","title":"Task Id"},"status":{"$ref":"#/components/schemas/JobStatus"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"enqueued_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Enqueued At"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"ended_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ended At"},"task_type":{"type":"string","const":"cleanup","title":"Task Type"},"meta":{"$ref":"#/components/schemas/CleanupTaskMeta"}},"type":"object","required":["task_name","task_id","status","created_at","enqueued_at","started_at","ended_at","task_type","meta"],"title":"CleanupTaskStatusResponse"},"ClientSaveState":{"properties":{"rom_id":{"type":"integer","title":"Rom Id","description":"ID of the ROM this save belongs to."},"file_name":{"type":"string","title":"File Name","description":"Name of the save file on the client."},"slot":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slot","description":"Save slot name. Saves are paired between client and server on (rom_id, slot), so provide a stable slot name (e.g. 'autosave') to keep a save in sync across negotiations. A null slot is treated as an archival, manual-upload save: it is never paired with slotted server saves, so a null-slot client save always negotiates as an 'upload' even when an identical file already exists on the server under a slot."},"emulator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emulator","description":"Emulator that produced the save, if known."},"content_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Hash","description":"Hash of the save contents, used to detect identical saves."},"updated_at":{"type":"string","format":"date-time","title":"Updated At","description":"Last-modified timestamp of the save on the client."},"file_size_bytes":{"type":"integer","title":"File Size Bytes","description":"Size of the save file in bytes."}},"type":"object","required":["rom_id","file_name","updated_at","file_size_bytes"],"title":"ClientSaveState"},"ClientTokenAdminSchema":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"created_at":{"type":"string","title":"Created At"},"user_id":{"type":"integer","title":"User Id"},"device_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Id"},"username":{"type":"string","title":"Username"},"user_avatar_path":{"type":"string","title":"User Avatar Path"},"user_updated_at":{"type":"string","title":"User Updated At"}},"type":"object","required":["id","name","scopes","expires_at","last_used_at","created_at","user_id","username","user_avatar_path","user_updated_at"],"title":"ClientTokenAdminSchema"},"ClientTokenCreatePayload":{"properties":{"name":{"type":"string","title":"Name"},"scopes":{"items":{"type":"string"},"type":"array","minItems":1,"title":"Scopes"},"expires_in":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires In"}},"type":"object","required":["name","scopes"],"title":"ClientTokenCreatePayload"},"ClientTokenCreateSchema":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"created_at":{"type":"string","title":"Created At"},"user_id":{"type":"integer","title":"User Id"},"device_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Id"},"raw_token":{"type":"string","title":"Raw Token"}},"type":"object","required":["id","name","scopes","expires_at","last_used_at","created_at","user_id","raw_token"],"title":"ClientTokenCreateSchema"},"ClientTokenExchangePayload":{"properties":{"code":{"type":"string","title":"Code"}},"type":"object","required":["code"],"title":"ClientTokenExchangePayload"},"ClientTokenPairSchema":{"properties":{"code":{"type":"string","title":"Code"},"expires_in":{"type":"integer","title":"Expires In"}},"type":"object","required":["code","expires_in"],"title":"ClientTokenPairSchema"},"ClientTokenSchema":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"created_at":{"type":"string","title":"Created At"},"user_id":{"type":"integer","title":"User Id"},"device_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Id"}},"type":"object","required":["id","name","scopes","expires_at","last_used_at","created_at","user_id"],"title":"ClientTokenSchema"},"CollectionRomsPayload":{"properties":{"rom_ids":{"items":{"type":"integer"},"type":"array","title":"Rom Ids"}},"type":"object","required":["rom_ids"],"title":"CollectionRomsPayload"},"CollectionSchema":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"rom_ids":{"items":{"type":"integer"},"type":"array","uniqueItems":true,"title":"Rom Ids"},"rom_count":{"type":"integer","title":"Rom Count"},"path_cover_small":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Cover Small"},"path_cover_large":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Cover Large"},"path_covers_small":{"items":{"type":"string"},"type":"array","title":"Path Covers Small"},"path_covers_large":{"items":{"type":"string"},"type":"array","title":"Path Covers Large"},"is_public":{"type":"boolean","title":"Is Public","default":false},"is_favorite":{"type":"boolean","title":"Is Favorite","default":false},"is_virtual":{"type":"boolean","title":"Is Virtual","default":false},"is_smart":{"type":"boolean","title":"Is Smart","default":false},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"id":{"type":"integer","title":"Id"},"url_cover":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url Cover"},"user_id":{"type":"integer","title":"User Id"},"owner_username":{"type":"string","title":"Owner Username"}},"type":"object","required":["name","description","rom_ids","rom_count","path_cover_small","path_cover_large","path_covers_small","path_covers_large","created_at","updated_at","id","url_cover","user_id","owner_username"],"title":"CollectionSchema"},"ConfigResponse":{"properties":{"CONFIG_FILE_MOUNTED":{"type":"boolean","title":"Config File Mounted"},"CONFIG_FILE_WRITABLE":{"type":"boolean","title":"Config File Writable"},"CONFIG_FILE_PARSE_ERROR":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Config File Parse Error"},"EXCLUDED_PLATFORMS":{"items":{"type":"string"},"type":"array","title":"Excluded Platforms"},"EXCLUDED_SINGLE_EXT":{"items":{"type":"string"},"type":"array","title":"Excluded Single Ext"},"EXCLUDED_SINGLE_FILES":{"items":{"type":"string"},"type":"array","title":"Excluded Single Files"},"EXCLUDED_MULTI_FILES":{"items":{"type":"string"},"type":"array","title":"Excluded Multi Files"},"EXCLUDED_MULTI_PARTS_EXT":{"items":{"type":"string"},"type":"array","title":"Excluded Multi Parts Ext"},"EXCLUDED_MULTI_PARTS_FILES":{"items":{"type":"string"},"type":"array","title":"Excluded Multi Parts Files"},"DEFAULT_EXCLUDED_DIRS":{"items":{"type":"string"},"type":"array","title":"Default Excluded Dirs"},"DEFAULT_EXCLUDED_FILES":{"items":{"type":"string"},"type":"array","title":"Default Excluded Files"},"DEFAULT_EXCLUDED_EXTENSIONS":{"items":{"type":"string"},"type":"array","title":"Default Excluded Extensions"},"PLATFORMS_BINDING":{"additionalProperties":{"type":"string"},"type":"object","title":"Platforms Binding"},"PLATFORMS_VERSIONS":{"additionalProperties":{"type":"string"},"type":"object","title":"Platforms Versions"},"SKIP_HASH_CALCULATION":{"type":"boolean","title":"Skip Hash Calculation"},"EJS_DEBUG":{"type":"boolean","title":"Ejs Debug"},"EJS_CACHE_LIMIT":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ejs Cache Limit"},"EJS_DISABLE_AUTO_UNLOAD":{"type":"boolean","title":"Ejs Disable Auto Unload"},"EJS_DISABLE_BATCH_BOOTUP":{"type":"boolean","title":"Ejs Disable Batch Bootup"},"EJS_NETPLAY_ENABLED":{"type":"boolean","title":"Ejs Netplay Enabled"},"EJS_NETPLAY_ICE_SERVERS":{"items":{"$ref":"#/components/schemas/NetplayICEServer"},"type":"array","title":"Ejs Netplay Ice Servers"},"EJS_SETTINGS":{"additionalProperties":{"additionalProperties":{"type":"string"},"type":"object"},"type":"object","title":"Ejs Settings"},"EJS_CONTROLS":{"additionalProperties":{"$ref":"#/components/schemas/EjsControls"},"type":"object","title":"Ejs Controls"},"SCAN_METADATA_PRIORITY":{"items":{"type":"string"},"type":"array","title":"Scan Metadata Priority"},"SCAN_ARTWORK_PRIORITY":{"items":{"type":"string"},"type":"array","title":"Scan Artwork Priority"},"SCAN_ARTWORK_PRIORITY_OVERRIDES":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object","title":"Scan Artwork Priority Overrides"},"SCAN_REGION_PRIORITY":{"items":{"type":"string"},"type":"array","title":"Scan Region Priority"},"SCAN_LANGUAGE_PRIORITY":{"items":{"type":"string"},"type":"array","title":"Scan Language Priority"},"SCAN_MEDIA":{"items":{"type":"string"},"type":"array","title":"Scan Media"},"GAMELIST_AUTO_EXPORT_ON_SCAN":{"type":"boolean","title":"Gamelist Auto Export On Scan"},"GAMELIST_MEDIA_THUMBNAIL":{"$ref":"#/components/schemas/MetadataMediaType"},"GAMELIST_MEDIA_IMAGE":{"$ref":"#/components/schemas/MetadataMediaType"},"PEGASUS_AUTO_EXPORT_ON_SCAN":{"type":"boolean","title":"Pegasus Auto Export On Scan"}},"type":"object","required":["CONFIG_FILE_MOUNTED","CONFIG_FILE_WRITABLE","CONFIG_FILE_PARSE_ERROR","EXCLUDED_PLATFORMS","EXCLUDED_SINGLE_EXT","EXCLUDED_SINGLE_FILES","EXCLUDED_MULTI_FILES","EXCLUDED_MULTI_PARTS_EXT","EXCLUDED_MULTI_PARTS_FILES","DEFAULT_EXCLUDED_DIRS","DEFAULT_EXCLUDED_FILES","DEFAULT_EXCLUDED_EXTENSIONS","PLATFORMS_BINDING","PLATFORMS_VERSIONS","SKIP_HASH_CALCULATION","EJS_DEBUG","EJS_CACHE_LIMIT","EJS_DISABLE_AUTO_UNLOAD","EJS_DISABLE_BATCH_BOOTUP","EJS_NETPLAY_ENABLED","EJS_NETPLAY_ICE_SERVERS","EJS_SETTINGS","EJS_CONTROLS","SCAN_METADATA_PRIORITY","SCAN_ARTWORK_PRIORITY","SCAN_ARTWORK_PRIORITY_OVERRIDES","SCAN_REGION_PRIORITY","SCAN_LANGUAGE_PRIORITY","SCAN_MEDIA","GAMELIST_AUTO_EXPORT_ON_SCAN","GAMELIST_MEDIA_THUMBNAIL","GAMELIST_MEDIA_IMAGE","PEGASUS_AUTO_EXPORT_ON_SCAN"],"title":"ConfigResponse"},"ConversionStats":{"properties":{"processed":{"type":"integer","title":"Processed"},"errors":{"type":"integer","title":"Errors"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["processed","errors","total"],"title":"ConversionStats"},"ConversionTaskMeta":{"properties":{"conversion_stats":{"anyOf":[{"$ref":"#/components/schemas/ConversionStats"},{"type":"null"}]}},"type":"object","required":["conversion_stats"],"title":"ConversionTaskMeta"},"ConversionTaskStatusResponse":{"properties":{"task_name":{"type":"string","title":"Task Name"},"task_id":{"type":"string","title":"Task Id"},"status":{"$ref":"#/components/schemas/JobStatus"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"enqueued_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Enqueued At"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"ended_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ended At"},"task_type":{"type":"string","const":"conversion","title":"Task Type"},"meta":{"$ref":"#/components/schemas/ConversionTaskMeta"}},"type":"object","required":["task_name","task_id","status","created_at","enqueued_at","started_at","ended_at","task_type","meta"],"title":"ConversionTaskStatusResponse"},"CustomLimitOffsetPage_SimpleRomSchema_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SimpleRomSchema"},"type":"array","title":"Items"},"total":{"type":"integer","minimum":0.0,"title":"Total"},"limit":{"type":"integer","minimum":1.0,"title":"Limit"},"offset":{"type":"integer","minimum":0.0,"title":"Offset"},"char_index":{"additionalProperties":{"type":"integer"},"type":"object","title":"Char Index"},"rom_id_index":{"items":{"type":"integer"},"type":"array","title":"Rom Id Index"},"filter_values":{"$ref":"#/components/schemas/RomFiltersDict"}},"type":"object","required":["items","total","limit","offset","char_index","rom_id_index","filter_values"],"title":"CustomLimitOffsetPage[SimpleRomSchema]"},"DetailedRomSchema":{"properties":{"id":{"type":"integer","title":"Id"},"igdb_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Igdb Id"},"sgdb_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sgdb Id"},"moby_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Moby Id"},"ss_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ss Id"},"ra_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ra Id"},"launchbox_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Launchbox Id"},"hasheous_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Hasheous Id"},"tgdb_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tgdb Id"},"flashpoint_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Flashpoint Id"},"hltb_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Hltb Id"},"gamelist_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gamelist Id"},"libretro_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Libretro Id"},"platform_id":{"type":"integer","title":"Platform Id"},"platform_slug":{"type":"string","title":"Platform Slug"},"platform_fs_slug":{"type":"string","title":"Platform Fs Slug"},"platform_custom_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Platform Custom Name"},"platform_display_name":{"type":"string","title":"Platform Display Name"},"fs_name":{"type":"string","title":"Fs Name"},"fs_name_no_tags":{"type":"string","title":"Fs Name No Tags"},"fs_name_no_ext":{"type":"string","title":"Fs Name No Ext"},"fs_extension":{"type":"string","title":"Fs Extension"},"fs_path":{"type":"string","title":"Fs Path"},"fs_size_bytes":{"type":"integer","title":"Fs Size Bytes"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"name_sort_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name Sort Key"},"slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slug"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"alternative_names":{"items":{"type":"string"},"type":"array","title":"Alternative Names"},"youtube_video_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Youtube Video Id"},"metadatum":{"$ref":"#/components/schemas/RomMetadataSchema"},"igdb_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomIGDBMetadata"},{"type":"null"}]},"moby_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomMobyMetadata"},{"type":"null"}]},"ss_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomSSMetadata"},{"type":"null"}]},"launchbox_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomLaunchboxMetadata"},{"type":"null"}]},"hasheous_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomHasheousMetadata"},{"type":"null"}]},"flashpoint_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomFlashpointMetadata"},{"type":"null"}]},"hltb_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomHLTBMetadata"},{"type":"null"}]},"gamelist_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomGamelistMetadata"},{"type":"null"}]},"manual_metadata":{"anyOf":[{"$ref":"#/components/schemas/ManualMetadata"},{"type":"null"}]},"path_cover_small":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Cover Small"},"path_cover_large":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Cover Large"},"url_cover":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url Cover"},"has_manual":{"type":"boolean","title":"Has Manual"},"has_soundtrack":{"type":"boolean","title":"Has Soundtrack"},"path_manual":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Manual"},"url_manual":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url Manual"},"path_video":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Video"},"is_identifying":{"type":"boolean","title":"Is Identifying","default":false},"is_unidentified":{"type":"boolean","title":"Is Unidentified"},"is_identified":{"type":"boolean","title":"Is Identified"},"revision":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Revision"},"regions":{"items":{"type":"string"},"type":"array","title":"Regions"},"languages":{"items":{"type":"string"},"type":"array","title":"Languages"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags"},"crc_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Crc Hash"},"md5_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Md5 Hash"},"sha1_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sha1 Hash"},"ra_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ra Hash"},"has_simple_single_file":{"type":"boolean","title":"Has Simple Single File"},"has_nested_single_file":{"type":"boolean","title":"Has Nested Single File"},"has_multiple_files":{"type":"boolean","title":"Has Multiple Files"},"full_path":{"type":"string","title":"Full Path"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"missing_from_fs":{"type":"boolean","title":"Missing From Fs"},"has_notes":{"type":"boolean","title":"Has Notes"},"rom_user":{"$ref":"#/components/schemas/RomUserSchema"},"merged_screenshots":{"items":{"type":"string"},"type":"array","title":"Merged Screenshots"},"merged_ra_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomRAMetadata"},{"type":"null"}]},"files":{"items":{"$ref":"#/components/schemas/RomFileSchema"},"type":"array","title":"Files"},"sibling_roms":{"items":{"$ref":"#/components/schemas/SiblingRomSchema"},"type":"array","title":"Sibling Roms"},"user_saves":{"items":{"$ref":"#/components/schemas/SaveSchema"},"type":"array","title":"User Saves"},"user_states":{"items":{"$ref":"#/components/schemas/StateSchema"},"type":"array","title":"User States"},"all_user_saves":{"items":{"$ref":"#/components/schemas/UserSaveSchema"},"type":"array","title":"All User Saves"},"all_user_states":{"items":{"$ref":"#/components/schemas/UserStateSchema"},"type":"array","title":"All User States"},"user_screenshots":{"items":{"$ref":"#/components/schemas/ScreenshotSchema"},"type":"array","title":"User Screenshots"},"all_user_screenshots":{"items":{"$ref":"#/components/schemas/UserScreenshotSchema"},"type":"array","title":"All User Screenshots"},"user_collections":{"items":{"$ref":"#/components/schemas/UserCollectionSchema"},"type":"array","title":"User Collections"},"all_user_notes":{"items":{"$ref":"#/components/schemas/UserNoteSchema"},"type":"array","title":"All User Notes"}},"type":"object","required":["id","igdb_id","sgdb_id","moby_id","ss_id","ra_id","launchbox_id","hasheous_id","tgdb_id","flashpoint_id","hltb_id","gamelist_id","libretro_id","platform_id","platform_slug","platform_fs_slug","platform_custom_name","platform_display_name","fs_name","fs_name_no_tags","fs_name_no_ext","fs_extension","fs_path","fs_size_bytes","name","name_sort_key","slug","summary","alternative_names","youtube_video_id","metadatum","igdb_metadata","moby_metadata","ss_metadata","launchbox_metadata","hasheous_metadata","flashpoint_metadata","hltb_metadata","gamelist_metadata","manual_metadata","path_cover_small","path_cover_large","url_cover","has_manual","has_soundtrack","path_manual","url_manual","path_video","is_unidentified","is_identified","revision","regions","languages","tags","crc_hash","md5_hash","sha1_hash","ra_hash","has_simple_single_file","has_nested_single_file","has_multiple_files","full_path","created_at","updated_at","missing_from_fs","has_notes","rom_user","merged_screenshots","merged_ra_metadata","files","sibling_roms","user_saves","user_states","all_user_saves","all_user_states","user_screenshots","all_user_screenshots","user_collections","all_user_notes"],"title":"DetailedRomSchema"},"DeviceAuthApprovePayload":{"properties":{"user_code":{"type":"string","maxLength":32,"minLength":1,"title":"User Code"},"approved_scopes":{"items":{"type":"string"},"type":"array","minItems":1,"title":"Approved Scopes"},"device_name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Device Name"},"expires_in":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires In"}},"type":"object","required":["user_code","approved_scopes"],"title":"DeviceAuthApprovePayload"},"DeviceAuthApproveResponse":{"properties":{"device_id":{"type":"string","title":"Device Id"},"device_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Name"}},"type":"object","required":["device_id","device_name"],"title":"DeviceAuthApproveResponse"},"DeviceAuthDenyPayload":{"properties":{"user_code":{"type":"string","maxLength":32,"minLength":1,"title":"User Code"}},"type":"object","required":["user_code"],"title":"DeviceAuthDenyPayload"},"DeviceAuthInitPayload":{"properties":{"client_device_identifier":{"type":"string","maxLength":255,"minLength":1,"title":"Client Device Identifier"},"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"client":{"type":"string","maxLength":50,"minLength":1,"title":"Client"},"platform":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Platform"},"client_version":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Client Version"},"requested_scopes":{"items":{"type":"string"},"type":"array","maxItems":22,"minItems":1,"title":"Requested Scopes"}},"type":"object","required":["client_device_identifier","name","client","requested_scopes"],"title":"DeviceAuthInitPayload"},"DeviceAuthInitResponse":{"properties":{"device_code":{"type":"string","title":"Device Code"},"user_code":{"type":"string","title":"User Code"},"verification_path":{"type":"string","title":"Verification Path","description":"Relative web-UI path (/pair/device). The client joins it with the origin it was configured to reach; the server is origin-agnostic."},"verification_path_complete":{"type":"string","title":"Verification Path Complete","description":"Same path with ?user_code= appended, for QR display."},"expires_in":{"type":"integer","title":"Expires In"},"interval":{"type":"integer","title":"Interval"}},"type":"object","required":["device_code","user_code","verification_path","verification_path_complete","expires_in","interval"],"title":"DeviceAuthInitResponse"},"DeviceAuthPendingSchema":{"properties":{"client_device_identifier":{"type":"string","title":"Client Device Identifier"},"name":{"type":"string","title":"Name"},"client":{"type":"string","title":"Client"},"platform":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Platform"},"client_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Version"},"requested_scopes":{"items":{"type":"string"},"type":"array","title":"Requested Scopes"},"allowed_scopes":{"items":{"type":"string"},"type":"array","title":"Allowed Scopes"},"expires_at":{"type":"string","title":"Expires At"}},"type":"object","required":["client_device_identifier","name","client","platform","client_version","requested_scopes","allowed_scopes","expires_at"],"title":"DeviceAuthPendingSchema"},"DeviceAuthTokenPayload":{"properties":{"device_code":{"type":"string","maxLength":128,"minLength":1,"title":"Device Code"}},"type":"object","required":["device_code"],"title":"DeviceAuthTokenPayload"},"DeviceAuthTokenResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"device_id":{"type":"string","title":"Device Id"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["access_token","device_id","scopes","expires_at"],"title":"DeviceAuthTokenResponse"},"DeviceCreatePayload":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"platform":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Platform"},"client":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client"},"client_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Version"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"},"mac_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mac Address"},"hostname":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hostname"},"sync_mode":{"anyOf":[{"$ref":"#/components/schemas/SyncMode"},{"type":"null"}]},"sync_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Sync Config"},"allow_existing":{"type":"boolean","title":"Allow Existing","default":true},"allow_duplicate":{"type":"boolean","title":"Allow Duplicate","default":false},"reset_syncs":{"type":"boolean","title":"Reset Syncs","default":false}},"type":"object","title":"DeviceCreatePayload"},"DeviceCreateResponse":{"properties":{"device_id":{"type":"string","title":"Device Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["device_id","name","created_at"],"title":"DeviceCreateResponse"},"DeviceHeartbeatPayload":{"properties":{"rom_id":{"type":"integer","minimum":1.0,"title":"Rom Id"},"device_id":{"type":"string","maxLength":255,"minLength":1,"title":"Device Id"}},"type":"object","required":["rom_id","device_id"],"title":"DeviceHeartbeatPayload"},"DeviceSchema":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"integer","title":"User Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"platform":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Platform"},"client":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client"},"client_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Version"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"},"mac_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mac Address"},"hostname":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hostname"},"client_device_identifier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Device Identifier"},"sync_mode":{"$ref":"#/components/schemas/SyncMode"},"sync_enabled":{"type":"boolean","title":"Sync Enabled"},"sync_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Sync Config"},"last_seen":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Seen"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","user_id","name","platform","client","client_version","ip_address","mac_address","hostname","client_device_identifier","sync_mode","sync_enabled","sync_config","last_seen","created_at","updated_at"],"title":"DeviceSchema"},"DeviceSyncSchema":{"properties":{"device_id":{"type":"string","title":"Device Id"},"device_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Name"},"last_synced_at":{"type":"string","title":"Last Synced At"},"is_untracked":{"type":"boolean","title":"Is Untracked"},"is_current":{"type":"boolean","title":"Is Current"}},"type":"object","required":["device_id","device_name","last_synced_at","is_untracked","is_current"],"title":"DeviceSyncSchema"},"DeviceUpdatePayload":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"platform":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Platform"},"client":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client"},"client_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Version"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"},"mac_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mac Address"},"hostname":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hostname"},"sync_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Sync Enabled"},"sync_mode":{"anyOf":[{"$ref":"#/components/schemas/SyncMode"},{"type":"null"}]},"sync_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Sync Config"}},"type":"object","title":"DeviceUpdatePayload"},"EarnedAchievement":{"properties":{"id":{"type":"string","title":"Id"},"date":{"type":"string","title":"Date"},"date_hardcore":{"type":"string","title":"Date Hardcore"}},"type":"object","required":["id","date"],"title":"EarnedAchievement"},"EjsControls":{"properties":{"_0":{"additionalProperties":{"$ref":"#/components/schemas/EjsControlsButton"},"type":"object","title":"0"},"_1":{"additionalProperties":{"$ref":"#/components/schemas/EjsControlsButton"},"type":"object","title":"1"},"_2":{"additionalProperties":{"$ref":"#/components/schemas/EjsControlsButton"},"type":"object","title":"2"},"_3":{"additionalProperties":{"$ref":"#/components/schemas/EjsControlsButton"},"type":"object","title":"3"}},"type":"object","required":["_0","_1","_2","_3"],"title":"EjsControls"},"EjsControlsButton":{"properties":{"value":{"type":"string","title":"Value"},"value2":{"type":"string","title":"Value2"}},"type":"object","title":"EjsControlsButton"},"EmulationDict":{"properties":{"DISABLE_EMULATOR_JS":{"type":"boolean","title":"Disable Emulator Js"},"DISABLE_RUFFLE_RS":{"type":"boolean","title":"Disable Ruffle Rs"}},"type":"object","required":["DISABLE_EMULATOR_JS","DISABLE_RUFFLE_RS"],"title":"EmulationDict"},"ExclusionPayload":{"properties":{"exclusion_value":{"type":"string","title":"Exclusion Value"},"exclusion_type":{"type":"string","title":"Exclusion Type"}},"type":"object","required":["exclusion_value","exclusion_type"],"title":"ExclusionPayload"},"FacetValueSchema":{"properties":{"value":{"anyOf":[{"type":"string"},{"type":"integer"}],"title":"Value"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["value","count"],"title":"FacetValueSchema","description":"A distinct value of a track field plus how many tracks carry it."},"FilesystemDict":{"properties":{"FS_PLATFORMS":{"items":{"type":"string"},"type":"array","title":"Fs Platforms"}},"type":"object","required":["FS_PLATFORMS"],"title":"FilesystemDict"},"FirmwareSchema":{"properties":{"id":{"type":"integer","title":"Id"},"file_name":{"type":"string","title":"File Name"},"file_name_no_tags":{"type":"string","title":"File Name No Tags"},"file_name_no_ext":{"type":"string","title":"File Name No Ext"},"file_extension":{"type":"string","title":"File Extension"},"file_path":{"type":"string","title":"File Path"},"file_size_bytes":{"type":"integer","title":"File Size Bytes"},"full_path":{"type":"string","title":"Full Path"},"is_verified":{"type":"boolean","title":"Is Verified"},"crc_hash":{"type":"string","title":"Crc Hash"},"md5_hash":{"type":"string","title":"Md5 Hash"},"sha1_hash":{"type":"string","title":"Sha1 Hash"},"missing_from_fs":{"type":"boolean","title":"Missing From Fs"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","file_name","file_name_no_tags","file_name_no_ext","file_extension","file_path","file_size_bytes","full_path","is_verified","crc_hash","md5_hash","sha1_hash","missing_from_fs","created_at","updated_at"],"title":"FirmwareSchema"},"FrontendDict":{"properties":{"DISABLE_USERPASS_LOGIN":{"type":"boolean","title":"Disable Userpass Login"},"DISABLE_LOGS_VIEWER":{"type":"boolean","title":"Disable Logs Viewer"},"YOUTUBE_BASE_URL":{"type":"string","title":"Youtube Base Url"}},"type":"object","required":["DISABLE_USERPASS_LOGIN","DISABLE_LOGS_VIEWER","YOUTUBE_BASE_URL"],"title":"FrontendDict"},"GenericTaskMeta":{"properties":{},"type":"object","title":"GenericTaskMeta"},"GenericTaskStatusResponse":{"properties":{"task_name":{"type":"string","title":"Task Name"},"task_id":{"type":"string","title":"Task Id"},"status":{"$ref":"#/components/schemas/JobStatus"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"enqueued_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Enqueued At"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"ended_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ended At"},"task_type":{"type":"string","const":"generic","title":"Task Type"},"meta":{"$ref":"#/components/schemas/GenericTaskMeta"}},"type":"object","required":["task_name","task_id","status","created_at","enqueued_at","started_at","ended_at","task_type","meta"],"title":"GenericTaskStatusResponse"},"GrantSchema":{"properties":{"action":{"$ref":"#/components/schemas/ActionKey"},"scope":{"$ref":"#/components/schemas/PermissionScopeSchema"}},"type":"object","required":["action","scope"],"title":"GrantSchema"},"GrantSchemaIO":{"properties":{"entity":{"$ref":"#/components/schemas/PermEntity"},"action":{"$ref":"#/components/schemas/PermAction"},"own_only":{"type":"boolean","title":"Own Only","default":false}},"type":"object","required":["entity","action"],"title":"GrantSchemaIO","description":"A single (entity, action) grant on a group, with the own-only flag."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HeartbeatResponse":{"properties":{"SYSTEM":{"$ref":"#/components/schemas/SystemDict"},"METADATA_SOURCES":{"$ref":"#/components/schemas/MetadataSourcesDict"},"FILESYSTEM":{"$ref":"#/components/schemas/FilesystemDict"},"EMULATION":{"$ref":"#/components/schemas/EmulationDict"},"FRONTEND":{"$ref":"#/components/schemas/FrontendDict"},"OIDC":{"$ref":"#/components/schemas/OIDCDict"},"TASKS":{"$ref":"#/components/schemas/TasksDict"}},"type":"object","required":["SYSTEM","METADATA_SOURCES","FILESYSTEM","EMULATION","FRONTEND","OIDC","TASKS"],"title":"HeartbeatResponse"},"HiddenEntitiesSchema":{"properties":{"platforms":{"items":{"type":"integer"},"type":"array","title":"Platforms"},"roms":{"items":{"type":"integer"},"type":"array","title":"Roms"}},"type":"object","required":["platforms","roms"],"title":"HiddenEntitiesSchema"},"HiddenEntityCreate":{"properties":{"entity":{"$ref":"#/components/schemas/PermEntity"},"entity_id":{"type":"integer","title":"Entity Id"},"user_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"User Id"},"group_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Group Id"}},"type":"object","required":["entity","entity_id"],"title":"HiddenEntityCreate"},"HiddenEntitySchema":{"properties":{"entity":{"$ref":"#/components/schemas/PermEntity"},"entity_id":{"type":"integer","title":"Entity Id"}},"type":"object","required":["entity","entity_id"],"title":"HiddenEntitySchema"},"IGDBAgeRating":{"properties":{"rating":{"type":"string","title":"Rating"},"category":{"type":"string","title":"Category"},"rating_cover_url":{"type":"string","title":"Rating Cover Url"}},"type":"object","required":["rating","category","rating_cover_url"],"title":"IGDBAgeRating"},"IGDBMetadataMultiplayerMode":{"properties":{"campaigncoop":{"type":"boolean","title":"Campaigncoop"},"dropin":{"type":"boolean","title":"Dropin"},"lancoop":{"type":"boolean","title":"Lancoop"},"offlinecoop":{"type":"boolean","title":"Offlinecoop"},"offlinecoopmax":{"type":"integer","title":"Offlinecoopmax"},"offlinemax":{"type":"integer","title":"Offlinemax"},"onlinecoop":{"type":"integer","title":"Onlinecoop"},"onlinecoopmax":{"type":"integer","title":"Onlinecoopmax"},"onlinemax":{"type":"integer","title":"Onlinemax"},"splitscreen":{"type":"boolean","title":"Splitscreen"},"splitscreenonline":{"type":"boolean","title":"Splitscreenonline"},"platform":{"$ref":"#/components/schemas/IGDBMetadataPlatform"}},"type":"object","required":["campaigncoop","dropin","lancoop","offlinecoop","offlinecoopmax","offlinemax","onlinecoop","onlinecoopmax","onlinemax","splitscreen","splitscreenonline","platform"],"title":"IGDBMetadataMultiplayerMode"},"IGDBMetadataPlatform":{"properties":{"igdb_id":{"type":"integer","title":"Igdb Id"},"name":{"type":"string","title":"Name"}},"type":"object","required":["igdb_id","name"],"title":"IGDBMetadataPlatform"},"IGDBRelatedGame":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"slug":{"type":"string","title":"Slug"},"type":{"type":"string","title":"Type"},"cover_url":{"type":"string","title":"Cover Url"}},"type":"object","required":["id","name","slug","type","cover_url"],"title":"IGDBRelatedGame"},"InviteLinkSchema":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"InviteLinkSchema"},"JobStatus":{"type":"string","enum":["created","queued","finished","failed","started","deferred","scheduled","stopped","canceled"],"title":"JobStatus","description":"The Status of Job within its lifecycle at any given time."},"LaunchboxImage":{"properties":{"url":{"type":"string","title":"Url"},"type":{"type":"string","title":"Type"},"region":{"type":"string","title":"Region"}},"type":"object","required":["url"],"title":"LaunchboxImage"},"LoadStateRequest":{"properties":{"slot":{"type":"integer","maximum":10.0,"minimum":1.0,"title":"Slot","default":1}},"type":"object","title":"LoadStateRequest"},"LogEntrySchema":{"properties":{"ts":{"type":"integer","title":"Ts"},"level":{"type":"string","title":"Level"},"module":{"type":"string","title":"Module"},"message":{"type":"string","title":"Message"}},"type":"object","required":["ts","level","module","message"],"title":"LogEntrySchema","description":"A single backend log line streamed to the admin log viewer."},"ManualMetadata":{"properties":{"genres":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Genres"},"franchises":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Franchises"},"companies":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Companies"},"game_modes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Game Modes"},"age_ratings":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Age Ratings"},"first_release_date":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"First Release Date"},"youtube_video_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Youtube Video Id"}},"type":"object","title":"ManualMetadata"},"MetadataCoverageItem":{"properties":{"source":{"type":"string","title":"Source"},"matched":{"type":"integer","title":"Matched"}},"type":"object","required":["source","matched"],"title":"MetadataCoverageItem"},"MetadataMediaType":{"type":"string","enum":["bezel","box2d","box2d_back","box2d_side","box3d","miximage","miximage_v2","physical","screenshot","title_screen","marquee","logo","fanart","video","video_normalized","manual"],"title":"MetadataMediaType"},"MetadataSourcesDict":{"properties":{"ANY_SOURCE_ENABLED":{"type":"boolean","title":"Any Source Enabled"},"IGDB_API_ENABLED":{"type":"boolean","title":"Igdb Api Enabled"},"SS_API_ENABLED":{"type":"boolean","title":"Ss Api Enabled"},"MOBY_API_ENABLED":{"type":"boolean","title":"Moby Api Enabled"},"STEAMGRIDDB_API_ENABLED":{"type":"boolean","title":"Steamgriddb Api Enabled"},"RA_API_ENABLED":{"type":"boolean","title":"Ra Api Enabled"},"LAUNCHBOX_API_ENABLED":{"type":"boolean","title":"Launchbox Api Enabled"},"HASHEOUS_API_ENABLED":{"type":"boolean","title":"Hasheous Api Enabled"},"PLAYMATCH_API_ENABLED":{"type":"boolean","title":"Playmatch Api Enabled"},"TGDB_API_ENABLED":{"type":"boolean","title":"Tgdb Api Enabled"},"FLASHPOINT_API_ENABLED":{"type":"boolean","title":"Flashpoint Api Enabled"},"HLTB_API_ENABLED":{"type":"boolean","title":"Hltb Api Enabled"},"LIBRETRO_API_ENABLED":{"type":"boolean","title":"Libretro Api Enabled"}},"type":"object","required":["ANY_SOURCE_ENABLED","IGDB_API_ENABLED","SS_API_ENABLED","MOBY_API_ENABLED","STEAMGRIDDB_API_ENABLED","RA_API_ENABLED","LAUNCHBOX_API_ENABLED","HASHEOUS_API_ENABLED","PLAYMATCH_API_ENABLED","TGDB_API_ENABLED","FLASHPOINT_API_ENABLED","HLTB_API_ENABLED","LIBRETRO_API_ENABLED"],"title":"MetadataSourcesDict"},"MissingRomsCleanupStats":{"properties":{"platform_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Platform Id"},"roms_found":{"type":"integer","title":"Roms Found"},"roms_deleted":{"type":"integer","title":"Roms Deleted"},"errors":{"type":"integer","title":"Errors"}},"type":"object","required":["platform_id","roms_found","roms_deleted","errors"],"title":"MissingRomsCleanupStats"},"MobyMetadataPlatform":{"properties":{"moby_id":{"type":"integer","title":"Moby Id"},"name":{"type":"string","title":"Name"}},"type":"object","required":["moby_id","name"],"title":"MobyMetadataPlatform"},"MusicPage_FacetValueSchema_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/FacetValueSchema"},"type":"array","title":"Items"},"total":{"type":"integer","minimum":0.0,"title":"Total"},"limit":{"type":"integer","minimum":1.0,"title":"Limit"},"offset":{"type":"integer","minimum":0.0,"title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"MusicPage[FacetValueSchema]"},"MusicPage_MusicTrackSchema_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/MusicTrackSchema"},"type":"array","title":"Items"},"total":{"type":"integer","minimum":0.0,"title":"Total"},"limit":{"type":"integer","minimum":1.0,"title":"Limit"},"offset":{"type":"integer","minimum":0.0,"title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"MusicPage[MusicTrackSchema]"},"MusicPlaylistCreateRequest":{"properties":{"name":{"type":"string","maxLength":400,"minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":65535},{"type":"null"}],"title":"Description"},"is_public":{"type":"boolean","title":"Is Public","default":false}},"type":"object","required":["name"],"title":"MusicPlaylistCreateRequest"},"MusicPlaylistSchema":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"is_public":{"type":"boolean","title":"Is Public","default":false},"user_id":{"type":"integer","title":"User Id"},"owner_username":{"type":"string","title":"Owner Username"},"track_count":{"type":"integer","title":"Track Count","default":0},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","name","user_id","owner_username","created_at","updated_at"],"title":"MusicPlaylistSchema"},"MusicPlaylistUpdateRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":400,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":65535},{"type":"null"}],"title":"Description"},"is_public":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Public"}},"type":"object","title":"MusicPlaylistUpdateRequest"},"MusicTrackIdsPayload":{"properties":{"rom_file_ids":{"items":{"type":"integer"},"type":"array","title":"Rom File Ids"}},"type":"object","required":["rom_file_ids"],"title":"MusicTrackIdsPayload"},"MusicTrackSchema":{"properties":{"rom_file_id":{"type":"integer","title":"Rom File Id"},"rom_id":{"type":"integer","title":"Rom Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"artist":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Artist"},"album":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Album"},"genre":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Genre"},"year":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Year"},"track":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Track"},"disc":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Disc"},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration Seconds"},"has_embedded_cover":{"type":"boolean","title":"Has Embedded Cover","default":false},"is_favorite":{"type":"boolean","title":"Is Favorite","default":false},"game_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Game Name"},"platform_id":{"type":"integer","title":"Platform Id"},"platform_slug":{"type":"string","title":"Platform Slug"},"platform_name":{"type":"string","title":"Platform Name"},"stream_url":{"type":"string","title":"Stream Url"},"cover_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cover Url"}},"type":"object","required":["rom_file_id","rom_id","platform_id","platform_slug","platform_name","stream_url"],"title":"MusicTrackSchema"},"MuteRequest":{"properties":{"mute":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Mute"}},"type":"object","title":"MuteRequest"},"NetplayICEServer":{"properties":{"urls":{"type":"string","title":"Urls"},"username":{"type":"string","title":"Username"},"credential":{"type":"string","title":"Credential"}},"type":"object","required":["urls"],"title":"NetplayICEServer"},"OIDCDict":{"properties":{"ENABLED":{"type":"boolean","title":"Enabled"},"AUTOLOGIN":{"type":"boolean","title":"Autologin"},"PROVIDER":{"type":"string","title":"Provider"},"RP_INITIATED_LOGOUT":{"type":"boolean","title":"Rp Initiated Logout"}},"type":"object","required":["ENABLED","AUTOLOGIN","PROVIDER","RP_INITIATED_LOGOUT"],"title":"OIDCDict"},"OIDCLogoutResponse":{"properties":{"oidc_logout_url":{"type":"string","title":"Oidc Logout Url"}},"type":"object","required":["oidc_logout_url"],"title":"OIDCLogoutResponse"},"OrphanedResourcesCleanupStats":{"properties":{"platforms_in_db":{"type":"integer","title":"Platforms In Db"},"roms_in_db":{"type":"integer","title":"Roms In Db"},"platforms_in_fs":{"type":"integer","title":"Platforms In Fs"},"roms_in_fs":{"type":"integer","title":"Roms In Fs"},"removed_fs_platforms":{"type":"integer","title":"Removed Fs Platforms"},"removed_fs_roms":{"type":"integer","title":"Removed Fs Roms"}},"type":"object","required":["platforms_in_db","roms_in_db","platforms_in_fs","roms_in_fs","removed_fs_platforms","removed_fs_roms"],"title":"OrphanedResourcesCleanupStats"},"OverrideSchemaIO":{"properties":{"entity":{"$ref":"#/components/schemas/PermEntity"},"action":{"$ref":"#/components/schemas/PermAction"},"granted":{"type":"boolean","title":"Granted"},"own_only":{"type":"boolean","title":"Own Only","default":false}},"type":"object","required":["entity","action","granted"],"title":"OverrideSchemaIO"},"PermAction":{"type":"string","enum":["read","write","delete"],"title":"PermAction"},"PermEntity":{"type":"string","enum":["platforms","roms","collections","playlists","firmware","assets","devices","users","tasks","logs"],"title":"PermEntity","description":"Entity-type vocabulary for granular permissions.\n\nMirrors the coarse scope domains (see ``handler/auth/constants.py``) so the\ngrant matrix can be projected back onto the legacy ``Scope`` set without\ndrift (see ``handler/auth/permissions_map.py``)."},"PermissionCatalogSchema":{"properties":{"entities":{"items":{"$ref":"#/components/schemas/PermEntity"},"type":"array","title":"Entities"},"actions":{"items":{"$ref":"#/components/schemas/PermAction"},"type":"array","title":"Actions"}},"type":"object","required":["entities","actions"],"title":"PermissionCatalogSchema","description":"The vocabulary the admin UI renders the group/override matrix from."},"PermissionGroupCreate":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description","default":""},"is_default":{"type":"boolean","title":"Is Default","default":false},"color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color"},"grants":{"items":{"$ref":"#/components/schemas/GrantSchemaIO"},"type":"array","title":"Grants","default":[]}},"type":"object","required":["name"],"title":"PermissionGroupCreate"},"PermissionGroupSchema":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"is_default":{"type":"boolean","title":"Is Default"},"is_system":{"type":"boolean","title":"Is System"},"color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color"},"grants":{"items":{"$ref":"#/components/schemas/GrantSchemaIO"},"type":"array","title":"Grants"},"member_count":{"type":"integer","title":"Member Count"},"hidden":{"items":{"$ref":"#/components/schemas/HiddenEntitySchema"},"type":"array","title":"Hidden","default":[]}},"type":"object","required":["id","name","description","is_default","is_system","color","grants","member_count"],"title":"PermissionGroupSchema"},"PermissionGroupUpdate":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"is_default":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Default"},"color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color"},"grants":{"anyOf":[{"items":{"$ref":"#/components/schemas/GrantSchemaIO"},"type":"array"},{"type":"null"}],"title":"Grants"}},"type":"object","title":"PermissionGroupUpdate"},"PermissionScopeSchema":{"properties":{"kind":{"type":"string","enum":["global","platform","collection","rom"],"title":"Kind","default":"global"},"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"}},"type":"object","title":"PermissionScopeSchema"},"PermissionsResponse":{"properties":{"is_admin":{"type":"boolean","title":"Is Admin"},"grants":{"items":{"$ref":"#/components/schemas/GrantSchema"},"type":"array","title":"Grants"},"hidden":{"$ref":"#/components/schemas/HiddenEntitiesSchema"}},"type":"object","required":["is_admin","grants","hidden"],"title":"PermissionsResponse"},"PlatformBindingPayload":{"properties":{"fs_slug":{"type":"string","title":"Fs Slug"},"slug":{"type":"string","title":"Slug"}},"type":"object","required":["fs_slug","slug"],"title":"PlatformBindingPayload"},"PlatformSchema":{"properties":{"id":{"type":"integer","title":"Id"},"slug":{"type":"string","title":"Slug"},"fs_slug":{"type":"string","title":"Fs Slug"},"rom_count":{"type":"integer","title":"Rom Count"},"name":{"type":"string","title":"Name"},"igdb_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Igdb Slug"},"moby_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Moby Slug"},"hltb_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hltb Slug"},"libretro_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Libretro Slug"},"custom_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"igdb_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Igdb Id"},"sgdb_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sgdb Id"},"moby_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Moby Id"},"launchbox_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Launchbox Id"},"ss_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ss Id"},"ra_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ra Id"},"hasheous_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Hasheous Id"},"tgdb_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tgdb Id"},"flashpoint_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Flashpoint Id"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"generation":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Generation"},"family_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Family Name"},"family_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Family Slug"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"url_logo":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url Logo"},"firmware":{"items":{"$ref":"#/components/schemas/FirmwareSchema"},"type":"array","title":"Firmware"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"fs_size_bytes":{"type":"integer","title":"Fs Size Bytes"},"is_unidentified":{"type":"boolean","title":"Is Unidentified"},"is_identified":{"type":"boolean","title":"Is Identified"},"missing_from_fs":{"type":"boolean","title":"Missing From Fs"},"display_name":{"type":"string","title":"Display Name","readOnly":true},"firmware_count":{"type":"integer","title":"Firmware Count","readOnly":true}},"type":"object","required":["id","slug","fs_slug","rom_count","name","igdb_slug","moby_slug","hltb_slug","libretro_slug","created_at","updated_at","fs_size_bytes","is_unidentified","is_identified","missing_from_fs","display_name","firmware_count"],"title":"PlatformSchema"},"PlaySessionEntry":{"properties":{"rom_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rom Id"},"save_slot":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Save Slot"},"start_time":{"type":"string","format":"date-time","title":"Start Time"},"end_time":{"type":"string","format":"date-time","title":"End Time"},"duration_ms":{"type":"integer","minimum":0.0,"title":"Duration Ms"}},"type":"object","required":["start_time","end_time","duration_ms"],"title":"PlaySessionEntry"},"PlaySessionIngestPayload":{"properties":{"device_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Id"},"sessions":{"items":{"$ref":"#/components/schemas/PlaySessionEntry"},"type":"array","title":"Sessions"}},"type":"object","required":["sessions"],"title":"PlaySessionIngestPayload"},"PlaySessionIngestResponse":{"properties":{"results":{"items":{"$ref":"#/components/schemas/PlaySessionIngestResult"},"type":"array","title":"Results"},"created_count":{"type":"integer","title":"Created Count"},"skipped_count":{"type":"integer","title":"Skipped Count"}},"type":"object","required":["results","created_count","skipped_count"],"title":"PlaySessionIngestResponse"},"PlaySessionIngestResult":{"properties":{"index":{"type":"integer","title":"Index"},"status":{"type":"string","enum":["created","duplicate","error"],"title":"Status"},"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail"}},"type":"object","required":["index","status"],"title":"PlaySessionIngestResult"},"PlaySessionSchema":{"properties":{"id":{"type":"integer","title":"Id"},"user_id":{"type":"integer","title":"User Id"},"device_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Id"},"rom_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rom Id"},"sync_session_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sync Session Id"},"save_slot":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Save Slot"},"start_time":{"type":"string","format":"date-time","title":"Start Time"},"end_time":{"type":"string","format":"date-time","title":"End Time"},"duration_ms":{"type":"integer","title":"Duration Ms"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","user_id","device_id","rom_id","sync_session_id","save_slot","start_time","end_time","duration_ms","created_at","updated_at"],"title":"PlaySessionSchema"},"RAGameRomAchievement":{"properties":{"ra_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ra Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"points":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Points"},"num_awarded":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Num Awarded"},"num_awarded_hardcore":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Num Awarded Hardcore"},"badge_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Badge Id"},"badge_url_lock":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Badge Url Lock"},"badge_path_lock":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Badge Path Lock"},"badge_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Badge Url"},"badge_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Badge Path"},"display_order":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Display Order"},"type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"}},"type":"object","required":["ra_id","title","description","points","num_awarded","num_awarded_hardcore","badge_id","badge_url_lock","badge_path_lock","badge_url","badge_path","display_order","type"],"title":"RAGameRomAchievement"},"RAProgression":{"properties":{"total":{"type":"integer","title":"Total"},"results":{"items":{"$ref":"#/components/schemas/RAUserGameProgression"},"type":"array","title":"Results"}},"type":"object","title":"RAProgression"},"RAUserGameProgression":{"properties":{"rom_ra_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rom Ra Id"},"max_possible":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Possible"},"num_awarded":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Num Awarded"},"num_awarded_hardcore":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Num Awarded Hardcore"},"most_recent_awarded_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Most Recent Awarded Date"},"highest_award_kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Highest Award Kind"},"earned_achievements":{"items":{"$ref":"#/components/schemas/EarnedAchievement"},"type":"array","title":"Earned Achievements"}},"type":"object","required":["rom_ra_id","max_possible","num_awarded","num_awarded_hardcore","earned_achievements"],"title":"RAUserGameProgression"},"RegionBreakdownItem":{"properties":{"region":{"type":"string","title":"Region"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["region","count"],"title":"RegionBreakdownItem"},"Role":{"type":"string","enum":["user","admin"],"title":"Role"},"RomArchiveMember":{"properties":{"name":{"type":"string","title":"Name"},"size":{"type":"integer","title":"Size"},"crc_hash":{"type":"string","title":"Crc Hash"},"md5_hash":{"type":"string","title":"Md5 Hash"},"sha1_hash":{"type":"string","title":"Sha1 Hash"}},"type":"object","required":["name","size","crc_hash","md5_hash","sha1_hash"],"title":"RomArchiveMember"},"RomFileCategory":{"type":"string","enum":["game","dlc","hack","manual","patch","update","mod","demo","translation","prototype","cheat","soundtrack","screenshot"],"title":"RomFileCategory"},"RomFileSchema":{"properties":{"id":{"type":"integer","title":"Id"},"rom_id":{"type":"integer","title":"Rom Id"},"file_name":{"type":"string","title":"File Name"},"file_path":{"type":"string","title":"File Path"},"file_size_bytes":{"type":"integer","title":"File Size Bytes"},"full_path":{"type":"string","title":"Full Path"},"is_top_level":{"type":"boolean","title":"Is Top Level"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"last_modified":{"type":"string","title":"Last Modified"},"crc_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Crc Hash"},"md5_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Md5 Hash"},"sha1_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sha1 Hash"},"ra_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ra Hash"},"chd_sha1_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chd Sha1 Hash"},"archive_members":{"anyOf":[{"items":{"$ref":"#/components/schemas/RomArchiveMember"},"type":"array"},{"type":"null"}],"title":"Archive Members"},"category":{"anyOf":[{"$ref":"#/components/schemas/RomFileCategory"},{"type":"null"}]},"track_meta":{"anyOf":[{"$ref":"#/components/schemas/TrackMetaSchema"},{"type":"null"}]}},"type":"object","required":["id","rom_id","file_name","file_path","file_size_bytes","full_path","is_top_level","created_at","updated_at","last_modified","crc_hash","md5_hash","sha1_hash","ra_hash","chd_sha1_hash","archive_members","category"],"title":"RomFileSchema"},"RomFiltersDict":{"properties":{"genres":{"items":{"type":"string"},"type":"array","title":"Genres"},"franchises":{"items":{"type":"string"},"type":"array","title":"Franchises"},"collections":{"items":{"type":"string"},"type":"array","title":"Collections"},"companies":{"items":{"type":"string"},"type":"array","title":"Companies"},"game_modes":{"items":{"type":"string"},"type":"array","title":"Game Modes"},"age_ratings":{"items":{"type":"string"},"type":"array","title":"Age Ratings"},"player_counts":{"items":{"type":"string"},"type":"array","title":"Player Counts"},"regions":{"items":{"type":"string"},"type":"array","title":"Regions"},"languages":{"items":{"type":"string"},"type":"array","title":"Languages"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags"},"platforms":{"items":{"type":"integer"},"type":"array","title":"Platforms"}},"type":"object","required":["genres","franchises","collections","companies","game_modes","age_ratings","player_counts","regions","languages","tags","platforms"],"title":"RomFiltersDict"},"RomFlashpointMetadata":{"properties":{"franchises":{"items":{"type":"string"},"type":"array","title":"Franchises"},"companies":{"items":{"type":"string"},"type":"array","title":"Companies"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"genres":{"items":{"type":"string"},"type":"array","title":"Genres"},"first_release_date":{"type":"string","title":"First Release Date"},"game_modes":{"items":{"type":"string"},"type":"array","title":"Game Modes"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"}},"type":"object","title":"RomFlashpointMetadata"},"RomGamelistMetadata":{"properties":{"box2d_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Box2D Url"},"box2d_back_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Box2D Back Url"},"box3d_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Box3D Url"},"fanart_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fanart Url"},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Url"},"manual_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Manual Url"},"marquee_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Marquee Url"},"miximage_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Miximage Url"},"miximage_v2_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Miximage V2 Url"},"physical_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Physical Url"},"screenshot_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Screenshot Url"},"thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnail Url"},"title_screen_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title Screen Url"},"video_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Video Url"},"rating":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rating"},"first_release_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Release Date"},"sort_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sort Name"},"companies":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Companies"},"franchises":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Franchises"},"genres":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Genres"},"player_count":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Player Count"},"md5_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Md5 Hash"},"box3d_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Box3D Path"},"miximage_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Miximage Path"},"miximage_v2_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Miximage V2 Path"},"physical_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Physical Path"},"marquee_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Marquee Path"},"video_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Video Path"}},"type":"object","title":"RomGamelistMetadata"},"RomHLTBMetadata":{"properties":{"main_story":{"type":"integer","title":"Main Story"},"main_story_count":{"type":"integer","title":"Main Story Count"},"main_plus_extra":{"type":"integer","title":"Main Plus Extra"},"main_plus_extra_count":{"type":"integer","title":"Main Plus Extra Count"},"completionist":{"type":"integer","title":"Completionist"},"completionist_count":{"type":"integer","title":"Completionist Count"},"all_styles":{"type":"integer","title":"All Styles"},"all_styles_count":{"type":"integer","title":"All Styles Count"},"release_year":{"type":"integer","title":"Release Year"},"review_score":{"type":"integer","title":"Review Score"},"review_count":{"type":"integer","title":"Review Count"},"popularity":{"type":"integer","title":"Popularity"},"completions":{"type":"integer","title":"Completions"}},"type":"object","title":"RomHLTBMetadata"},"RomHasheousMetadata":{"properties":{"tosec_match":{"type":"boolean","title":"Tosec Match"},"mame_arcade_match":{"type":"boolean","title":"Mame Arcade Match"},"mame_mess_match":{"type":"boolean","title":"Mame Mess Match"},"nointro_match":{"type":"boolean","title":"Nointro Match"},"redump_match":{"type":"boolean","title":"Redump Match"},"whdload_match":{"type":"boolean","title":"Whdload Match"},"ra_match":{"type":"boolean","title":"Ra Match"},"fbneo_match":{"type":"boolean","title":"Fbneo Match"},"puredos_match":{"type":"boolean","title":"Puredos Match"}},"type":"object","title":"RomHasheousMetadata"},"RomIGDBMetadata":{"properties":{"total_rating":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Total Rating"},"aggregated_rating":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Aggregated Rating"},"first_release_date":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"First Release Date"},"youtube_video_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Youtube Video Id"},"genres":{"items":{"type":"string"},"type":"array","title":"Genres"},"franchises":{"items":{"type":"string"},"type":"array","title":"Franchises"},"alternative_names":{"items":{"type":"string"},"type":"array","title":"Alternative Names"},"collections":{"items":{"type":"string"},"type":"array","title":"Collections"},"companies":{"items":{"type":"string"},"type":"array","title":"Companies"},"game_modes":{"items":{"type":"string"},"type":"array","title":"Game Modes"},"age_ratings":{"items":{"$ref":"#/components/schemas/IGDBAgeRating"},"type":"array","title":"Age Ratings"},"platforms":{"items":{"$ref":"#/components/schemas/IGDBMetadataPlatform"},"type":"array","title":"Platforms"},"multiplayer_modes":{"items":{"$ref":"#/components/schemas/IGDBMetadataMultiplayerMode"},"type":"array","title":"Multiplayer Modes"},"player_count":{"type":"string","title":"Player Count"},"expansions":{"items":{"$ref":"#/components/schemas/IGDBRelatedGame"},"type":"array","title":"Expansions"},"dlcs":{"items":{"$ref":"#/components/schemas/IGDBRelatedGame"},"type":"array","title":"Dlcs"},"remasters":{"items":{"$ref":"#/components/schemas/IGDBRelatedGame"},"type":"array","title":"Remasters"},"remakes":{"items":{"$ref":"#/components/schemas/IGDBRelatedGame"},"type":"array","title":"Remakes"},"expanded_games":{"items":{"$ref":"#/components/schemas/IGDBRelatedGame"},"type":"array","title":"Expanded Games"},"ports":{"items":{"$ref":"#/components/schemas/IGDBRelatedGame"},"type":"array","title":"Ports"},"similar_games":{"items":{"$ref":"#/components/schemas/IGDBRelatedGame"},"type":"array","title":"Similar Games"}},"type":"object","title":"RomIGDBMetadata"},"RomLaunchboxMetadata":{"properties":{"first_release_date":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"First Release Date"},"max_players":{"type":"integer","title":"Max Players"},"release_type":{"type":"string","title":"Release Type"},"cooperative":{"type":"boolean","title":"Cooperative"},"youtube_video_id":{"type":"string","title":"Youtube Video Id"},"community_rating":{"type":"number","title":"Community Rating"},"community_rating_count":{"type":"integer","title":"Community Rating Count"},"wikipedia_url":{"type":"string","title":"Wikipedia Url"},"esrb":{"type":"string","title":"Esrb"},"genres":{"items":{"type":"string"},"type":"array","title":"Genres"},"companies":{"items":{"type":"string"},"type":"array","title":"Companies"},"images":{"items":{"$ref":"#/components/schemas/LaunchboxImage"},"type":"array","title":"Images"},"video_url":{"type":"string","title":"Video Url"},"video_path":{"type":"string","title":"Video Path"}},"type":"object","title":"RomLaunchboxMetadata"},"RomMetadataSchema":{"properties":{"rom_id":{"type":"integer","title":"Rom Id"},"genres":{"items":{"type":"string"},"type":"array","title":"Genres"},"franchises":{"items":{"type":"string"},"type":"array","title":"Franchises"},"collections":{"items":{"type":"string"},"type":"array","title":"Collections"},"companies":{"items":{"type":"string"},"type":"array","title":"Companies"},"game_modes":{"items":{"type":"string"},"type":"array","title":"Game Modes"},"age_ratings":{"items":{"type":"string"},"type":"array","title":"Age Ratings"},"player_count":{"type":"string","title":"Player Count"},"first_release_date":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"First Release Date"},"average_rating":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Average Rating"}},"type":"object","required":["rom_id","genres","franchises","collections","companies","game_modes","age_ratings","player_count","first_release_date","average_rating"],"title":"RomMetadataSchema"},"RomMobyMetadata":{"properties":{"moby_score":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Moby Score"},"genres":{"items":{"type":"string"},"type":"array","title":"Genres"},"alternate_titles":{"items":{"type":"string"},"type":"array","title":"Alternate Titles"},"platforms":{"items":{"$ref":"#/components/schemas/MobyMetadataPlatform"},"type":"array","title":"Platforms"}},"type":"object","title":"RomMobyMetadata"},"RomRAMetadata":{"properties":{"first_release_date":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"First Release Date"},"genres":{"items":{"type":"string"},"type":"array","title":"Genres"},"companies":{"items":{"type":"string"},"type":"array","title":"Companies"},"achievements":{"items":{"$ref":"#/components/schemas/RAGameRomAchievement"},"type":"array","title":"Achievements"}},"type":"object","title":"RomRAMetadata"},"RomSSMetadata":{"properties":{"bezel_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bezel Url"},"box2d_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Box2D Url"},"box2d_side_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Box2D Side Url"},"box2d_back_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Box2D Back Url"},"box3d_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Box3D Url"},"fanart_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fanart Url"},"fullbox_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fullbox Url"},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Url"},"manual_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Manual Url"},"marquee_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Marquee Url"},"miximage_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Miximage Url"},"miximage_v2_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Miximage V2 Url"},"physical_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Physical Url"},"screenshot_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Screenshot Url"},"steamgrid_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Steamgrid Url"},"title_screen_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title Screen Url"},"video_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Video Url"},"video_normalized_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Video Normalized Url"},"bezel_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bezel Path"},"box2d_back_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Box2D Back Path"},"box2d_side_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Box2D Side Path"},"box3d_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Box3D Path"},"fanart_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fanart Path"},"miximage_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Miximage Path"},"miximage_v2_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Miximage V2 Path"},"physical_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Physical Path"},"marquee_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Marquee Path"},"logo_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Path"},"title_screen_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title Screen Path"},"video_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Video Path"},"video_normalized_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Video Normalized Path"},"ss_score":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ss Score"},"first_release_date":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"First Release Date"},"alternative_names":{"items":{"type":"string"},"type":"array","title":"Alternative Names"},"age_ratings":{"items":{"$ref":"#/components/schemas/SSAgeRating"},"type":"array","title":"Age Ratings"},"companies":{"items":{"type":"string"},"type":"array","title":"Companies"},"franchises":{"items":{"type":"string"},"type":"array","title":"Franchises"},"game_modes":{"items":{"type":"string"},"type":"array","title":"Game Modes"},"genres":{"items":{"type":"string"},"type":"array","title":"Genres"},"player_count":{"type":"string","title":"Player Count"}},"type":"object","title":"RomSSMetadata"},"RomUserData":{"properties":{"is_main_sibling":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Main Sibling","description":"Whether this rom is the main sibling."},"backlogged":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Backlogged","description":"Whether this rom is in the backlog."},"now_playing":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Now Playing","description":"Whether this rom is currently being played."},"hidden":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Hidden","description":"Whether this rom is hidden."},"rating":{"anyOf":[{"type":"integer","maximum":10.0,"minimum":0.0},{"type":"null"}],"title":"Rating","description":"User rating for this rom (0-10)."},"difficulty":{"anyOf":[{"type":"integer","maximum":10.0,"minimum":0.0},{"type":"null"}],"title":"Difficulty","description":"User difficulty rating for this rom (0-10)."},"completion":{"anyOf":[{"type":"integer","maximum":100.0,"minimum":0.0},{"type":"null"}],"title":"Completion","description":"User completion percentage for this rom (0-100)."},"status":{"anyOf":[{"$ref":"#/components/schemas/RomUserStatus"},{"type":"null"}],"description":"User play status for this rom."}},"type":"object","title":"RomUserData"},"RomUserSchema":{"properties":{"id":{"type":"integer","title":"Id"},"user_id":{"type":"integer","title":"User Id"},"rom_id":{"type":"integer","title":"Rom Id"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"last_played":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Played"},"is_main_sibling":{"type":"boolean","title":"Is Main Sibling"},"backlogged":{"type":"boolean","title":"Backlogged"},"now_playing":{"type":"boolean","title":"Now Playing"},"hidden":{"type":"boolean","title":"Hidden"},"rating":{"type":"integer","title":"Rating"},"difficulty":{"type":"integer","title":"Difficulty"},"completion":{"type":"integer","title":"Completion"},"status":{"anyOf":[{"$ref":"#/components/schemas/RomUserStatus"},{"type":"null"}]}},"type":"object","required":["id","user_id","rom_id","created_at","updated_at","last_played","is_main_sibling","backlogged","now_playing","hidden","rating","difficulty","completion","status"],"title":"RomUserSchema"},"RomUserStatus":{"type":"string","enum":["incomplete","finished","completed_100","retired","never_playing"],"title":"RomUserStatus"},"RoomsResponse":{"properties":{"room_name":{"type":"string","title":"Room Name"},"current":{"type":"integer","title":"Current"},"max":{"type":"integer","title":"Max"},"player_name":{"type":"string","title":"Player Name"},"hasPassword":{"type":"boolean","title":"Haspassword"}},"type":"object","required":["room_name","current","max","player_name","hasPassword"],"title":"RoomsResponse"},"SGDBResource":{"properties":{"thumb":{"type":"string","title":"Thumb"},"url":{"type":"string","title":"Url"},"type":{"type":"string","title":"Type"},"width":{"type":"integer","title":"Width"},"height":{"type":"integer","title":"Height"},"style":{"type":"string","title":"Style"},"author":{"type":"string","title":"Author"},"score":{"type":"integer","title":"Score"},"nsfw":{"type":"boolean","title":"Nsfw"},"humor":{"type":"boolean","title":"Humor"},"epilepsy":{"type":"boolean","title":"Epilepsy"}},"type":"object","required":["thumb","url","type","width","height","style","author","score","nsfw","humor","epilepsy"],"title":"SGDBResource"},"SSAgeRating":{"properties":{"rating":{"type":"string","title":"Rating"},"category":{"type":"string","title":"Category"}},"type":"object","required":["rating","category"],"title":"SSAgeRating"},"SaveAndExitRequest":{"properties":{"slot":{"type":"integer","maximum":10.0,"minimum":0.0,"title":"Slot","default":0},"wait":{"type":"boolean","title":"Wait","default":true}},"type":"object","title":"SaveAndExitRequest"},"SaveSchema":{"properties":{"id":{"type":"integer","title":"Id"},"rom_id":{"type":"integer","title":"Rom Id"},"user_id":{"type":"integer","title":"User Id"},"file_name":{"type":"string","title":"File Name"},"file_name_no_tags":{"type":"string","title":"File Name No Tags"},"file_name_no_ext":{"type":"string","title":"File Name No Ext"},"file_extension":{"type":"string","title":"File Extension"},"file_path":{"type":"string","title":"File Path"},"file_size_bytes":{"type":"integer","title":"File Size Bytes"},"full_path":{"type":"string","title":"Full Path"},"download_path":{"type":"string","title":"Download Path"},"missing_from_fs":{"type":"boolean","title":"Missing From Fs"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"emulator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emulator"},"slot":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slot"},"content_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Hash"},"is_public":{"type":"boolean","title":"Is Public","default":false},"screenshot":{"anyOf":[{"$ref":"#/components/schemas/ScreenshotSchema"},{"type":"null"}]},"origin_device_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Origin Device Id"},"device_syncs":{"items":{"$ref":"#/components/schemas/DeviceSyncSchema"},"type":"array","title":"Device Syncs","default":[]}},"type":"object","required":["id","rom_id","user_id","file_name","file_name_no_tags","file_name_no_ext","file_extension","file_path","file_size_bytes","full_path","download_path","missing_from_fs","created_at","updated_at","emulator","screenshot"],"title":"SaveSchema"},"SaveStateRequest":{"properties":{"slot":{"type":"integer","maximum":9.0,"minimum":1.0,"title":"Slot","default":1}},"type":"object","title":"SaveStateRequest"},"SaveSummarySchema":{"properties":{"total_count":{"type":"integer","title":"Total Count"},"slots":{"items":{"$ref":"#/components/schemas/SlotSummarySchema"},"type":"array","title":"Slots"}},"type":"object","required":["total_count","slots"],"title":"SaveSummarySchema"},"ScanSettingsPayload":{"properties":{"metadata_priority":{"items":{"type":"string"},"type":"array","title":"Metadata Priority"},"artwork_priority":{"items":{"type":"string"},"type":"array","title":"Artwork Priority"},"cover_priority":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Cover Priority"},"screenshot_priority":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Screenshot Priority"},"manual_priority":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Manual Priority"},"region_priority":{"items":{"type":"string"},"type":"array","title":"Region Priority"},"language_priority":{"items":{"type":"string"},"type":"array","title":"Language Priority"},"media":{"items":{"$ref":"#/components/schemas/MetadataMediaType"},"type":"array","title":"Media"},"gamelist_export":{"type":"boolean","title":"Gamelist Export"},"gamelist_thumbnail":{"$ref":"#/components/schemas/MetadataMediaType"},"gamelist_image":{"$ref":"#/components/schemas/MetadataMediaType"},"pegasus_export":{"type":"boolean","title":"Pegasus Export"}},"type":"object","required":["metadata_priority","artwork_priority","region_priority","language_priority","media","gamelist_export","gamelist_thumbnail","gamelist_image","pegasus_export"],"title":"ScanSettingsPayload","description":"Full replacement of the scan.* config section.\n\nThe three artwork override lists (cover/screenshot/manual) are optional:\na null value clears the override so that field falls back to\n`artwork_priority`."},"ScanStats":{"properties":{"total_platforms":{"type":"integer","title":"Total Platforms"},"total_roms":{"type":"integer","title":"Total Roms"},"scanned_platforms":{"type":"integer","title":"Scanned Platforms"},"new_platforms":{"type":"integer","title":"New Platforms"},"identified_platforms":{"type":"integer","title":"Identified Platforms"},"scanned_roms":{"type":"integer","title":"Scanned Roms"},"new_roms":{"type":"integer","title":"New Roms"},"identified_roms":{"type":"integer","title":"Identified Roms"},"scanned_firmware":{"type":"integer","title":"Scanned Firmware"},"new_firmware":{"type":"integer","title":"New Firmware"}},"type":"object","required":["total_platforms","total_roms","scanned_platforms","new_platforms","identified_platforms","scanned_roms","new_roms","identified_roms","scanned_firmware","new_firmware"],"title":"ScanStats"},"ScanTaskMeta":{"properties":{"scan_stats":{"anyOf":[{"$ref":"#/components/schemas/ScanStats"},{"type":"null"}]}},"type":"object","required":["scan_stats"],"title":"ScanTaskMeta"},"ScanTaskStatusResponse":{"properties":{"task_name":{"type":"string","title":"Task Name"},"task_id":{"type":"string","title":"Task Id"},"status":{"$ref":"#/components/schemas/JobStatus"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"enqueued_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Enqueued At"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"ended_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ended At"},"task_type":{"type":"string","const":"scan","title":"Task Type"},"meta":{"$ref":"#/components/schemas/ScanTaskMeta"}},"type":"object","required":["task_name","task_id","status","created_at","enqueued_at","started_at","ended_at","task_type","meta"],"title":"ScanTaskStatusResponse"},"ScreenshotSchema":{"properties":{"id":{"type":"integer","title":"Id"},"rom_id":{"type":"integer","title":"Rom Id"},"user_id":{"type":"integer","title":"User Id"},"file_name":{"type":"string","title":"File Name"},"file_name_no_tags":{"type":"string","title":"File Name No Tags"},"file_name_no_ext":{"type":"string","title":"File Name No Ext"},"file_extension":{"type":"string","title":"File Extension"},"file_path":{"type":"string","title":"File Path"},"file_size_bytes":{"type":"integer","title":"File Size Bytes"},"full_path":{"type":"string","title":"Full Path"},"download_path":{"type":"string","title":"Download Path"},"missing_from_fs":{"type":"boolean","title":"Missing From Fs"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"is_gallery":{"type":"boolean","title":"Is Gallery","default":false},"is_public":{"type":"boolean","title":"Is Public","default":false}},"type":"object","required":["id","rom_id","user_id","file_name","file_name_no_tags","file_name_no_ext","file_extension","file_path","file_size_bytes","full_path","download_path","missing_from_fs","created_at","updated_at"],"title":"ScreenshotSchema"},"SearchCoverSchema":{"properties":{"name":{"type":"string","title":"Name"},"resources":{"items":{"$ref":"#/components/schemas/SGDBResource"},"type":"array","title":"Resources"}},"type":"object","required":["name","resources"],"title":"SearchCoverSchema"},"SearchRomSchema":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"igdb_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Igdb Id"},"moby_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Moby Id"},"ss_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ss Id"},"sgdb_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sgdb Id"},"flashpoint_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Flashpoint Id"},"launchbox_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Launchbox Id"},"libretro_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Libretro Id"},"platform_id":{"type":"integer","title":"Platform Id"},"name":{"type":"string","title":"Name"},"slug":{"type":"string","title":"Slug","default":""},"summary":{"type":"string","title":"Summary","default":""},"igdb_url_cover":{"type":"string","title":"Igdb Url Cover","default":""},"moby_url_cover":{"type":"string","title":"Moby Url Cover","default":""},"ss_url_cover":{"type":"string","title":"Ss Url Cover","default":""},"sgdb_url_cover":{"type":"string","title":"Sgdb Url Cover","default":""},"flashpoint_url_cover":{"type":"string","title":"Flashpoint Url Cover","default":""},"launchbox_url_cover":{"type":"string","title":"Launchbox Url Cover","default":""},"libretro_url_cover":{"type":"string","title":"Libretro Url Cover","default":""},"is_unidentified":{"type":"boolean","title":"Is Unidentified"},"is_identified":{"type":"boolean","title":"Is Identified"}},"type":"object","required":["platform_id","name","is_unidentified","is_identified"],"title":"SearchRomSchema"},"SiblingRomSchema":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"fs_name_no_tags":{"type":"string","title":"Fs Name No Tags"},"fs_name_no_ext":{"type":"string","title":"Fs Name No Ext"},"is_main_sibling":{"type":"boolean","title":"Is Main Sibling"},"sort_comparator":{"type":"string","title":"Sort Comparator","readOnly":true}},"type":"object","required":["id","name","fs_name_no_tags","fs_name_no_ext","is_main_sibling","sort_comparator"],"title":"SiblingRomSchema"},"SimpleRomSchema":{"properties":{"id":{"type":"integer","title":"Id"},"igdb_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Igdb Id"},"sgdb_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sgdb Id"},"moby_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Moby Id"},"ss_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ss Id"},"ra_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ra Id"},"launchbox_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Launchbox Id"},"hasheous_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Hasheous Id"},"tgdb_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tgdb Id"},"flashpoint_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Flashpoint Id"},"hltb_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Hltb Id"},"gamelist_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gamelist Id"},"libretro_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Libretro Id"},"platform_id":{"type":"integer","title":"Platform Id"},"platform_slug":{"type":"string","title":"Platform Slug"},"platform_fs_slug":{"type":"string","title":"Platform Fs Slug"},"platform_custom_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Platform Custom Name"},"platform_display_name":{"type":"string","title":"Platform Display Name"},"fs_name":{"type":"string","title":"Fs Name"},"fs_name_no_tags":{"type":"string","title":"Fs Name No Tags"},"fs_name_no_ext":{"type":"string","title":"Fs Name No Ext"},"fs_extension":{"type":"string","title":"Fs Extension"},"fs_path":{"type":"string","title":"Fs Path"},"fs_size_bytes":{"type":"integer","title":"Fs Size Bytes"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"name_sort_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name Sort Key"},"slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slug"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"alternative_names":{"items":{"type":"string"},"type":"array","title":"Alternative Names"},"youtube_video_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Youtube Video Id"},"metadatum":{"$ref":"#/components/schemas/RomMetadataSchema"},"igdb_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomIGDBMetadata"},{"type":"null"}]},"moby_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomMobyMetadata"},{"type":"null"}]},"ss_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomSSMetadata"},{"type":"null"}]},"launchbox_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomLaunchboxMetadata"},{"type":"null"}]},"hasheous_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomHasheousMetadata"},{"type":"null"}]},"flashpoint_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomFlashpointMetadata"},{"type":"null"}]},"hltb_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomHLTBMetadata"},{"type":"null"}]},"gamelist_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomGamelistMetadata"},{"type":"null"}]},"manual_metadata":{"anyOf":[{"$ref":"#/components/schemas/ManualMetadata"},{"type":"null"}]},"path_cover_small":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Cover Small"},"path_cover_large":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Cover Large"},"url_cover":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url Cover"},"has_manual":{"type":"boolean","title":"Has Manual"},"has_soundtrack":{"type":"boolean","title":"Has Soundtrack"},"path_manual":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Manual"},"url_manual":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url Manual"},"path_video":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Video"},"is_identifying":{"type":"boolean","title":"Is Identifying","default":false},"is_unidentified":{"type":"boolean","title":"Is Unidentified"},"is_identified":{"type":"boolean","title":"Is Identified"},"revision":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Revision"},"regions":{"items":{"type":"string"},"type":"array","title":"Regions"},"languages":{"items":{"type":"string"},"type":"array","title":"Languages"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags"},"crc_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Crc Hash"},"md5_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Md5 Hash"},"sha1_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sha1 Hash"},"ra_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ra Hash"},"has_simple_single_file":{"type":"boolean","title":"Has Simple Single File"},"has_nested_single_file":{"type":"boolean","title":"Has Nested Single File"},"has_multiple_files":{"type":"boolean","title":"Has Multiple Files"},"full_path":{"type":"string","title":"Full Path"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"missing_from_fs":{"type":"boolean","title":"Missing From Fs"},"has_notes":{"type":"boolean","title":"Has Notes"},"rom_user":{"$ref":"#/components/schemas/RomUserSchema"},"merged_screenshots":{"items":{"type":"string"},"type":"array","title":"Merged Screenshots"},"merged_ra_metadata":{"anyOf":[{"$ref":"#/components/schemas/RomRAMetadata"},{"type":"null"}]},"files":{"items":{"$ref":"#/components/schemas/RomFileSchema"},"type":"array","title":"Files"},"sibling_roms":{"items":{"$ref":"#/components/schemas/SiblingRomSchema"},"type":"array","title":"Sibling Roms"},"screenshot_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Screenshot Path"}},"type":"object","required":["id","igdb_id","sgdb_id","moby_id","ss_id","ra_id","launchbox_id","hasheous_id","tgdb_id","flashpoint_id","hltb_id","gamelist_id","libretro_id","platform_id","platform_slug","platform_fs_slug","platform_custom_name","platform_display_name","fs_name","fs_name_no_tags","fs_name_no_ext","fs_extension","fs_path","fs_size_bytes","name","name_sort_key","slug","summary","alternative_names","youtube_video_id","metadatum","igdb_metadata","moby_metadata","ss_metadata","launchbox_metadata","hasheous_metadata","flashpoint_metadata","hltb_metadata","gamelist_metadata","manual_metadata","path_cover_small","path_cover_large","url_cover","has_manual","has_soundtrack","path_manual","url_manual","path_video","is_unidentified","is_identified","revision","regions","languages","tags","crc_hash","md5_hash","sha1_hash","ra_hash","has_simple_single_file","has_nested_single_file","has_multiple_files","full_path","created_at","updated_at","missing_from_fs","has_notes","rom_user","merged_screenshots","merged_ra_metadata","files","sibling_roms"],"title":"SimpleRomSchema"},"SlotSummarySchema":{"properties":{"slot":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slot"},"count":{"type":"integer","title":"Count"},"latest":{"$ref":"#/components/schemas/SaveSchema"}},"type":"object","required":["slot","count","latest"],"title":"SlotSummarySchema"},"SmartCollectionSchema":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description","default":""},"rom_ids":{"items":{"type":"integer"},"type":"array","uniqueItems":true,"title":"Rom Ids"},"rom_count":{"type":"integer","title":"Rom Count"},"path_cover_small":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Cover Small"},"path_cover_large":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Cover Large"},"path_covers_small":{"items":{"type":"string"},"type":"array","title":"Path Covers Small"},"path_covers_large":{"items":{"type":"string"},"type":"array","title":"Path Covers Large"},"is_public":{"type":"boolean","title":"Is Public","default":false},"is_favorite":{"type":"boolean","title":"Is Favorite","default":false},"is_virtual":{"type":"boolean","title":"Is Virtual","default":false},"is_smart":{"type":"boolean","title":"Is Smart","default":true},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"id":{"type":"integer","title":"Id"},"filter_criteria":{"additionalProperties":true,"type":"object","title":"Filter Criteria"},"filter_summary":{"type":"string","title":"Filter Summary"},"user_id":{"type":"integer","title":"User Id"},"owner_username":{"type":"string","title":"Owner Username"}},"type":"object","required":["name","rom_ids","rom_count","path_cover_small","path_cover_large","path_covers_small","path_covers_large","created_at","updated_at","id","filter_criteria","filter_summary","user_id","owner_username"],"title":"SmartCollectionSchema"},"SoundtrackTrackMetaSchema":{"properties":{"file_id":{"type":"integer","title":"File Id"},"file_name":{"type":"string","title":"File Name"},"file_size_bytes":{"type":"integer","title":"File Size Bytes"},"track_meta":{"anyOf":[{"$ref":"#/components/schemas/TrackMetaSchema"},{"type":"null"}]}},"type":"object","required":["file_id","file_name","file_size_bytes"],"title":"SoundtrackTrackMetaSchema"},"StateSchema":{"properties":{"id":{"type":"integer","title":"Id"},"rom_id":{"type":"integer","title":"Rom Id"},"user_id":{"type":"integer","title":"User Id"},"file_name":{"type":"string","title":"File Name"},"file_name_no_tags":{"type":"string","title":"File Name No Tags"},"file_name_no_ext":{"type":"string","title":"File Name No Ext"},"file_extension":{"type":"string","title":"File Extension"},"file_path":{"type":"string","title":"File Path"},"file_size_bytes":{"type":"integer","title":"File Size Bytes"},"full_path":{"type":"string","title":"Full Path"},"download_path":{"type":"string","title":"Download Path"},"missing_from_fs":{"type":"boolean","title":"Missing From Fs"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"emulator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emulator"},"is_public":{"type":"boolean","title":"Is Public","default":false},"screenshot":{"anyOf":[{"$ref":"#/components/schemas/ScreenshotSchema"},{"type":"null"}]}},"type":"object","required":["id","rom_id","user_id","file_name","file_name_no_tags","file_name_no_ext","file_extension","file_path","file_size_bytes","full_path","download_path","missing_from_fs","created_at","updated_at","emulator","screenshot"],"title":"StateSchema"},"StatsReturn":{"properties":{"PLATFORMS":{"type":"integer","title":"Platforms"},"ROMS":{"type":"integer","title":"Roms"},"SAVES":{"type":"integer","title":"Saves"},"STATES":{"type":"integer","title":"States"},"SCREENSHOTS":{"type":"integer","title":"Screenshots"},"TOTAL_FILESIZE_BYTES":{"type":"integer","title":"Total Filesize Bytes"},"METADATA_COVERAGE":{"additionalProperties":{"items":{"$ref":"#/components/schemas/MetadataCoverageItem"},"type":"array"},"type":"object","title":"Metadata Coverage"},"REGION_BREAKDOWN":{"additionalProperties":{"items":{"$ref":"#/components/schemas/RegionBreakdownItem"},"type":"array"},"type":"object","title":"Region Breakdown"}},"type":"object","title":"StatsReturn"},"SyncCompletePayload":{"properties":{"operations_completed":{"type":"integer","title":"Operations Completed","default":0},"operations_failed":{"type":"integer","title":"Operations Failed","default":0},"play_sessions":{"anyOf":[{"items":{"$ref":"#/components/schemas/SyncPlaySessionEntry"},"type":"array"},{"type":"null"}],"title":"Play Sessions"}},"type":"object","title":"SyncCompletePayload"},"SyncCompleteResponse":{"properties":{"session":{"$ref":"#/components/schemas/SyncSessionSchema"},"play_session_ingest":{"anyOf":[{"$ref":"#/components/schemas/PlaySessionIngestResponse"},{"type":"null"}]}},"type":"object","required":["session"],"title":"SyncCompleteResponse"},"SyncMode":{"type":"string","enum":["api","file_transfer","push_pull"],"title":"SyncMode"},"SyncNegotiatePayload":{"properties":{"device_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Id","description":"ID of the syncing device. Optional when the request uses a device-bound client token, in which case the device is inferred from the token."},"saves":{"items":{"$ref":"#/components/schemas/ClientSaveState"},"type":"array","title":"Saves","description":"Current save state on the client."}},"type":"object","required":["saves"],"title":"SyncNegotiatePayload"},"SyncNegotiateResponse":{"properties":{"session_id":{"type":"integer","title":"Session Id"},"operations":{"items":{"$ref":"#/components/schemas/SyncOperationSchema"},"type":"array","title":"Operations"},"total_upload":{"type":"integer","title":"Total Upload"},"total_download":{"type":"integer","title":"Total Download"},"total_conflict":{"type":"integer","title":"Total Conflict"},"total_no_op":{"type":"integer","title":"Total No Op"}},"type":"object","required":["session_id","operations","total_upload","total_download","total_conflict","total_no_op"],"title":"SyncNegotiateResponse"},"SyncOperationSchema":{"properties":{"action":{"type":"string","enum":["upload","download","conflict","no_op"],"title":"Action","description":"Operation the client should perform. 'upload' when the client has a save the server lacks (including any null-slot save, which is never paired with server saves), 'download' when the server has a newer or unknown save, 'conflict' when both sides changed independently, and 'no_op' when no action is needed."},"rom_id":{"type":"integer","title":"Rom Id","description":"ID of the ROM this operation applies to."},"save_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Save Id","description":"ID of the server save, if one exists (null for uploads)."},"file_name":{"type":"string","title":"File Name","description":"Name of the save file."},"slot":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slot","description":"Slot the operation applies to. Echoes the client slot for uploads; for downloads and conflicts it is the server save's slot."},"emulator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emulator","description":"Emulator associated with the save, if known."},"reason":{"type":"string","title":"Reason","description":"Human-readable explanation of why this operation was chosen."},"server_updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Server Updated At","description":"Last-modified timestamp of the server save, when applicable."},"server_content_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Server Content Hash","description":"Content hash of the server save, when applicable."}},"type":"object","required":["action","rom_id","file_name","reason"],"title":"SyncOperationSchema"},"SyncPlaySessionEntry":{"properties":{"rom_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rom Id"},"save_slot":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Save Slot"},"start_time":{"type":"string","format":"date-time","title":"Start Time"},"end_time":{"type":"string","format":"date-time","title":"End Time"},"duration_ms":{"type":"integer","minimum":0.0,"title":"Duration Ms"}},"type":"object","required":["start_time","end_time","duration_ms"],"title":"SyncPlaySessionEntry"},"SyncSessionSchema":{"properties":{"id":{"type":"integer","title":"Id"},"device_id":{"type":"string","title":"Device Id"},"user_id":{"type":"integer","title":"User Id"},"status":{"type":"string","title":"Status"},"initiated_at":{"type":"string","title":"Initiated At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"},"operations_planned":{"type":"integer","title":"Operations Planned"},"operations_completed":{"type":"integer","title":"Operations Completed"},"operations_failed":{"type":"integer","title":"Operations Failed"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","device_id","user_id","status","initiated_at","operations_planned","operations_completed","operations_failed","created_at","updated_at"],"title":"SyncSessionSchema"},"SyncTaskMeta":{"properties":{},"type":"object","title":"SyncTaskMeta"},"SyncTaskStatusResponse":{"properties":{"task_name":{"type":"string","title":"Task Name"},"task_id":{"type":"string","title":"Task Id"},"status":{"$ref":"#/components/schemas/JobStatus"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"enqueued_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Enqueued At"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"ended_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ended At"},"task_type":{"type":"string","const":"sync","title":"Task Type"},"meta":{"$ref":"#/components/schemas/SyncTaskMeta"}},"type":"object","required":["task_name","task_id","status","created_at","enqueued_at","started_at","ended_at","task_type","meta"],"title":"SyncTaskStatusResponse"},"SystemDict":{"properties":{"VERSION":{"type":"string","title":"Version"},"SHOW_SETUP_WIZARD":{"type":"boolean","title":"Show Setup Wizard"}},"type":"object","required":["VERSION","SHOW_SETUP_WIZARD"],"title":"SystemDict"},"TaskExecutionResponse":{"properties":{"task_name":{"type":"string","title":"Task Name"},"task_id":{"type":"string","title":"Task Id"},"status":{"$ref":"#/components/schemas/JobStatus"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"enqueued_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Enqueued At"}},"type":"object","required":["task_name","task_id","status","created_at","enqueued_at"],"title":"TaskExecutionResponse"},"TaskInfo":{"properties":{"name":{"type":"string","title":"Name"},"type":{"$ref":"#/components/schemas/TaskType"},"manual_run":{"type":"boolean","title":"Manual Run"},"title":{"type":"string","title":"Title"},"description":{"type":"string","title":"Description"},"enabled":{"type":"boolean","title":"Enabled"},"cron_string":{"type":"string","title":"Cron String"}},"type":"object","required":["name","type","manual_run","title","description","enabled","cron_string"],"title":"TaskInfo"},"TaskType":{"type":"string","enum":["scan","conversion","cleanup","update","sync","watcher","generic"],"title":"TaskType","description":"Enumeration of task types for categorization and UI display."},"TasksDict":{"properties":{"ENABLE_SCHEDULED_RESCAN":{"type":"boolean","title":"Enable Scheduled Rescan"},"SCHEDULED_RESCAN_CRON":{"type":"string","title":"Scheduled Rescan Cron"},"ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB":{"type":"boolean","title":"Enable Scheduled Update Switch Titledb"},"SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON":{"type":"string","title":"Scheduled Update Switch Titledb Cron"},"ENABLE_SCHEDULED_UPDATE_LAUNCHBOX_METADATA":{"type":"boolean","title":"Enable Scheduled Update Launchbox Metadata"},"SCHEDULED_UPDATE_LAUNCHBOX_METADATA_CRON":{"type":"string","title":"Scheduled Update Launchbox Metadata Cron"},"ENABLE_SCHEDULED_CONVERT_IMAGES_TO_WEBP":{"type":"boolean","title":"Enable Scheduled Convert Images To Webp"},"SCHEDULED_CONVERT_IMAGES_TO_WEBP_CRON":{"type":"string","title":"Scheduled Convert Images To Webp Cron"}},"type":"object","required":["ENABLE_SCHEDULED_RESCAN","SCHEDULED_RESCAN_CRON","ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB","SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON","ENABLE_SCHEDULED_UPDATE_LAUNCHBOX_METADATA","SCHEDULED_UPDATE_LAUNCHBOX_METADATA_CRON","ENABLE_SCHEDULED_CONVERT_IMAGES_TO_WEBP","SCHEDULED_CONVERT_IMAGES_TO_WEBP_CRON"],"title":"TasksDict"},"TinfoilFeedFileSchema":{"properties":{"url":{"type":"string","title":"Url"},"size":{"type":"integer","title":"Size"}},"type":"object","required":["url","size"],"title":"TinfoilFeedFileSchema"},"TinfoilFeedSchema":{"properties":{"files":{"items":{"$ref":"#/components/schemas/TinfoilFeedFileSchema"},"type":"array","title":"Files"},"directories":{"items":{"type":"string"},"type":"array","title":"Directories"},"titledb":{"additionalProperties":{"additionalProperties":true,"type":"object"},"type":"object","title":"Titledb"},"success":{"type":"string","title":"Success"},"error":{"type":"string","title":"Error"}},"type":"object","required":["files","directories"],"title":"TinfoilFeedSchema"},"TokenResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type"},"expires":{"type":"integer","title":"Expires"},"refresh_token":{"type":"string","title":"Refresh Token"},"refresh_expires":{"type":"integer","title":"Refresh Expires"}},"type":"object","required":["access_token","token_type","expires"],"title":"TokenResponse"},"TrackMetaSchema":{"properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"artist":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Artist"},"album":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Album"},"year":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Year"},"genre":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Genre"},"track":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Track"},"disc":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Disc"},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration Seconds"},"has_embedded_cover":{"type":"boolean","title":"Has Embedded Cover","default":false},"cover_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cover Path"}},"type":"object","title":"TrackMetaSchema"},"UpdateStats":{"properties":{"processed":{"type":"integer","title":"Processed"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["processed","total"],"title":"UpdateStats"},"UpdateTaskMeta":{"properties":{"update_stats":{"anyOf":[{"$ref":"#/components/schemas/UpdateStats"},{"type":"null"}]}},"type":"object","required":["update_stats"],"title":"UpdateTaskMeta"},"UpdateTaskStatusResponse":{"properties":{"task_name":{"type":"string","title":"Task Name"},"task_id":{"type":"string","title":"Task Id"},"status":{"$ref":"#/components/schemas/JobStatus"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"enqueued_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Enqueued At"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"ended_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ended At"},"task_type":{"type":"string","const":"update","title":"Task Type"},"meta":{"$ref":"#/components/schemas/UpdateTaskMeta"}},"type":"object","required":["task_name","task_id","status","created_at","enqueued_at","started_at","ended_at","task_type","meta"],"title":"UpdateTaskStatusResponse"},"UserCollectionSchema":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"is_smart":{"type":"boolean","title":"Is Smart","default":false}},"type":"object","required":["id","name"],"title":"UserCollectionSchema"},"UserForm":{"properties":{"username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Username"},"password":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Password"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"},"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled"},"ra_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ra Username"},"avatar":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Avatar"},"ui_settings":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ui Settings"}},"type":"object","title":"UserForm"},"UserNoteSchema":{"properties":{"id":{"type":"integer","title":"Id"},"title":{"type":"string","title":"Title"},"content":{"type":"string","title":"Content"},"is_public":{"type":"boolean","title":"Is Public"},"tags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tags"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"user_id":{"type":"integer","title":"User Id"},"username":{"type":"string","title":"Username"},"user_avatar_path":{"type":"string","title":"User Avatar Path","default":""},"user_updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Updated At"}},"type":"object","required":["id","title","content","is_public","created_at","updated_at","user_id","username"],"title":"UserNoteSchema"},"UserPermissionsSchema":{"properties":{"user_id":{"type":"integer","title":"User Id"},"permission_group_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Permission Group Id"},"overrides":{"items":{"$ref":"#/components/schemas/OverrideSchemaIO"},"type":"array","title":"Overrides"},"hidden":{"items":{"$ref":"#/components/schemas/HiddenEntitySchema"},"type":"array","title":"Hidden"}},"type":"object","required":["user_id","permission_group_id","overrides","hidden"],"title":"UserPermissionsSchema","description":"Admin view of one user's permission assignment."},"UserPermissionsUpdate":{"properties":{"permission_group_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Permission Group Id"},"set_group":{"type":"boolean","title":"Set Group","default":false},"overrides":{"anyOf":[{"items":{"$ref":"#/components/schemas/OverrideSchemaIO"},"type":"array"},{"type":"null"}],"title":"Overrides"}},"type":"object","title":"UserPermissionsUpdate"},"UserSaveSchema":{"properties":{"id":{"type":"integer","title":"Id"},"rom_id":{"type":"integer","title":"Rom Id"},"user_id":{"type":"integer","title":"User Id"},"file_name":{"type":"string","title":"File Name"},"file_name_no_tags":{"type":"string","title":"File Name No Tags"},"file_name_no_ext":{"type":"string","title":"File Name No Ext"},"file_extension":{"type":"string","title":"File Extension"},"file_path":{"type":"string","title":"File Path"},"file_size_bytes":{"type":"integer","title":"File Size Bytes"},"full_path":{"type":"string","title":"Full Path"},"download_path":{"type":"string","title":"Download Path"},"missing_from_fs":{"type":"boolean","title":"Missing From Fs"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"emulator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emulator"},"slot":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slot"},"content_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Hash"},"is_public":{"type":"boolean","title":"Is Public","default":false},"screenshot":{"anyOf":[{"$ref":"#/components/schemas/ScreenshotSchema"},{"type":"null"}]},"origin_device_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Origin Device Id"},"device_syncs":{"items":{"$ref":"#/components/schemas/DeviceSyncSchema"},"type":"array","title":"Device Syncs","default":[]},"username":{"type":"string","title":"Username"},"user_avatar_path":{"type":"string","title":"User Avatar Path","default":""},"user_updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Updated At"}},"type":"object","required":["id","rom_id","user_id","file_name","file_name_no_tags","file_name_no_ext","file_extension","file_path","file_size_bytes","full_path","download_path","missing_from_fs","created_at","updated_at","emulator","screenshot","username"],"title":"UserSaveSchema","description":"A save enriched with its owner's username, for the community (My /\nCommunity) view. Mirrors UserScreenshotSchema."},"UserSchema":{"properties":{"id":{"type":"integer","title":"Id"},"username":{"type":"string","title":"Username"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"enabled":{"type":"boolean","title":"Enabled"},"role":{"$ref":"#/components/schemas/Role"},"permission_group_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Permission Group Id"},"oauth_scopes":{"items":{"type":"string"},"type":"array","title":"Oauth Scopes"},"avatar_path":{"type":"string","title":"Avatar Path"},"last_login":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Login"},"last_active":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Active"},"ra_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ra Username"},"ra_progression":{"anyOf":[{"$ref":"#/components/schemas/RAProgression"},{"type":"null"}]},"ui_settings":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Ui Settings"},"current_device_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Device Id"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","username","email","enabled","role","oauth_scopes","avatar_path","last_login","last_active","created_at","updated_at"],"title":"UserSchema"},"UserScreenshotSchema":{"properties":{"id":{"type":"integer","title":"Id"},"rom_id":{"type":"integer","title":"Rom Id"},"user_id":{"type":"integer","title":"User Id"},"file_name":{"type":"string","title":"File Name"},"file_name_no_tags":{"type":"string","title":"File Name No Tags"},"file_name_no_ext":{"type":"string","title":"File Name No Ext"},"file_extension":{"type":"string","title":"File Extension"},"file_path":{"type":"string","title":"File Path"},"file_size_bytes":{"type":"integer","title":"File Size Bytes"},"full_path":{"type":"string","title":"Full Path"},"download_path":{"type":"string","title":"Download Path"},"missing_from_fs":{"type":"boolean","title":"Missing From Fs"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"is_gallery":{"type":"boolean","title":"Is Gallery","default":false},"is_public":{"type":"boolean","title":"Is Public","default":false},"username":{"type":"string","title":"Username"},"user_avatar_path":{"type":"string","title":"User Avatar Path","default":""},"user_updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Updated At"}},"type":"object","required":["id","rom_id","user_id","file_name","file_name_no_tags","file_name_no_ext","file_extension","file_path","file_size_bytes","full_path","download_path","missing_from_fs","created_at","updated_at","username"],"title":"UserScreenshotSchema","description":"A gallery screenshot enriched with its owner's username, for the\ncommunity (My / Community) view. Mirrors UserNoteSchema."},"UserStateSchema":{"properties":{"id":{"type":"integer","title":"Id"},"rom_id":{"type":"integer","title":"Rom Id"},"user_id":{"type":"integer","title":"User Id"},"file_name":{"type":"string","title":"File Name"},"file_name_no_tags":{"type":"string","title":"File Name No Tags"},"file_name_no_ext":{"type":"string","title":"File Name No Ext"},"file_extension":{"type":"string","title":"File Extension"},"file_path":{"type":"string","title":"File Path"},"file_size_bytes":{"type":"integer","title":"File Size Bytes"},"full_path":{"type":"string","title":"Full Path"},"download_path":{"type":"string","title":"Download Path"},"missing_from_fs":{"type":"boolean","title":"Missing From Fs"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"emulator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Emulator"},"is_public":{"type":"boolean","title":"Is Public","default":false},"screenshot":{"anyOf":[{"$ref":"#/components/schemas/ScreenshotSchema"},{"type":"null"}]},"username":{"type":"string","title":"Username"},"user_avatar_path":{"type":"string","title":"User Avatar Path","default":""},"user_updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Updated At"}},"type":"object","required":["id","rom_id","user_id","file_name","file_name_no_tags","file_name_no_ext","file_extension","file_path","file_size_bytes","full_path","download_path","missing_from_fs","created_at","updated_at","emulator","screenshot","username"],"title":"UserStateSchema","description":"A state enriched with its owner's username, for the community (My /\nCommunity) view. Mirrors UserScreenshotSchema."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VirtualCollectionSchema":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"rom_ids":{"items":{"type":"integer"},"type":"array","uniqueItems":true,"title":"Rom Ids"},"rom_count":{"type":"integer","title":"Rom Count"},"path_cover_small":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Cover Small"},"path_cover_large":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Cover Large"},"path_covers_small":{"items":{"type":"string"},"type":"array","title":"Path Covers Small"},"path_covers_large":{"items":{"type":"string"},"type":"array","title":"Path Covers Large"},"is_public":{"type":"boolean","title":"Is Public","default":false},"is_favorite":{"type":"boolean","title":"Is Favorite","default":false},"is_virtual":{"type":"boolean","title":"Is Virtual","default":true},"is_smart":{"type":"boolean","title":"Is Smart","default":false},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"id":{"type":"string","title":"Id"},"type":{"type":"string","title":"Type"}},"type":"object","required":["name","description","rom_ids","rom_count","path_cover_small","path_cover_large","path_covers_small","path_covers_large","created_at","updated_at","id","type"],"title":"VirtualCollectionSchema"},"VolumeRequest":{"properties":{"level":{"type":"integer","maximum":100.0,"minimum":0.0,"title":"Level"}},"type":"object","required":["level"],"title":"VolumeRequest"},"WatcherTaskMeta":{"properties":{},"type":"object","title":"WatcherTaskMeta"},"WatcherTaskStatusResponse":{"properties":{"task_name":{"type":"string","title":"Task Name"},"task_id":{"type":"string","title":"Task Id"},"status":{"$ref":"#/components/schemas/JobStatus"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"enqueued_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Enqueued At"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"ended_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ended At"},"task_type":{"type":"string","const":"watcher","title":"Task Type"},"meta":{"$ref":"#/components/schemas/WatcherTaskMeta"}},"type":"object","required":["task_name","task_id","status","created_at","enqueued_at","started_at","ended_at","task_type","meta"],"title":"WatcherTaskStatusResponse"},"WebrcadeFeedCategorySchema":{"properties":{"title":{"type":"string","title":"Title"},"longTitle":{"type":"string","title":"Longtitle"},"background":{"type":"string","title":"Background"},"thumbnail":{"type":"string","title":"Thumbnail"},"description":{"type":"string","title":"Description"},"items":{"items":{"$ref":"#/components/schemas/WebrcadeFeedItemSchema"},"type":"array","title":"Items"}},"type":"object","required":["title","items"],"title":"WebrcadeFeedCategorySchema"},"WebrcadeFeedItemPropsSchema":{"properties":{"rom":{"type":"string","title":"Rom"}},"type":"object","required":["rom"],"title":"WebrcadeFeedItemPropsSchema"},"WebrcadeFeedItemSchema":{"properties":{"title":{"type":"string","title":"Title"},"longTitle":{"type":"string","title":"Longtitle"},"description":{"type":"string","title":"Description"},"type":{"type":"string","title":"Type"},"thumbnail":{"type":"string","title":"Thumbnail"},"background":{"type":"string","title":"Background"},"props":{"$ref":"#/components/schemas/WebrcadeFeedItemPropsSchema"}},"type":"object","required":["title","type","props"],"title":"WebrcadeFeedItemSchema"},"WebrcadeFeedSchema":{"properties":{"title":{"type":"string","title":"Title"},"longTitle":{"type":"string","title":"Longtitle"},"description":{"type":"string","title":"Description"},"thumbnail":{"type":"string","title":"Thumbnail"},"background":{"type":"string","title":"Background"},"categories":{"items":{"$ref":"#/components/schemas/WebrcadeFeedCategorySchema"},"type":"array","title":"Categories"}},"type":"object","required":["title","categories"],"title":"WebrcadeFeedSchema"}},"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{"me.read":"View your profile","roms.read":"View ROMs","platforms.read":"View platforms","assets.read":"View assets","devices.read":"View devices","firmware.read":"View firmware","roms.user.read":"View user-rom properties","collections.read":"View collections","playlists.read":"View music playlists","me.write":"Modify your profile","assets.write":"Modify assets","devices.write":"Modify devices","roms.user.write":"Modify user-rom properties","collections.write":"Modify collections","playlists.write":"Modify music playlists","roms.write":"Modify ROMs","platforms.write":"Modify platforms","firmware.write":"Modify firmware","users.read":"View users","users.write":"Modify users","tasks.run":"Run tasks","logs.read":"View backend logs"},"tokenUrl":"/token"}}},"HTTPBasic":{"type":"http","scheme":"basic"}}}} \ No newline at end of file diff --git a/pak/launch.sh b/pak/launch.sh new file mode 100755 index 0000000..f4d6d85 --- /dev/null +++ b/pak/launch.sh @@ -0,0 +1,296 @@ +#!/bin/sh +# RomM Companion Pak for NextUI (TrimUI Brick / Smart Pro tg5040 & Smart Pro S tg5050) + +PAK_DIR="$(cd "$(dirname "$0")" && pwd)" +cd "$PAK_DIR" || exit 1 + +BIN="$PAK_DIR/bin/romm-nextui" +TMP_DIR="/tmp/romm-nextui" +mkdir -p "$TMP_DIR" + +LOG_DIR="${LOGS_PATH:-$TMP_DIR}" +mkdir -p "$LOG_DIR" +LOG_FILE="$LOG_DIR/romm-companion.log" + +{ + echo "=== RomM Companion launched at $(date) ===" + echo "PLATFORM=${PLATFORM:-unset} SDCARD_PATH=${SDCARD_PATH:-unset} PAK_DIR=$PAK_DIR" +} >> "$LOG_FILE" + +# Resolve platform-specific NextUI binaries (tg5050 for Smart Pro S, tg5040 for Brick / Smart Pro) +PLAT="${PLATFORM:-}" +if [ -z "$PLAT" ]; then + case "$PAK_DIR" in + *tg5050*) PLAT="tg5050" ;; + *tg5040*) PLAT="tg5040" ;; + *) PLAT="tg5050" ;; + esac +fi + +find_ui_tool() { + TOOL="$1" + if [ -x "$PAK_DIR/bin/$PLAT/$TOOL" ]; then + echo "$PAK_DIR/bin/$PLAT/$TOOL" + elif [ -x "$PAK_DIR/bin/$TOOL" ]; then + echo "$PAK_DIR/bin/$TOOL" + elif command -v "$TOOL" >/dev/null 2>&1; then + command -v "$TOOL" + else + echo "" + fi +} + +MINUI_LIST="$(find_ui_tool minui-list)" +MINUI_PRESENTER="$(find_ui_tool minui-presenter)" + +echo "Resolved PLAT=$PLAT MINUI_LIST=$MINUI_LIST MINUI_PRESENTER=$MINUI_PRESENTER" >> "$LOG_FILE" + +show_message() { + MSG="$1" + BTN="${2:-OK}" + if [ -n "$MINUI_PRESENTER" ]; then + "$MINUI_PRESENTER" \ + --message "$MSG" \ + --confirm-show \ + --confirm-button A \ + --confirm-text "$BTN" \ + --timeout -1 >> "$LOG_FILE" 2>&1 + else + echo "$MSG" >> "$LOG_FILE" + fi +} + +BUSY_PID="" +start_busy() { + stop_busy + if [ -n "$MINUI_PRESENTER" ]; then + "$MINUI_PRESENTER" --message "$1" --timeout 0 >> "$LOG_FILE" 2>&1 & + BUSY_PID=$! + fi +} + +stop_busy() { + if [ -n "$BUSY_PID" ]; then + kill "$BUSY_PID" 2>/dev/null + wait "$BUSY_PID" 2>/dev/null + BUSY_PID="" + fi +} + +# Runs minui-list using --write-location (reliable across all NextUI platforms) +pick_from_list() { + LIST_FILE="$1" + TITLE="$2" + OUT_FILE="$TMP_DIR/selection.txt" + rm -f "$OUT_FILE" + "$MINUI_LIST" \ + --file "$LIST_FILE" \ + --format json \ + --title "$TITLE" \ + --write-location "$OUT_FILE" >> "$LOG_FILE" 2>&1 + if [ -s "$OUT_FILE" ]; then + cat "$OUT_FILE" + fi +} + +if [ ! -x "$BIN" ]; then + show_message "romm-nextui binary missing!\nRun build-pak.sh to bundle the aarch64 binary." "Exit" + exit 1 +fi + +if [ -z "$MINUI_LIST" ] || [ -z "$MINUI_PRESENTER" ]; then + echo "ERROR: minui-list or minui-presenter missing for $PLAT" >> "$LOG_FILE" + exit 1 +fi + +run_sync() { + start_busy "Syncing saves & states with RomM 5.1.0..." + OUT="$("$BIN" sync 2>&1)" + stop_busy + echo "$OUT" >> "$LOG_FILE" + show_message "$OUT" "Done" +} + +run_web_setup() { + IP="$("$BIN" ip 2>/dev/null)" + [ -z "$IP" ] && IP="127.0.0.1" + PORT="8765" + + "$BIN" web-setup --port "$PORT" >> "$LOG_FILE" 2>&1 & + WEB_PID=$! + + show_message "Web Setup Running!\n\nOpen on your phone or PC:\nhttp://${IP}:${PORT}\n\nPress A when finished." "Stop Server" + kill "$WEB_PID" 2>/dev/null + wait "$WEB_PID" 2>/dev/null +} + +# Extracts a numeric field from the matching JSON item in a minui-list file by exact "name" +lookup_field_by_name() { + JSON_FILE="$1" + TARGET_NAME="$2" + FIELD="$3" + # Each item is on one compact line or object; match the object containing "name":"TARGET_NAME" + awk -v name="$TARGET_NAME" -v field="$FIELD" ' + BEGIN { RS="}" } + index($0, "\"name\":\"" name "\"") > 0 { + if (match($0, "\"" field "\":[[:space:]]*\"?[^,\"]+\"?")) { + val = substr($0, RSTART, RLENGTH) + sub("^\"[^\"]+\":[[:space:]]*\"?", "", val) + sub("\"$", "", val) + print val + exit + } + } + ' "$JSON_FILE" +} + +run_download_roms() { + start_busy "Loading platforms from RomM..." + "$BIN" platforms-menu > "$TMP_DIR/platforms.json" 2>> "$LOG_FILE" + RC=$? + stop_busy + if [ $RC -ne 0 ] || ! grep -q "platform_id" "$TMP_DIR/platforms.json"; then + show_message "Could not load platforms.\nCheck Wi-Fi and connect via Web Setup first." "OK" + return + fi + + PLAT_NAME="$(pick_from_list "$TMP_DIR/platforms.json" "RomM Platforms")" + [ -z "$PLAT_NAME" ] && return + PLAT_ID="$(lookup_field_by_name "$TMP_DIR/platforms.json" "$PLAT_NAME" "platform_id")" + [ -z "$PLAT_ID" ] && return + + start_busy "Loading ROMs..." + "$BIN" roms-menu --platform-id "$PLAT_ID" > "$TMP_DIR/roms.json" 2>> "$LOG_FILE" + stop_busy + if ! grep -q "rom_id" "$TMP_DIR/roms.json"; then + show_message "No ROMs found for this platform." "OK" + return + fi + + ROM_NAME="$(pick_from_list "$TMP_DIR/roms.json" "Download ROM")" + [ -z "$ROM_NAME" ] && return + ROM_ID="$(lookup_field_by_name "$TMP_DIR/roms.json" "$ROM_NAME" "rom_id")" + [ -z "$ROM_ID" ] && return + + start_busy "Downloading ROM to SD card..." + OUT="$("$BIN" download-rom --rom-id "$ROM_ID" 2>&1)" + stop_busy + echo "$OUT" >> "$LOG_FILE" + show_message "$OUT" "OK" +} + +run_game_saves() { + start_busy "Loading platforms from RomM..." + "$BIN" platforms-menu > "$TMP_DIR/platforms.json" 2>> "$LOG_FILE" + RC=$? + stop_busy + if [ $RC -ne 0 ] || ! grep -q "platform_id" "$TMP_DIR/platforms.json"; then + show_message "Could not load platforms.\nCheck Wi-Fi and connect via Web Setup first." "OK" + return + fi + + PLAT_NAME="$(pick_from_list "$TMP_DIR/platforms.json" "Select Platform")" + [ -z "$PLAT_NAME" ] && return + PLAT_ID="$(lookup_field_by_name "$TMP_DIR/platforms.json" "$PLAT_NAME" "platform_id")" + [ -z "$PLAT_ID" ] && return + + start_busy "Loading games..." + "$BIN" roms-menu --platform-id "$PLAT_ID" > "$TMP_DIR/roms.json" 2>> "$LOG_FILE" + stop_busy + ROM_NAME="$(pick_from_list "$TMP_DIR/roms.json" "Select Game")" + [ -z "$ROM_NAME" ] && return + ROM_ID="$(lookup_field_by_name "$TMP_DIR/roms.json" "$ROM_NAME" "rom_id")" + [ -z "$ROM_ID" ] && return + + start_busy "Loading saves & states..." + "$BIN" rom-saves-menu --rom-id "$ROM_ID" > "$TMP_DIR/rom_saves.json" 2>> "$LOG_FILE" + stop_busy + SAVE_NAME="$(pick_from_list "$TMP_DIR/rom_saves.json" "Game Saves & States")" + [ -z "$SAVE_NAME" ] && return + + KIND="$(lookup_field_by_name "$TMP_DIR/rom_saves.json" "$SAVE_NAME" "kind")" + ITEM_ID="$(lookup_field_by_name "$TMP_DIR/rom_saves.json" "$SAVE_NAME" "id")" + + case "$KIND" in + pull_save) + start_busy "Pulling save to SD card..." + OUT="$("$BIN" pull-save --save-id "$ITEM_ID" --rom-id "$ROM_ID" 2>&1)" + stop_busy + ;; + pull_state) + start_busy "Pulling state to SD card..." + OUT="$("$BIN" pull-state --state-id "$ITEM_ID" --rom-id "$ROM_ID" 2>&1)" + stop_busy + ;; + push_local) + start_busy "Pushing local saves to RomM..." + OUT="$("$BIN" push-rom-saves --rom-id "$ROM_ID" 2>&1)" + stop_busy + ;; + *) return ;; + esac + echo "$OUT" >> "$LOG_FILE" + show_message "$OUT" "OK" +} + +run_conflicts() { + "$BIN" conflicts-menu > "$TMP_DIR/conflicts.json" 2>> "$LOG_FILE" + if ! grep -q "conflict_id" "$TMP_DIR/conflicts.json"; then + show_message "No pending save conflicts!" "OK" + return + fi + + C_NAME="$(pick_from_list "$TMP_DIR/conflicts.json" "Save Conflicts")" + [ -z "$C_NAME" ] && return + CID="$(lookup_field_by_name "$TMP_DIR/conflicts.json" "$C_NAME" "conflict_id")" + [ -z "$CID" ] && return + + cat > "$TMP_DIR/resolve.json" <<'EOF' +{"items":[{"name":"Keep Handheld Save (Upload)"},{"name":"Keep RomM Server Save (Backup & Download)"}]} +EOF + CHOICE="$(pick_from_list "$TMP_DIR/resolve.json" "Resolve Conflict")" + case "$CHOICE" in + "Keep Handheld Save (Upload)") RES="keep_local" ;; + "Keep RomM Server Save (Backup & Download)") RES="keep_server" ;; + *) return ;; + esac + + start_busy "Resolving conflict..." + OUT="$("$BIN" resolve-conflict --id "$CID" --resolution "$RES" 2>&1)" + stop_busy + show_message "$OUT" "OK" +} + +# Main NextUI D-pad Menu Loop +cat > "$TMP_DIR/menu.json" <<'EOF' +{ + "items": [ + {"name": "Sync Saves & States Now"}, + {"name": "Download ROMs from RomM"}, + {"name": "Pull / Push Game Save"}, + {"name": "Web Setup (Phone / PC)"}, + {"name": "Resolve Save Conflicts"}, + {"name": "Connection & SD Status"}, + {"name": "Exit"} + ] +} +EOF + +while true; do + SELECTED="$(pick_from_list "$TMP_DIR/menu.json" "RomM Companion")" + case "$SELECTED" in + "Sync Saves & States Now") run_sync ;; + "Download ROMs from RomM") run_download_roms ;; + "Pull / Push Game Save") run_game_saves ;; + "Web Setup (Phone / PC)") run_web_setup ;; + "Resolve Save Conflicts") run_conflicts ;; + "Connection & SD Status") + OUT="$("$BIN" status --text 2>&1)" + show_message "$OUT" "Back" + ;; + "Exit"|"") break ;; + esac +done + +stop_busy +exit 0 diff --git a/pak/pak.json b/pak/pak.json new file mode 100644 index 0000000..920b591 --- /dev/null +++ b/pak/pak.json @@ -0,0 +1,9 @@ +{ + "name": "RomM Companion", + "type": "TOOL", + "description": "Two-way RomM 5.1.0 save & state sync, ROM downloader, and phone web setup for NextUI handhelds.", + "author": "RomM Companion", + "version": "0.1.0", + "platforms": ["tg5040", "tg5050"], + "launch": "launch.sh" +} diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..488d56f --- /dev/null +++ b/src/config.rs @@ -0,0 +1,193 @@ +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; +use std::env; +use std::fs; +use std::path::PathBuf; +use uuid::Uuid; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ConnectionConfig { + pub server_url: String, + pub access_token: Option, + pub refresh_token: Option, + pub username: Option, + pub device_id: Option, + pub device_name: String, + pub client_device_identifier: String, +} + +impl Default for ConnectionConfig { + fn default() -> Self { + let platform = env::var("PLATFORM").unwrap_or_else(|_| "tg5040".to_string()); + let label = match platform.as_str() { + "tg5050" => "TrimUI Smart Pro S (NextUI)", + "tg5040" => "TrimUI Handheld (NextUI)", + other => other, + }; + Self { + server_url: String::new(), + access_token: None, + refresh_token: None, + username: None, + device_id: None, + device_name: label.to_string(), + client_device_identifier: Uuid::new_v4().to_string(), + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ManualLink { + pub local_path: String, + pub rom_id: i64, + pub rom_name: String, + pub system_tag: String, + pub slot: String, + pub is_state: bool, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct NextUiSettings { + pub sync_states: bool, + pub max_backups_per_save: usize, + pub default_slot: String, + pub web_port: u16, + /// Optional custom NextUI tag -> RomM platform slug overrides (e.g. "PCE" -> "tg16") + #[serde(default)] + pub tag_overrides: HashMap, +} + +impl Default for NextUiSettings { + fn default() -> Self { + Self { + sync_states: true, + max_backups_per_save: 5, + default_slot: "default".to_string(), + web_port: 8765, + tag_overrides: HashMap::new(), + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SyncLogEntry { + pub timestamp: String, + pub level: String, + pub action: String, + pub message: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +#[serde(rename_all = "camelCase")] +pub struct NextUiConfig { + pub connection: ConnectionConfig, + pub settings: NextUiSettings, + #[serde(default)] + pub manual_links: HashMap, + #[serde(default)] + pub synced_state_hashes: HashMap, + #[serde(default)] + pub sync_logs: Vec, +} + +/// Resolves the NextUI SD card root directory (`$SDCARD_PATH` on TrimUI, or `/mnt/SDCARD`). +pub fn sdcard_root() -> PathBuf { + if let Ok(p) = env::var("SDCARD_PATH") { + if !p.trim().is_empty() { + return PathBuf::from(p); + } + } + let default_trimui = PathBuf::from("/mnt/SDCARD"); + if default_trimui.exists() { + return default_trimui; + } + env::current_dir().unwrap_or_else(|_| PathBuf::from(".")) +} + +/// Resolves NextUI's Saves root (`$SAVES_PATH` or `$SDCARD_PATH/Saves`). +pub fn saves_root() -> PathBuf { + if let Ok(p) = env::var("SAVES_PATH") { + if !p.trim().is_empty() { + return PathBuf::from(p); + } + } + sdcard_root().join("Saves") +} + +/// Resolves NextUI's Roms root (`$ROMS_PATH` or `$SDCARD_PATH/Roms`). +pub fn roms_root() -> PathBuf { + if let Ok(p) = env::var("ROMS_PATH") { + if !p.trim().is_empty() { + return PathBuf::from(p); + } + } + sdcard_root().join("Roms") +} + +/// Resolves persistent config/data dir (`$USERDATA_PATH/romm-companion` or `$SDCARD_PATH/.userdata/shared/romm-companion`). +pub fn data_dir() -> PathBuf { + let base = if let Ok(p) = env::var("USERDATA_PATH") { + if !p.trim().is_empty() { + PathBuf::from(p) + } else { + sdcard_root().join(".userdata/shared") + } + } else { + sdcard_root().join(".userdata/shared") + }; + let dir = base.join("romm-companion"); + let _ = fs::create_dir_all(&dir); + dir +} + +pub fn backups_dir() -> PathBuf { + let dir = data_dir().join("backups"); + let _ = fs::create_dir_all(&dir); + dir +} + +pub fn config_path() -> PathBuf { + data_dir().join("config.json") +} + +pub fn conflicts_path() -> PathBuf { + data_dir().join("conflicts.json") +} + +pub fn load_config() -> NextUiConfig { + let path = config_path(); + if let Ok(raw) = fs::read_to_string(&path) { + if let Ok(cfg) = serde_json::from_str::(&raw) { + return cfg; + } + } + NextUiConfig::default() +} + +pub fn save_config(cfg: &NextUiConfig) -> Result<(), String> { + let path = config_path(); + if let Some(parent) = path.parent() { + fs::create_dir_all(parent).map_err(|e| e.to_string())?; + } + let json = serde_json::to_string_pretty(cfg).map_err(|e| e.to_string())?; + fs::write(&path, json).map_err(|e| e.to_string()) +} + +pub fn push_log(cfg: &mut NextUiConfig, level: &str, action: &str, message: impl Into) { + cfg.sync_logs.insert( + 0, + SyncLogEntry { + timestamp: chrono::Utc::now().to_rfc3339(), + level: level.to_string(), + action: action.to_string(), + message: message.into(), + }, + ); + if cfg.sync_logs.len() > 150 { + cfg.sync_logs.truncate(150); + } +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..0cb3c46 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,370 @@ +mod config; +mod matcher; +mod nextui; +mod romm_api; +mod sync_engine; +mod web_setup; + +use config::{load_config, push_log, save_config}; +use matcher::discover_nextui_saves; +use nextui::{discover_nextui_systems, resolve_rom_dest_folder}; +use romm_api::RommClient; +use std::env; +use sync_engine::{ + load_conflicts, pull_single_save, pull_single_state, push_single_item, resolve_conflict, + run_sync, +}; + +#[tokio::main] +async fn main() { + let args: Vec = env::args().collect(); + let cmd = args.get(1).map(|s| s.as_str()).unwrap_or("status"); + + let res = match cmd { + "status" => cmd_status(args.iter().any(|a| a == "--text")), + "sync" => cmd_sync().await, + "platforms-menu" => cmd_platforms_menu().await, + "roms-menu" => { + let pid = flag_value(&args, "--platform-id").and_then(|v| v.parse::().ok()); + cmd_roms_menu(pid).await + } + "download-rom" => { + let rom_id = flag_value(&args, "--rom-id") + .and_then(|v| v.parse::().ok()) + .unwrap_or(0); + cmd_download_rom(rom_id).await + } + "rom-saves-menu" => { + let rom_id = flag_value(&args, "--rom-id") + .and_then(|v| v.parse::().ok()) + .unwrap_or(0); + cmd_rom_saves_menu(rom_id).await + } + "pull-save" => { + let save_id = flag_value(&args, "--save-id") + .and_then(|v| v.parse::().ok()) + .unwrap_or(0); + let rom_id = flag_value(&args, "--rom-id") + .and_then(|v| v.parse::().ok()) + .unwrap_or(0); + cmd_pull_save(save_id, rom_id).await + } + "pull-state" => { + let state_id = flag_value(&args, "--state-id") + .and_then(|v| v.parse::().ok()) + .unwrap_or(0); + let rom_id = flag_value(&args, "--rom-id") + .and_then(|v| v.parse::().ok()) + .unwrap_or(0); + cmd_pull_state(state_id, rom_id).await + } + "push-rom-saves" => { + let rom_id = flag_value(&args, "--rom-id") + .and_then(|v| v.parse::().ok()) + .unwrap_or(0); + cmd_push_rom_saves(rom_id).await + } + "conflicts-menu" => cmd_conflicts_menu(), + "resolve-conflict" => { + let id = flag_value(&args, "--id").unwrap_or_default(); + let resolution = flag_value(&args, "--resolution").unwrap_or_else(|| "keep_local".into()); + cmd_resolve_conflict(&id, &resolution).await + } + "web-setup" => { + let port = flag_value(&args, "--port") + .and_then(|v| v.parse::().ok()) + .unwrap_or_else(|| load_config().settings.web_port); + web_setup::serve_web_setup(port).await + } + "ip" => { + println!("{}", web_setup::local_lan_ip()); + Ok(()) + } + _ => { + eprintln!( + "Usage: romm-nextui " + ); + Ok(()) + } + }; + + if let Err(e) = res { + eprintln!("ERROR: {}", e); + std::process::exit(1); + } +} + +fn flag_value(args: &[String], flag: &str) -> Option { + args.iter() + .position(|a| a == flag) + .and_then(|i| args.get(i + 1)) + .cloned() +} + +fn cmd_status(text_mode: bool) -> Result<(), String> { + let cfg = load_config(); + let systems = discover_nextui_systems(&cfg); + let conflicts = load_conflicts(); + let connected = cfg.connection.access_token.is_some() && !cfg.connection.server_url.is_empty(); + + if text_mode { + if connected { + println!( + "Server: {}\nUser: {}\nDevice: {}\nNextUI Systems: {}\nPending Conflicts: {}", + cfg.connection.server_url, + cfg.connection.username.as_deref().unwrap_or("?"), + cfg.connection.device_name, + systems.len(), + conflicts.len() + ); + } else { + println!( + "Not connected to RomM.\nOpen 'Web Setup (Phone / PC)' to pair this handheld.\nDetected NextUI Systems: {}", + systems.len() + ); + } + } else { + println!( + "{}", + serde_json::json!({ + "connected": connected, + "serverUrl": cfg.connection.server_url, + "username": cfg.connection.username, + "deviceName": cfg.connection.device_name, + "systems": systems.len(), + "conflicts": conflicts.len() + }) + ); + } + Ok(()) +} + +async fn cmd_sync() -> Result<(), String> { + let mut cfg = load_config(); + if cfg.connection.access_token.is_none() || cfg.connection.server_url.is_empty() { + return Err("Not connected to RomM. Launch Web Setup first.".into()); + } + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let roms = client.get_all_roms().await?; + let summary = run_sync(&client, &mut cfg, &roms).await?; + save_config(&cfg)?; + + println!( + "Sync Complete!\nUploaded Saves: {}\nDownloaded Saves: {}\nSynced States: {}\nUp To Date: {}\nConflicts: {}\nErrors: {}", + summary.uploaded_saves, + summary.downloaded_saves, + summary.uploaded_states, + summary.up_to_date, + summary.conflicts.len(), + summary.errors.len() + ); + Ok(()) +} + +/// Outputs a `minui-list`-compatible JSON object of RomM platforms. +async fn cmd_platforms_menu() -> Result<(), String> { + let cfg = load_config(); + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let platforms = client.get_platforms().await?; + let items: Vec = platforms + .into_iter() + .filter(|p| p.rom_count > 0) + .map(|p| { + serde_json::json!({ + "name": format!("{} ({})", p.display_name, p.rom_count), + "platform_id": p.id, + "slug": p.slug + }) + }) + .collect(); + println!("{}", serde_json::json!({ "items": items })); + Ok(()) +} + +/// Outputs a `minui-list`-compatible JSON object of ROMs for a platform. +async fn cmd_roms_menu(platform_id: Option) -> Result<(), String> { + let cfg = load_config(); + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let page = client.get_roms(platform_id, None, 200, 0).await?; + let items: Vec = page + .items + .into_iter() + .map(|r| { + let label = r.name.unwrap_or(r.fs_name_no_ext); + serde_json::json!({ + "name": label, + "rom_id": r.id, + "file_name": r.fs_name + }) + }) + .collect(); + println!("{}", serde_json::json!({ "items": items })); + Ok(()) +} + +async fn cmd_download_rom(rom_id: i64) -> Result<(), String> { + if rom_id <= 0 { + return Err("Invalid --rom-id".into()); + } + let mut cfg = load_config(); + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let roms = client.get_all_roms().await?; + let rom = roms + .into_iter() + .find(|r| r.id == rom_id) + .ok_or_else(|| format!("ROM #{} not found on server", rom_id))?; + + let dest_dir = resolve_rom_dest_folder(&rom.platform_slug, &rom.platform_display_name, &cfg); + let dest_file = dest_dir.join(&rom.fs_name); + let bytes = client.download_rom(rom.id, &rom.fs_name, &dest_file).await?; + push_log( + &mut cfg, + "success", + "download_rom", + format!("Downloaded {} ({} bytes)", rom.fs_name, bytes), + ); + save_config(&cfg)?; + println!("Downloaded to:\n{}", dest_file.display()); + Ok(()) +} + +/// Lists all server saves, server states, and local matched saves for a single ROM in `minui-list` format. +async fn cmd_rom_saves_menu(rom_id: i64) -> Result<(), String> { + if rom_id <= 0 { + return Err("Invalid --rom-id".into()); + } + let cfg = load_config(); + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let saves = client + .get_saves(Some(rom_id), cfg.connection.device_id.as_deref()) + .await + .unwrap_or_default(); + let states = client.get_states(Some(rom_id)).await.unwrap_or_default(); + + let mut items: Vec = Vec::new(); + for s in saves { + items.push(serde_json::json!({ + "name": format!("[Pull Save] {} ({})", s.file_name, s.slot.as_deref().unwrap_or("manual")), + "kind": "pull_save", + "id": s.id + })); + } + for st in states { + items.push(serde_json::json!({ + "name": format!("[Pull State] {}", st.file_name), + "kind": "pull_state", + "id": st.id + })); + } + items.push(serde_json::json!({ + "name": "[Push] Upload Local Saves & States for This Game", + "kind": "push_local", + "id": rom_id + })); + println!("{}", serde_json::json!({ "items": items })); + Ok(()) +} + +async fn cmd_pull_save(save_id: i64, rom_id: i64) -> Result<(), String> { + let mut cfg = load_config(); + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let roms = client.get_all_roms().await?; + let rom = roms + .into_iter() + .find(|r| r.id == rom_id) + .ok_or_else(|| format!("ROM #{} not found", rom_id))?; + let saves = client + .get_saves(Some(rom_id), cfg.connection.device_id.as_deref()) + .await?; + let save = saves + .into_iter() + .find(|s| s.id == save_id) + .ok_or_else(|| format!("Save #{} not found", save_id))?; + + let dest = pull_single_save( + &client, + &mut cfg, + save.id, + rom.id, + &rom.platform_slug, + &save.file_name, + ) + .await?; + save_config(&cfg)?; + println!("Save downloaded to:\n{}", dest); + Ok(()) +} + +async fn cmd_pull_state(state_id: i64, rom_id: i64) -> Result<(), String> { + let mut cfg = load_config(); + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let roms = client.get_all_roms().await?; + let rom = roms + .into_iter() + .find(|r| r.id == rom_id) + .ok_or_else(|| format!("ROM #{} not found", rom_id))?; + let states = client.get_states(Some(rom_id)).await?; + let st = states + .into_iter() + .find(|s| s.id == state_id) + .ok_or_else(|| format!("State #{} not found", state_id))?; + + let dest = pull_single_state( + &client, + &mut cfg, + st.id, + rom.id, + &rom.platform_slug, + &st.file_name, + ) + .await?; + save_config(&cfg)?; + println!("State downloaded to:\n{}", dest); + Ok(()) +} + +async fn cmd_push_rom_saves(rom_id: i64) -> Result<(), String> { + let mut cfg = load_config(); + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let roms = client.get_all_roms().await?; + let local = discover_nextui_saves(&cfg, &roms); + let matched: Vec<_> = local + .into_iter() + .filter(|i| i.matched_rom_id == Some(rom_id)) + .collect(); + if matched.is_empty() { + return Err("No local saves or states found on SD card for this game.".into()); + } + let mut count = 0usize; + for item in matched { + push_single_item(&client, &mut cfg, &item, rom_id).await?; + count += 1; + } + save_config(&cfg)?; + println!("Uploaded {} local save/state file(s) to RomM!", count); + Ok(()) +} + +fn cmd_conflicts_menu() -> Result<(), String> { + let conflicts = load_conflicts(); + let items: Vec = conflicts + .into_iter() + .map(|c| { + serde_json::json!({ + "name": format!("{} ({})", c.rom_name, c.file_name), + "conflict_id": c.id + }) + }) + .collect(); + println!("{}", serde_json::json!({ "items": items })); + Ok(()) +} + +async fn cmd_resolve_conflict(conflict_id: &str, resolution: &str) -> Result<(), String> { + let mut cfg = load_config(); + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let msg = resolve_conflict(&client, &mut cfg, conflict_id, resolution).await?; + save_config(&cfg)?; + println!("{}", msg); + Ok(()) +} diff --git a/src/matcher.rs b/src/matcher.rs new file mode 100644 index 0000000..466928e --- /dev/null +++ b/src/matcher.rs @@ -0,0 +1,381 @@ +use crate::config::{ManualLink, NextUiConfig}; +use crate::nextui::{classify_nextui_save_file, discover_nextui_systems}; +use crate::romm_api::SimpleRomSchema; +use chrono::{DateTime, Utc}; +use serde::{Deserialize, Serialize}; +use sha2::{Digest, Sha256}; +use std::collections::{HashMap, HashSet}; +use std::fs; +use std::io::Write; +use std::path::{Path, PathBuf}; +use walkdir::WalkDir; +use zip::write::SimpleFileOptions; +use zip::ZipWriter; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DiscoveredNextUiSave { + pub local_path: String, + pub file_name: String, + pub system_tag: String, + pub is_directory: bool, + pub is_state: bool, + pub size_bytes: u64, + pub updated_at: String, + pub slot: String, + pub matched_rom_id: Option, + pub matched_rom_name: Option, + pub matched_platform: Option, + pub match_confidence: f32, + pub match_source: String, // "manual" | "exact" | "fuzzy" | "unmatched" +} + +pub fn normalize_title(input: &str) -> String { + let mut cleaned = String::with_capacity(input.len()); + let mut paren = 0usize; + let mut bracket = 0usize; + for ch in input.chars() { + match ch { + '(' => paren += 1, + ')' => paren = paren.saturating_sub(1), + '[' => bracket += 1, + ']' => bracket = bracket.saturating_sub(1), + _ if paren == 0 && bracket == 0 => { + if ch.is_alphanumeric() { + for lc in ch.to_lowercase() { + cleaned.push(lc); + } + } else { + cleaned.push(' '); + } + } + _ => {} + } + } + cleaned.split_whitespace().collect::>().join(" ") +} + +fn tokenize(norm: &str) -> HashSet { + norm.split_whitespace() + .filter(|t| t.len() >= 2) + .map(|s| s.to_string()) + .collect() +} + +pub fn similarity_score(a: &str, b: &str) -> f32 { + let na = normalize_title(a); + let nb = normalize_title(b); + if na.is_empty() || nb.is_empty() { + return 0.0; + } + if na == nb { + return 1.0; + } + if na.contains(&nb) || nb.contains(&na) { + let min_len = na.len().min(nb.len()) as f32; + let max_len = na.len().max(nb.len()) as f32; + if min_len >= 4.0 { + return 0.78 + 0.18 * (min_len / max_len); + } + } + let ta = tokenize(&na); + let tb = tokenize(&nb); + if ta.is_empty() || tb.is_empty() { + return 0.0; + } + let inter = ta.intersection(&tb).count() as f32; + let union = ta.union(&tb).count() as f32; + inter / union +} + +pub fn match_stem_to_roms<'a>( + stem: &str, + platform_slugs: &[String], + roms: &'a [SimpleRomSchema], +) -> Option<(&'a SimpleRomSchema, f32, &'static str)> { + let stem_lower = stem.trim().to_lowercase(); + let stem_norm = normalize_title(stem); + if stem_lower.is_empty() && stem_norm.is_empty() { + return None; + } + + let mut best: Option<(&SimpleRomSchema, f32, &'static str)> = None; + for rom in roms { + let platform_bonus: f32 = if platform_slugs.is_empty() { + 0.0 + } else { + let p_slug = rom.platform_slug.to_lowercase(); + let p_fs = rom.platform_fs_slug.to_lowercase(); + if platform_slugs + .iter() + .any(|s| s.eq_ignore_ascii_case(&p_slug) || s.eq_ignore_ascii_case(&p_fs)) + { + 0.08 + } else { + -0.15 + } + }; + + if rom.fs_name_no_ext.to_lowercase() == stem_lower + || rom.fs_name_no_tags.to_lowercase() == stem_lower + { + let score = (1.0 + platform_bonus).min(1.0); + if best.map_or(true, |(_, bs, _)| score > bs) { + best = Some((rom, score, "exact")); + } + continue; + } + + let mut sim = similarity_score(stem, &rom.fs_name_no_tags); + if let Some(ref name) = rom.name { + sim = sim.max(similarity_score(stem, name)); + } + let adjusted = (sim + platform_bonus).clamp(0.0, 1.0); + if sim >= 0.55 && best.map_or(true, |(_, bs, _)| adjusted > bs) { + let src = if sim >= 0.99 { "exact" } else { "fuzzy" }; + best = Some((rom, adjusted, src)); + } + } + best +} + +pub fn discover_nextui_saves( + cfg: &NextUiConfig, + roms: &[SimpleRomSchema], +) -> Vec { + let systems = discover_nextui_systems(cfg); + let mut results = Vec::new(); + + for sys in systems { + let Some(ref save_folder) = sys.save_folder else { + continue; + }; + let save_root = Path::new(save_folder); + if !save_root.exists() { + continue; + } + + // Special case: PPSSPP SAVEDATA folders under /Saves/PSP/ + if sys.tag.eq_ignore_ascii_case("PSP") { + let psp_savedata = save_root.join("PSP/SAVEDATA"); + let scan_dir = if psp_savedata.exists() { + psp_savedata + } else { + save_root.to_path_buf() + }; + if let Ok(entries) = fs::read_dir(&scan_dir) { + for entry in entries.flatten() { + let p = entry.path(); + if p.is_dir() { + let name = entry.file_name().to_string_lossy().to_string(); + if name.starts_with('.') || name == "PSP" { + continue; + } + let (size, updated) = dir_size_and_mtime(&p); + if size == 0 { + continue; + } + results.push(build_item( + &p, + format!("{}.zip", name), + &name, + &sys.tag, + &sys.romm_slugs, + true, + false, + size, + updated, + &cfg.settings.default_slot, + roms, + &cfg.manual_links, + )); + } + } + } + } + + for entry in WalkDir::new(save_root) + .max_depth(2) + .into_iter() + .flatten() + { + let path = entry.path(); + if !path.is_file() { + continue; + } + let Some((is_state, stem)) = classify_nextui_save_file(path) else { + continue; + }; + if is_state && !cfg.settings.sync_states { + continue; + } + let file_name = path + .file_name() + .map(|n| n.to_string_lossy().to_string()) + .unwrap_or_default(); + let (size, updated) = file_size_and_mtime(path); + results.push(build_item( + path, + file_name, + &stem, + &sys.tag, + &sys.romm_slugs, + false, + is_state, + size, + updated, + &cfg.settings.default_slot, + roms, + &cfg.manual_links, + )); + } + } + + results +} + +#[allow(clippy::too_many_arguments)] +fn build_item( + path: &Path, + file_name: String, + stem: &str, + system_tag: &str, + platform_slugs: &[String], + is_directory: bool, + is_state: bool, + size_bytes: u64, + updated_at: String, + default_slot: &str, + roms: &[SimpleRomSchema], + manual_links: &HashMap, +) -> DiscoveredNextUiSave { + let local_path = path.to_string_lossy().to_string(); + + if let Some(link) = manual_links.get(&local_path) { + let plat = roms + .iter() + .find(|r| r.id == link.rom_id) + .map(|r| r.platform_display_name.clone()); + return DiscoveredNextUiSave { + local_path, + file_name, + system_tag: system_tag.to_string(), + is_directory, + is_state, + size_bytes, + updated_at, + slot: link.slot.clone(), + matched_rom_id: Some(link.rom_id), + matched_rom_name: Some(link.rom_name.clone()), + matched_platform: plat, + match_confidence: 1.0, + match_source: "manual".to_string(), + }; + } + + if let Some((rom, conf, src)) = match_stem_to_roms(stem, platform_slugs, roms) { + DiscoveredNextUiSave { + local_path, + file_name, + system_tag: system_tag.to_string(), + is_directory, + is_state, + size_bytes, + updated_at, + slot: default_slot.to_string(), + matched_rom_id: Some(rom.id), + matched_rom_name: Some(rom.name.clone().unwrap_or_else(|| rom.fs_name_no_ext.clone())), + matched_platform: Some(rom.platform_display_name.clone()), + match_confidence: conf, + match_source: src.to_string(), + } + } else { + DiscoveredNextUiSave { + local_path, + file_name, + system_tag: system_tag.to_string(), + is_directory, + is_state, + size_bytes, + updated_at, + slot: default_slot.to_string(), + matched_rom_id: None, + matched_rom_name: None, + matched_platform: None, + match_confidence: 0.0, + match_source: "unmatched".to_string(), + } + } +} + +fn file_size_and_mtime(path: &Path) -> (u64, String) { + match fs::metadata(path) { + Ok(m) => { + let dt: DateTime = m + .modified() + .map(DateTime::::from) + .unwrap_or_else(|_| Utc::now()); + (m.len(), dt.to_rfc3339()) + } + Err(_) => (0, Utc::now().to_rfc3339()), + } +} + +fn dir_size_and_mtime(dir: &Path) -> (u64, String) { + let mut total = 0u64; + let mut latest: Option = None; + for entry in WalkDir::new(dir).into_iter().flatten() { + if entry.path().is_file() { + if let Ok(m) = entry.metadata() { + total += m.len(); + if let Ok(mt) = m.modified() { + if latest.map_or(true, |l| mt > l) { + latest = Some(mt); + } + } + } + } + } + let dt: DateTime = latest.map(DateTime::::from).unwrap_or_else(Utc::now); + (total, dt.to_rfc3339()) +} + +pub fn read_save_payload_and_hash(path: &Path, is_directory: bool) -> Result<(Vec, String), String> { + let bytes = if is_directory { + zip_directory_deterministic(path)? + } else { + fs::read(path).map_err(|e| format!("Failed reading {}: {}", path.display(), e))? + }; + let mut hasher = Sha256::new(); + hasher.update(&bytes); + Ok((bytes, hex::encode(hasher.finalize()))) +} + +fn zip_directory_deterministic(dir: &Path) -> Result, String> { + let mut files: Vec = WalkDir::new(dir) + .into_iter() + .flatten() + .filter(|e| e.path().is_file()) + .map(|e| e.into_path()) + .collect(); + files.sort(); + let mut cursor = std::io::Cursor::new(Vec::new()); + { + let mut zip = ZipWriter::new(&mut cursor); + let options = SimpleFileOptions::default() + .compression_method(zip::CompressionMethod::Deflated) + .last_modified_time(zip::DateTime::default()); + for f in files { + let rel = f + .strip_prefix(dir) + .map_err(|e| e.to_string())? + .to_string_lossy() + .replace('\\', "/"); + zip.start_file(rel, options).map_err(|e| e.to_string())?; + zip.write_all(&fs::read(&f).map_err(|e| e.to_string())?) + .map_err(|e| e.to_string())?; + } + zip.finish().map_err(|e| e.to_string())?; + } + Ok(cursor.into_inner()) +} diff --git a/src/nextui.rs b/src/nextui.rs new file mode 100644 index 0000000..3a60cad --- /dev/null +++ b/src/nextui.rs @@ -0,0 +1,310 @@ +use crate::config::{roms_root, saves_root, NextUiConfig}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; +use std::fs; +use std::path::{Path, PathBuf}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct NextUiSystemFolder { + pub tag: String, + pub rom_folder: Option, + pub save_folder: Option, + pub romm_slugs: Vec, +} + +/// Maps a NextUI tag (e.g. `GBA`, `FC`, `SFC`, `PS`, `MD`) to candidate RomM platform slugs. +pub fn tag_to_romm_slugs(tag: &str, overrides: &HashMap) -> Vec { + let upper = tag.trim().to_uppercase(); + if let Some(custom) = overrides.get(&upper).or_else(|| overrides.get(tag)) { + return vec![custom.to_lowercase()]; + } + let list: &[&str] = match upper.as_str() { + "GB" => &["gb"], + "GBC" => &["gbc"], + "GBA" | "MGBA" | "GPSP" => &["gba"], + "FC" | "NES" => &["nes", "famicom"], + "SFC" | "SNES" | "SUPA" => &["snes", "sfam"], + "N64" => &["n64"], + "NDS" | "DS" => &["nds", "ds"], + "PS" | "PSX" | "PS1" => &["psx", "ps1", "ps"], + "PSP" => &["psp"], + "MD" | "GEN" => &["genesis", "md", "megadrive"], + "SMS" => &["sms"], + "GG" => &["gamegear", "gg"], + "SEGACD" | "MCD" | "SCD" => &["segacd"], + "32X" => &["sega32x", "32x"], + "DC" | "DREAMCAST" => &["dc", "dreamcast"], + "SATURN" | "SS" => &["saturn"], + "PCE" | "TG16" => &["tg16", "turbografx16", "pce"], + "PCECD" | "TGCD" => &["turbografx-cd", "pcecd"], + "NGP" | "NGPC" => &["ngp", "ngpc"], + "WS" | "WSC" => &["wonderswan", "wonderswan-color"], + "PKM" | "POKEMINI" => &["pokemon-mini", "pokemini"], + "VB" => &["virtualboy", "vb"], + "A2600" | "2600" | "ATARI" => &["atari2600"], + "A7800" | "7800" => &["atari7800"], + "LYNX" => &["lynx"], + "FBN" | "FBNEO" | "ARCADE" | "MAME" | "CPS1" | "CPS2" | "CPS3" => &["arcade", "fbneo"], + "NEOGEO" | "NEO" => &["neogeo", "arcade"], + "PICO" | "PICO8" => &["pico8"], + "SCUMMVM" => &["scummvm"], + "DOS" => &["dos"], + _ => return vec![tag.to_lowercase()], + }; + list.iter().map(|s| s.to_string()).collect() +} + +/// Maps a RomM platform slug back to a default NextUI `(TAG)` when creating a ROM folder. +pub fn romm_slug_to_default_tag(slug: &str) -> String { + match slug.to_lowercase().as_str() { + "gb" => "GB", + "gbc" => "GBC", + "gba" => "GBA", + "nes" | "famicom" => "FC", + "snes" | "sfam" => "SFC", + "n64" => "N64", + "nds" | "ds" => "NDS", + "psx" | "ps1" | "ps" => "PS", + "psp" => "PSP", + "genesis" | "md" | "megadrive" => "MD", + "sms" => "SMS", + "gamegear" | "gg" => "GG", + "segacd" => "SEGACD", + "sega32x" | "32x" => "32X", + "dc" | "dreamcast" => "DC", + "saturn" => "SATURN", + "tg16" | "turbografx16" | "pce" => "PCE", + "ngp" | "ngpc" => "NGPC", + "wonderswan" | "wonderswan-color" => "WSC", + "virtualboy" | "vb" => "VB", + "lynx" => "LYNX", + "neogeo" => "NEOGEO", + "arcade" | "fbneo" => "FBN", + "pico8" => "PICO", + other => return other.to_uppercase(), + } + .to_string() +} + +/// Extracts the parenthesized NextUI tag from a folder like `Game Boy Advance (GBA)` -> `Some("GBA")`. +pub fn extract_tag_from_rom_folder(folder_name: &str) -> Option { + let open = folder_name.rfind('(')?; + let close = folder_name.rfind(')')?; + if close > open + 1 { + let tag = folder_name[open + 1..close].trim(); + if !tag.is_empty() { + return Some(tag.to_string()); + } + } + None +} + +/// Discovers all NextUI system tags present in `/Roms` and `/Saves`. +pub fn discover_nextui_systems(cfg: &NextUiConfig) -> Vec { + let mut by_tag: HashMap = HashMap::new(); + + // 1. Scan /Roms/* () + let r_root = roms_root(); + if let Ok(entries) = fs::read_dir(&r_root) { + for entry in entries.flatten() { + let p = entry.path(); + if !p.is_dir() { + continue; + } + let name = entry.file_name().to_string_lossy().to_string(); + if name.starts_with('.') { + continue; + } + if let Some(tag) = extract_tag_from_rom_folder(&name) { + let key = tag.to_uppercase(); + by_tag + .entry(key.clone()) + .and_modify(|s| s.rom_folder = Some(p.to_string_lossy().to_string())) + .or_insert_with(|| NextUiSystemFolder { + tag: tag.clone(), + rom_folder: Some(p.to_string_lossy().to_string()), + save_folder: None, + romm_slugs: tag_to_romm_slugs(&tag, &cfg.settings.tag_overrides), + }); + } + } + } + + // 2. Scan /Saves/ + let s_root = saves_root(); + if let Ok(entries) = fs::read_dir(&s_root) { + for entry in entries.flatten() { + let p = entry.path(); + if !p.is_dir() { + continue; + } + let tag = entry.file_name().to_string_lossy().to_string(); + if tag.starts_with('.') { + continue; + } + let key = tag.to_uppercase(); + by_tag + .entry(key) + .and_modify(|s| s.save_folder = Some(p.to_string_lossy().to_string())) + .or_insert_with(|| NextUiSystemFolder { + tag: tag.clone(), + rom_folder: None, + save_folder: Some(p.to_string_lossy().to_string()), + romm_slugs: tag_to_romm_slugs(&tag, &cfg.settings.tag_overrides), + }); + } + } + + let mut list: Vec = by_tag.into_values().collect(); + list.sort_by(|a, b| a.tag.cmp(&b.tag)); + list +} + +/// Finds (or computes) the right `/Roms/ ()/` path for a RomM platform. +pub fn resolve_rom_dest_folder( + platform_slug: &str, + platform_display_name: &str, + cfg: &NextUiConfig, +) -> PathBuf { + let systems = discover_nextui_systems(cfg); + for sys in &systems { + if sys + .romm_slugs + .iter() + .any(|s| s.eq_ignore_ascii_case(platform_slug)) + { + if let Some(ref rf) = sys.rom_folder { + return PathBuf::from(rf); + } + } + } + let tag = romm_slug_to_default_tag(platform_slug); + let safe_name = platform_display_name.replace(['/', '\\', ':', '*', '?', '"', '<', '>', '|'], ""); + roms_root().join(format!("{} ({})", safe_name.trim(), tag)) +} + +/// Finds (or computes) the right `/Saves//` folder for a RomM platform slug. +pub fn resolve_save_dest_folder(platform_slug: &str, cfg: &NextUiConfig) -> (String, PathBuf) { + let systems = discover_nextui_systems(cfg); + for sys in &systems { + if sys + .romm_slugs + .iter() + .any(|s| s.eq_ignore_ascii_case(platform_slug)) + { + if let Some(ref sf) = sys.save_folder { + return (sys.tag.clone(), PathBuf::from(sf)); + } + return (sys.tag.clone(), saves_root().join(&sys.tag)); + } + } + let tag = romm_slug_to_default_tag(platform_slug); + let dir = saves_root().join(&tag); + (tag, dir) +} + +/// Classifies a file inside `/Saves//` as Save vs Save State and extracts its clean ROM stem. +/// Handles BOTH MinUI (`Game.gba.sav`, `Game.gba.state0`) and RetroArch (`Game.srm`, `Game.state.0`) naming! +pub fn classify_nextui_save_file(path: &Path) -> Option<(bool /* is_state */, String /* clean_stem */)> { + let file_name = path.file_name()?.to_str()?; + if file_name.starts_with('.') || file_name.ends_with(".romm_part") { + return None; + } + let lower = file_name.to_lowercase(); + + // Ignore NextUI metadata/thumbnail files + if lower.ends_with(".png") + || lower.ends_with(".jpg") + || lower.ends_with(".txt") + || lower.ends_with(".json") + || lower.ends_with(".cfg") + || lower.ends_with(".auto") + { + return None; + } + + // Detect state files: `.state`, `.state0`..`.state99`, `.state.0`, `.st0`..`.st9`, `.ppst`, `.ss0`..`.ss9` + let (is_state, without_save_ext) = if let Some(idx) = lower.rfind(".state") { + (true, &file_name[..idx]) + } else if lower.ends_with(".ppst") { + (true, &file_name[..file_name.len() - 5]) + } else if let Some(dot) = lower.rfind('.') { + let ext = &lower[dot + 1..]; + if (ext.starts_with("st") || ext.starts_with("ss")) + && ext.len() <= 4 + && ext[2..].chars().all(|c| c.is_ascii_digit()) + && ext.len() > 2 + { + (true, &file_name[..dot]) + } else if matches!( + ext, + "sav" | "srm" | "mcr" | "mcd" | "dsv" | "eep" | "fla" | "mpk" | "vmu" | "bin" | "rtc" | "brm" + ) { + (false, &file_name[..dot]) + } else { + return None; + } + } else { + return None; + }; + + // Strip MinUI's double extension (e.g. `Pokemon Emerald.gba` -> `Pokemon Emerald`) + let rom_exts = [ + ".gba", ".gbc", ".gb", ".nes", ".sfc", ".smc", ".n64", ".z64", ".v64", ".nds", ".iso", + ".chd", ".pbp", ".cue", ".bin", ".cso", ".md", ".gen", ".sms", ".gg", ".pce", ".ngp", + ".ngc", ".ws", ".wsc", ".zip", ".7z", ".min", ".vb", ".lnx", ".a26", ".a78", + ]; + let mut stem = without_save_ext.to_string(); + let stem_lower = stem.to_lowercase(); + for rext in rom_exts { + if stem_lower.ends_with(rext) { + stem.truncate(stem.len() - rext.len()); + break; + } + } + + Some((is_state, stem)) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_extract_tag() { + assert_eq!( + extract_tag_from_rom_folder("Game Boy Advance (GBA)"), + Some("GBA".to_string()) + ); + assert_eq!( + extract_tag_from_rom_folder("Sony PlayStation (PS)"), + Some("PS".to_string()) + ); + assert_eq!(extract_tag_from_rom_folder("NoTagHere"), None); + } + + #[test] + fn test_classify_minui_and_retroarch_saves() { + assert_eq!( + classify_nextui_save_file(Path::new("Pokemon Emerald (USA).gba.sav")), + Some((false, "Pokemon Emerald (USA)".to_string())) + ); + assert_eq!( + classify_nextui_save_file(Path::new("Pokemon Emerald (USA).gba.state0")), + Some((true, "Pokemon Emerald (USA)".to_string())) + ); + assert_eq!( + classify_nextui_save_file(Path::new("Chrono Trigger.srm")), + Some((false, "Chrono Trigger".to_string())) + ); + assert_eq!( + classify_nextui_save_file(Path::new("Chrono Trigger.state.2")), + Some((true, "Chrono Trigger".to_string())) + ); + assert_eq!( + classify_nextui_save_file(Path::new("preview.png")), + None + ); + } +} diff --git a/src/romm_api.rs b/src/romm_api.rs new file mode 100644 index 0000000..eb36b5a --- /dev/null +++ b/src/romm_api.rs @@ -0,0 +1,671 @@ +use futures_util::StreamExt; +use reqwest::multipart::{Form, Part}; +use reqwest::{Client, Method, RequestBuilder}; +use serde::{Deserialize, Serialize}; +use std::path::Path; +use tokio::io::AsyncWriteExt; + +#[derive(Debug, Clone)] +pub struct RommClient { + http: Client, + base_url: String, + token: Option, +} + +#[derive(Debug, Serialize)] +pub struct DeviceAuthInitPayload { + pub client_device_identifier: String, + pub name: String, + pub client: String, + pub platform: Option, + pub client_version: Option, + pub requested_scopes: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct DeviceAuthInitResponse { + pub device_code: String, + pub user_code: String, + pub verification_path: String, + pub verification_path_complete: String, + pub expires_in: i64, + pub interval: i64, +} + +#[derive(Debug, Serialize)] +pub struct DeviceAuthTokenPayload { + pub device_code: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct DeviceAuthTokenResponse { + pub access_token: String, + pub device_id: String, + pub scopes: Vec, + pub expires_at: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct TokenResponse { + pub access_token: String, + pub token_type: String, + pub refresh_token: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ClientTokenCreateSchema { + pub id: i64, + pub name: String, + pub device_id: Option, + pub raw_token: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct UserSchema { + pub id: i64, + pub username: String, + pub current_device_id: Option, +} + +#[derive(Debug, Serialize)] +pub struct DeviceCreatePayload { + pub name: Option, + pub platform: Option, + pub client: Option, + pub client_version: Option, + pub sync_mode: Option, + pub allow_existing: bool, + pub allow_duplicate: bool, + pub reset_syncs: bool, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct DeviceSchema { + pub id: String, + pub name: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct PlatformSchema { + pub id: i64, + pub slug: String, + pub fs_slug: String, + pub name: String, + pub display_name: String, + pub rom_count: i64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SimpleRomSchema { + pub id: i64, + pub platform_id: i64, + pub platform_slug: String, + pub platform_fs_slug: String, + pub platform_display_name: String, + pub fs_name: String, + pub fs_name_no_tags: String, + pub fs_name_no_ext: String, + pub fs_extension: String, + pub fs_size_bytes: i64, + pub name: Option, + pub crc_hash: Option, + pub md5_hash: Option, + pub sha1_hash: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RomPageResponse { + pub items: Vec, + pub total: i64, + pub limit: i64, + pub offset: i64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SaveSchema { + pub id: i64, + pub rom_id: i64, + pub file_name: String, + pub updated_at: String, + pub emulator: Option, + pub slot: Option, + pub content_hash: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct StateSchema { + pub id: i64, + pub rom_id: i64, + pub file_name: String, + pub updated_at: String, + pub emulator: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct ClientSaveState { + pub rom_id: i64, + pub file_name: String, + pub slot: Option, + pub emulator: Option, + pub content_hash: Option, + pub updated_at: String, + pub file_size_bytes: i64, +} + +#[derive(Debug, Serialize)] +pub struct SyncNegotiatePayload { + pub device_id: Option, + pub saves: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SyncOperationSchema { + pub action: String, + pub rom_id: i64, + pub save_id: Option, + pub file_name: String, + pub slot: Option, + pub emulator: Option, + pub reason: String, + pub server_updated_at: Option, + pub server_content_hash: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SyncNegotiateResponse { + pub session_id: i64, + pub operations: Vec, + pub total_upload: i64, + pub total_download: i64, + pub total_conflict: i64, + pub total_no_op: i64, +} + +#[derive(Debug, Serialize)] +struct SyncCompletePayload { + operations_completed: i64, + operations_failed: i64, +} + +#[derive(Debug, Serialize)] +struct ConfirmDownloadPayload { + device_id: String, +} + +#[derive(Debug, Serialize)] +struct PairExchangePayload { + code: String, +} + +impl RommClient { + pub fn new(base_url: &str, token: Option) -> Result { + let normalized = base_url.trim().trim_end_matches('/').to_string(); + if normalized.is_empty() { + return Err("RomM server URL is not configured".into()); + } + let http = Client::builder() + .user_agent("RomM-NextUI-Companion/0.1.0") + .build() + .map_err(|e| format!("HTTP client error: {e}"))?; + Ok(Self { + http, + base_url: normalized, + token, + }) + } + + fn request(&self, method: Method, path: &str) -> RequestBuilder { + let url = format!("{}{}", self.base_url, path); + let mut req = self.http.request(method, url); + if let Some(ref token) = self.token { + req = req.bearer_auth(token); + } + req + } + + async fn parse_json Deserialize<'de>>( + resp: reqwest::Response, + ) -> Result { + let status = resp.status(); + let text = resp.text().await.map_err(|e| e.to_string())?; + if !status.is_success() { + return Err(format!("HTTP {}: {}", status.as_u16(), text)); + } + serde_json::from_str(&text) + .map_err(|e| format!("JSON parse error ({}): {}", e, &text[..text.len().min(250)])) + } + + pub async fn heartbeat(&self) -> Result { + let resp = self + .request(Method::GET, "/api/heartbeat") + .send() + .await + .map_err(|e| format!("Cannot reach RomM server: {e}"))?; + Self::parse_json(resp).await + } + + pub async fn get_me(&self) -> Result { + let resp = self + .request(Method::GET, "/api/users/me") + .send() + .await + .map_err(|e| e.to_string())?; + Self::parse_json(resp).await + } + + pub async fn device_auth_init( + &self, + client_device_identifier: &str, + device_name: &str, + ) -> Result { + let platform = std::env::var("PLATFORM").unwrap_or_else(|_| "nextui".to_string()); + let payload = DeviceAuthInitPayload { + client_device_identifier: client_device_identifier.to_string(), + name: device_name.to_string(), + client: "romm-nextui".to_string(), + platform: Some(platform), + client_version: Some("0.1.0".to_string()), + requested_scopes: vec![ + "me.read".into(), + "roms.read".into(), + "platforms.read".into(), + "assets.read".into(), + "assets.write".into(), + "devices.read".into(), + "devices.write".into(), + "roms.user.read".into(), + "roms.user.write".into(), + ], + }; + let resp = self + .request(Method::POST, "/api/auth/device/init") + .json(&payload) + .send() + .await + .map_err(|e| e.to_string())?; + Self::parse_json(resp).await + } + + pub async fn device_auth_poll( + &self, + device_code: &str, + ) -> Result, String> { + let resp = self + .request(Method::POST, "/api/auth/device/token") + .json(&DeviceAuthTokenPayload { + device_code: device_code.to_string(), + }) + .send() + .await + .map_err(|e| e.to_string())?; + let status = resp.status(); + let text = resp.text().await.map_err(|e| e.to_string())?; + if status.is_success() { + let parsed: DeviceAuthTokenResponse = + serde_json::from_str(&text).map_err(|e| e.to_string())?; + return Ok(Some(parsed)); + } + if (status.as_u16() == 400 || status.as_u16() == 428 || status.as_u16() == 202) + && (text.contains("pending") || text.contains("slow_down")) + { + return Ok(None); + } + Err(format!("HTTP {}: {}", status.as_u16(), text)) + } + + pub async fn exchange_pair_code(&self, code: &str) -> Result { + let resp = self + .request(Method::POST, "/api/client-tokens/exchange") + .json(&PairExchangePayload { + code: code.trim().to_string(), + }) + .send() + .await + .map_err(|e| e.to_string())?; + Self::parse_json(resp).await + } + + pub async fn login_password( + &self, + username: &str, + password: &str, + ) -> Result { + let scopes = "me.read roms.read platforms.read assets.read assets.write devices.read devices.write roms.user.read roms.user.write"; + let resp = self + .request(Method::POST, "/api/token") + .form(&[ + ("grant_type", "password"), + ("username", username), + ("password", password), + ("scope", scopes), + ]) + .send() + .await + .map_err(|e| e.to_string())?; + Self::parse_json(resp).await + } + + pub async fn register_device(&self, name: &str) -> Result { + let platform = std::env::var("PLATFORM").unwrap_or_else(|_| "nextui".to_string()); + let payload = DeviceCreatePayload { + name: Some(name.to_string()), + platform: Some(platform), + client: Some("romm-nextui".to_string()), + client_version: Some("0.1.0".to_string()), + sync_mode: Some("api".to_string()), + allow_existing: true, + allow_duplicate: false, + reset_syncs: false, + }; + let resp = self + .request(Method::POST, "/api/devices") + .json(&payload) + .send() + .await + .map_err(|e| e.to_string())?; + Self::parse_json(resp).await + } + + pub async fn get_platforms(&self) -> Result, String> { + let resp = self + .request(Method::GET, "/api/platforms") + .send() + .await + .map_err(|e| e.to_string())?; + Self::parse_json(resp).await + } + + pub async fn get_roms( + &self, + platform_id: Option, + search_term: Option<&str>, + limit: i64, + offset: i64, + ) -> Result { + let mut req = self.request(Method::GET, "/api/roms").query(&[ + ("limit", limit.to_string()), + ("offset", offset.to_string()), + ]); + if let Some(pid) = platform_id { + req = req.query(&[("platform_ids", pid.to_string())]); + } + if let Some(term) = search_term { + if !term.trim().is_empty() { + req = req.query(&[("search_term", term.trim().to_string())]); + } + } + let resp = req.send().await.map_err(|e| e.to_string())?; + Self::parse_json(resp).await + } + + pub async fn get_all_roms(&self) -> Result, String> { + let mut all = Vec::new(); + let mut offset = 0; + loop { + let page = self.get_roms(None, None, 250, offset).await?; + let count = page.items.len() as i64; + all.extend(page.items); + offset += count; + if count == 0 || offset >= page.total { + break; + } + } + Ok(all) + } + + pub async fn download_rom( + &self, + rom_id: i64, + file_name: &str, + dest_path: &Path, + ) -> Result { + let encoded = encode_segment(file_name); + let path = format!("/api/roms/{}/content/{}", rom_id, encoded); + let resp = self + .request(Method::GET, &path) + .send() + .await + .map_err(|e| e.to_string())?; + if !resp.status().is_success() { + return Err(format!("ROM download failed: HTTP {}", resp.status())); + } + if let Some(parent) = dest_path.parent() { + tokio::fs::create_dir_all(parent) + .await + .map_err(|e| e.to_string())?; + } + let tmp = dest_path.with_extension("romm_part"); + let mut f = tokio::fs::File::create(&tmp) + .await + .map_err(|e| e.to_string())?; + let mut stream = resp.bytes_stream(); + let mut total = 0u64; + while let Some(chunk) = stream.next().await { + let b = chunk.map_err(|e| e.to_string())?; + f.write_all(&b).await.map_err(|e| e.to_string())?; + total += b.len() as u64; + } + f.flush().await.map_err(|e| e.to_string())?; + drop(f); + tokio::fs::rename(&tmp, dest_path) + .await + .map_err(|e| e.to_string())?; + Ok(total) + } + + pub async fn get_saves( + &self, + rom_id: Option, + device_id: Option<&str>, + ) -> Result, String> { + let mut req = self.request(Method::GET, "/api/saves"); + if let Some(id) = rom_id { + req = req.query(&[("rom_id", id.to_string())]); + } + if let Some(d) = device_id { + req = req.query(&[("device_id", d)]); + } + let resp = req.send().await.map_err(|e| e.to_string())?; + Self::parse_json(resp).await + } + + pub async fn negotiate_sync( + &self, + device_id: Option, + saves: Vec, + ) -> Result { + let resp = self + .request(Method::POST, "/api/sync/negotiate") + .json(&SyncNegotiatePayload { device_id, saves }) + .send() + .await + .map_err(|e| e.to_string())?; + Self::parse_json(resp).await + } + + #[allow(clippy::too_many_arguments)] + pub async fn upload_save( + &self, + rom_id: i64, + emulator: Option<&str>, + slot: Option<&str>, + device_id: Option<&str>, + session_id: Option, + overwrite: bool, + file_name: &str, + bytes: Vec, + ) -> Result { + let mut req = self.request(Method::POST, "/api/saves").query(&[ + ("rom_id", rom_id.to_string()), + ("overwrite", overwrite.to_string()), + ]); + if let Some(e) = emulator { + req = req.query(&[("emulator", e)]); + } + if let Some(s) = slot { + req = req.query(&[("slot", s)]); + } + if let Some(d) = device_id { + req = req.query(&[("device_id", d)]); + } + if let Some(sid) = session_id { + req = req.query(&[("session_id", sid.to_string())]); + } + let part = Part::bytes(bytes) + .file_name(file_name.to_string()) + .mime_str("application/octet-stream") + .map_err(|e| e.to_string())?; + let form = Form::new().part("saveFile", part); + let resp = req + .multipart(form) + .send() + .await + .map_err(|e| e.to_string())?; + Self::parse_json(resp).await + } + + pub async fn download_save_bytes( + &self, + save_id: i64, + device_id: Option<&str>, + session_id: Option, + ) -> Result, String> { + let mut req = self.request(Method::GET, &format!("/api/saves/{}/content", save_id)); + if let Some(d) = device_id { + req = req.query(&[("device_id", d)]); + } + if let Some(sid) = session_id { + req = req.query(&[("session_id", sid.to_string())]); + } + let resp = req.send().await.map_err(|e| e.to_string())?; + if !resp.status().is_success() { + return Err(format!("Download save HTTP {}", resp.status())); + } + resp.bytes() + .await + .map(|b| b.to_vec()) + .map_err(|e| e.to_string()) + } + + pub async fn confirm_save_downloaded(&self, save_id: i64, device_id: &str) -> Result<(), String> { + let resp = self + .request(Method::POST, &format!("/api/saves/{}/downloaded", save_id)) + .json(&ConfirmDownloadPayload { + device_id: device_id.to_string(), + }) + .send() + .await + .map_err(|e| e.to_string())?; + if !resp.status().is_success() { + return Err(format!("Confirm download HTTP {}", resp.status())); + } + Ok(()) + } + + pub async fn complete_sync_session( + &self, + session_id: i64, + completed: i64, + failed: i64, + ) -> Result<(), String> { + let resp = self + .request( + Method::POST, + &format!("/api/sync/sessions/{}/complete", session_id), + ) + .json(&SyncCompletePayload { + operations_completed: completed, + operations_failed: failed, + }) + .send() + .await + .map_err(|e| e.to_string())?; + if !resp.status().is_success() { + return Err(format!("Complete sync HTTP {}", resp.status())); + } + Ok(()) + } + + pub async fn get_states(&self, rom_id: Option) -> Result, String> { + let mut req = self.request(Method::GET, "/api/states"); + if let Some(id) = rom_id { + req = req.query(&[("rom_id", id.to_string())]); + } + let resp = req.send().await.map_err(|e| e.to_string())?; + Self::parse_json(resp).await + } + + pub async fn upload_state( + &self, + rom_id: i64, + emulator: Option<&str>, + file_name: &str, + bytes: Vec, + ) -> Result { + let mut req = self + .request(Method::POST, "/api/states") + .query(&[("rom_id", rom_id.to_string())]); + if let Some(e) = emulator { + req = req.query(&[("emulator", e)]); + } + let part = Part::bytes(bytes) + .file_name(file_name.to_string()) + .mime_str("application/octet-stream") + .map_err(|e| e.to_string())?; + let form = Form::new().part("stateFile", part); + let resp = req + .multipart(form) + .send() + .await + .map_err(|e| e.to_string())?; + Self::parse_json(resp).await + } + + pub async fn update_state( + &self, + state_id: i64, + file_name: &str, + bytes: Vec, + ) -> Result { + let part = Part::bytes(bytes) + .file_name(file_name.to_string()) + .mime_str("application/octet-stream") + .map_err(|e| e.to_string())?; + let form = Form::new().part("stateFile", part); + let resp = self + .request(Method::PUT, &format!("/api/states/{}", state_id)) + .multipart(form) + .send() + .await + .map_err(|e| e.to_string())?; + Self::parse_json(resp).await + } + + pub async fn download_state_bytes(&self, state_id: i64) -> Result, String> { + let resp = self + .request(Method::GET, &format!("/api/states/{}/content", state_id)) + .send() + .await + .map_err(|e| e.to_string())?; + if !resp.status().is_success() { + return Err(format!("Download state HTTP {}", resp.status())); + } + resp.bytes() + .await + .map(|b| b.to_vec()) + .map_err(|e| e.to_string()) + } +} + +fn encode_segment(s: &str) -> String { + let mut out = String::with_capacity(s.len()); + for b in s.bytes() { + match b { + b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'_' | b'.' | b'~' => { + out.push(b as char); + } + _ => out.push_str(&format!("%{:02X}", b)), + } + } + out +} diff --git a/src/sync_engine.rs b/src/sync_engine.rs new file mode 100644 index 0000000..31cf980 --- /dev/null +++ b/src/sync_engine.rs @@ -0,0 +1,579 @@ +use crate::config::{backups_dir, conflicts_path, push_log, NextUiConfig}; +use crate::matcher::{discover_nextui_saves, read_save_payload_and_hash, DiscoveredNextUiSave}; +use crate::nextui::resolve_save_dest_folder; +use crate::romm_api::{ClientSaveState, RommClient, SimpleRomSchema}; +use chrono::Utc; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; +use std::fs; +use std::io::Cursor; +use std::path::{Path, PathBuf}; +use zip::ZipArchive; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SyncConflictItem { + pub id: String, + pub rom_id: i64, + pub rom_name: String, + pub save_id: Option, + pub local_path: String, + pub file_name: String, + pub is_directory: bool, + pub system_tag: String, + pub slot: String, + pub local_updated_at: String, + pub server_updated_at: Option, + pub reason: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SyncRunSummary { + pub session_id: Option, + pub uploaded_saves: usize, + pub downloaded_saves: usize, + pub uploaded_states: usize, + pub up_to_date: usize, + pub conflicts: Vec, + pub errors: Vec, +} + +pub fn load_conflicts() -> Vec { + if let Ok(raw) = fs::read_to_string(conflicts_path()) { + if let Ok(list) = serde_json::from_str(&raw) { + return list; + } + } + Vec::new() +} + +pub fn save_conflicts(list: &[SyncConflictItem]) { + if let Ok(json) = serde_json::to_string_pretty(list) { + let _ = fs::write(conflicts_path(), json); + } +} + +pub fn create_backup( + local_path: &Path, + rom_id: i64, + is_directory: bool, + max_backups: usize, +) -> Result<(), String> { + if !local_path.exists() { + return Ok(()); + } + let rom_dir = backups_dir().join(rom_id.to_string()); + fs::create_dir_all(&rom_dir).map_err(|e| e.to_string())?; + let stamp = Utc::now().format("%Y%m%dT%H%M%SZ").to_string(); + let base = local_path + .file_name() + .map(|n| n.to_string_lossy().to_string()) + .unwrap_or_else(|| "save".to_string()); + + if is_directory { + let (zip_bytes, _) = read_save_payload_and_hash(local_path, true)?; + fs::write(rom_dir.join(format!("{}_{}.zip", stamp, base)), zip_bytes) + .map_err(|e| e.to_string())?; + } else { + fs::copy(local_path, rom_dir.join(format!("{}_{}", stamp, base))) + .map_err(|e| e.to_string())?; + } + + if max_backups > 0 { + if let Ok(entries) = fs::read_dir(&rom_dir) { + let mut files: Vec = entries + .flatten() + .map(|e| e.path()) + .filter(|p| p.is_file()) + .collect(); + files.sort(); + if files.len() > max_backups { + let to_remove = files.len() - max_backups; + for old in files.into_iter().take(to_remove) { + let _ = fs::remove_file(old); + } + } + } + } + Ok(()) +} + +pub fn write_downloaded_save(dest_path: &Path, bytes: &[u8], is_directory: bool) -> Result<(), String> { + if is_directory { + fs::create_dir_all(dest_path).map_err(|e| e.to_string())?; + let mut archive = ZipArchive::new(Cursor::new(bytes)) + .map_err(|e| format!("Invalid zip archive: {e}"))?; + for i in 0..archive.len() { + let mut f = archive.by_index(i).map_err(|e| e.to_string())?; + let Some(rel) = f.enclosed_name().map(|p| p.to_path_buf()) else { + continue; + }; + let out = dest_path.join(rel); + if f.is_dir() { + fs::create_dir_all(&out).map_err(|e| e.to_string())?; + } else { + if let Some(p) = out.parent() { + fs::create_dir_all(p).map_err(|e| e.to_string())?; + } + let mut of = fs::File::create(&out).map_err(|e| e.to_string())?; + std::io::copy(&mut f, &mut of).map_err(|e| e.to_string())?; + } + } + Ok(()) + } else { + if let Some(p) = dest_path.parent() { + fs::create_dir_all(p).map_err(|e| e.to_string())?; + } + fs::write(dest_path, bytes).map_err(|e| e.to_string()) + } +} + +pub async fn run_sync( + client: &RommClient, + cfg: &mut NextUiConfig, + roms: &[SimpleRomSchema], +) -> Result { + let discovered = discover_nextui_saves(cfg, roms); + let mut summary = SyncRunSummary { + session_id: None, + uploaded_saves: 0, + downloaded_saves: 0, + uploaded_states: 0, + up_to_date: 0, + conflicts: Vec::new(), + errors: Vec::new(), + }; + + let rom_by_id: HashMap = roms.iter().map(|r| (r.id, r)).collect(); + + let matched_saves: Vec<&DiscoveredNextUiSave> = discovered + .iter() + .filter(|d| !d.is_state && d.matched_rom_id.is_some()) + .collect(); + let matched_states: Vec<&DiscoveredNextUiSave> = discovered + .iter() + .filter(|d| d.is_state && d.matched_rom_id.is_some()) + .collect(); + + let mut local_map: HashMap<(i64, String), (&DiscoveredNextUiSave, Vec)> = HashMap::new(); + let mut client_states: Vec = Vec::new(); + + for item in matched_saves { + let Some(rom_id) = item.matched_rom_id else { + continue; + }; + match read_save_payload_and_hash(Path::new(&item.local_path), item.is_directory) { + Ok((bytes, hash)) => { + let slot = if item.slot.trim().is_empty() { + "default".to_string() + } else { + item.slot.clone() + }; + client_states.push(ClientSaveState { + rom_id, + file_name: item.file_name.clone(), + slot: Some(slot.clone()), + emulator: Some(format!("nextui-{}", item.system_tag.to_lowercase())), + content_hash: Some(hash), + updated_at: item.updated_at.clone(), + file_size_bytes: bytes.len() as i64, + }); + local_map.insert((rom_id, slot), (item, bytes)); + } + Err(e) => summary.errors.push(format!("{}: {}", item.file_name, e)), + } + } + + if !client_states.is_empty() || cfg.connection.device_id.is_some() { + let neg = client + .negotiate_sync(cfg.connection.device_id.clone(), client_states) + .await?; + summary.session_id = Some(neg.session_id); + let mut completed = 0i64; + let mut failed = 0i64; + + for op in neg.operations { + let slot_key = op.slot.clone().unwrap_or_else(|| "default".to_string()); + match op.action.as_str() { + "no_op" => summary.up_to_date += 1, + "upload" => { + if let Some((item, bytes)) = local_map.get(&(op.rom_id, slot_key.clone())) { + let emu_name = format!("nextui-{}", item.system_tag.to_lowercase()); + match client + .upload_save( + op.rom_id, + Some(&emu_name), + Some(&slot_key), + cfg.connection.device_id.as_deref(), + Some(neg.session_id), + true, + &item.file_name, + bytes.clone(), + ) + .await + { + Ok(_) => { + summary.uploaded_saves += 1; + completed += 1; + push_log( + cfg, + "success", + "upload_save", + format!("Uploaded {} ({})", item.file_name, item.system_tag), + ); + } + Err(e) => { + failed += 1; + summary.errors.push(format!("Upload {}: {}", item.file_name, e)); + } + } + } + } + "download" => { + let Some(save_id) = op.save_id else { + continue; + }; + let target = local_map + .get(&(op.rom_id, slot_key.clone())) + .map(|(item, _)| (PathBuf::from(&item.local_path), item.is_directory)) + .or_else(|| { + rom_by_id.get(&op.rom_id).map(|rom| { + let (tag, save_dir) = + resolve_save_dest_folder(&rom.platform_slug, cfg); + let is_dir = + tag.eq_ignore_ascii_case("PSP") && op.file_name.ends_with(".zip"); + let name = if is_dir { + op.file_name + .strip_suffix(".zip") + .unwrap_or(&op.file_name) + .to_string() + } else { + op.file_name.clone() + }; + let dest = if is_dir { + save_dir.join("PSP/SAVEDATA").join(name) + } else { + save_dir.join(name) + }; + (dest, is_dir) + }) + }); + + if let Some((dest_path, is_dir)) = target { + match client + .download_save_bytes( + save_id, + cfg.connection.device_id.as_deref(), + Some(neg.session_id), + ) + .await + { + Ok(bytes) => { + let _ = create_backup( + &dest_path, + op.rom_id, + is_dir, + cfg.settings.max_backups_per_save, + ); + match write_downloaded_save(&dest_path, &bytes, is_dir) { + Ok(()) => { + if let Some(ref did) = cfg.connection.device_id { + let _ = client + .confirm_save_downloaded(save_id, did) + .await; + } + summary.downloaded_saves += 1; + completed += 1; + push_log( + cfg, + "success", + "download_save", + format!("Downloaded {} (backup saved)", op.file_name), + ); + } + Err(e) => { + failed += 1; + summary.errors.push(format!("Write {}: {}", op.file_name, e)); + } + } + } + Err(e) => { + failed += 1; + summary.errors.push(format!("Download {}: {}", op.file_name, e)); + } + } + } + } + "conflict" => { + if let Some((item, _)) = local_map.get(&(op.rom_id, slot_key.clone())) { + summary.conflicts.push(SyncConflictItem { + id: format!("{}:{}:{}", op.rom_id, slot_key, op.save_id.unwrap_or(0)), + rom_id: op.rom_id, + rom_name: item + .matched_rom_name + .clone() + .unwrap_or_else(|| format!("ROM #{}", op.rom_id)), + save_id: op.save_id, + local_path: item.local_path.clone(), + file_name: item.file_name.clone(), + is_directory: item.is_directory, + system_tag: item.system_tag.clone(), + slot: slot_key, + local_updated_at: item.updated_at.clone(), + server_updated_at: op.server_updated_at.clone(), + reason: op.reason.clone(), + }); + push_log( + cfg, + "warning", + "conflict", + format!("Conflict for {}: {}", item.file_name, op.reason), + ); + } + } + _ => {} + } + } + + let _ = client + .complete_sync_session(neg.session_id, completed, failed) + .await; + } + + // Sync Save States (/api/states) + if cfg.settings.sync_states { + for item in matched_states { + let Some(rom_id) = item.matched_rom_id else { + continue; + }; + match read_save_payload_and_hash(Path::new(&item.local_path), false) { + Ok((bytes, hash)) => { + if cfg.synced_state_hashes.get(&item.local_path) == Some(&hash) { + summary.up_to_date += 1; + continue; + } + let existing = client + .get_states(Some(rom_id)) + .await + .unwrap_or_default() + .into_iter() + .find(|s| s.file_name.eq_ignore_ascii_case(&item.file_name)); + let emu_name = format!("nextui-{}", item.system_tag.to_lowercase()); + let res = if let Some(remote) = existing { + client.update_state(remote.id, &item.file_name, bytes).await + } else { + client + .upload_state(rom_id, Some(&emu_name), &item.file_name, bytes) + .await + }; + match res { + Ok(_) => { + cfg.synced_state_hashes.insert(item.local_path.clone(), hash); + summary.uploaded_states += 1; + push_log( + cfg, + "success", + "upload_state", + format!("Synced state {} ({})", item.file_name, item.system_tag), + ); + } + Err(e) => summary.errors.push(format!("State {}: {}", item.file_name, e)), + } + } + Err(e) => summary.errors.push(format!("State {}: {}", item.file_name, e)), + } + } + } + + save_conflicts(&summary.conflicts); + Ok(summary) +} + +pub async fn resolve_conflict( + client: &RommClient, + cfg: &mut NextUiConfig, + conflict_id: &str, + resolution: &str, +) -> Result { + let mut conflicts = load_conflicts(); + let conflict = conflicts + .iter() + .find(|c| c.id == conflict_id) + .cloned() + .ok_or_else(|| "Conflict not found".to_string())?; + + let path = Path::new(&conflict.local_path); + match resolution { + "keep_local" => { + let (bytes, _) = read_save_payload_and_hash(path, conflict.is_directory)?; + let emu_name = format!("nextui-{}", conflict.system_tag.to_lowercase()); + client + .upload_save( + conflict.rom_id, + Some(&emu_name), + Some(&conflict.slot), + cfg.connection.device_id.as_deref(), + None, + true, + &conflict.file_name, + bytes, + ) + .await?; + push_log( + cfg, + "success", + "resolve_conflict", + format!("Kept local save for {}", conflict.rom_name), + ); + } + "keep_server" => { + let save_id = conflict + .save_id + .ok_or_else(|| "Missing server save ID".to_string())?; + let bytes = client + .download_save_bytes(save_id, cfg.connection.device_id.as_deref(), None) + .await?; + let _ = create_backup( + path, + conflict.rom_id, + conflict.is_directory, + cfg.settings.max_backups_per_save, + ); + write_downloaded_save(path, &bytes, conflict.is_directory)?; + if let Some(ref did) = cfg.connection.device_id { + let _ = client.confirm_save_downloaded(save_id, did).await; + } + push_log( + cfg, + "success", + "resolve_conflict", + format!("Downloaded server save for {} (backup kept)", conflict.rom_name), + ); + } + _ => return Err("Resolution must be keep_local or keep_server".into()), + } + + conflicts.retain(|c| c.id != conflict_id); + save_conflicts(&conflicts); + Ok(format!("Resolved conflict for {}", conflict.rom_name)) +} + +/// Downloads a single server save and places it in the inherited NextUI `/Saves//` folder. +pub async fn pull_single_save( + client: &RommClient, + cfg: &mut NextUiConfig, + save_id: i64, + rom_id: i64, + platform_slug: &str, + file_name: &str, +) -> Result { + let (tag, save_dir) = resolve_save_dest_folder(platform_slug, cfg); + let is_dir = tag.eq_ignore_ascii_case("PSP") && file_name.ends_with(".zip"); + let dest_path = if is_dir { + let folder_name = file_name.strip_suffix(".zip").unwrap_or(file_name); + save_dir.join("PSP/SAVEDATA").join(folder_name) + } else { + save_dir.join(file_name) + }; + + let bytes = client + .download_save_bytes(save_id, cfg.connection.device_id.as_deref(), None) + .await?; + let _ = create_backup(&dest_path, rom_id, is_dir, cfg.settings.max_backups_per_save); + write_downloaded_save(&dest_path, &bytes, is_dir)?; + if let Some(ref did) = cfg.connection.device_id { + let _ = client.confirm_save_downloaded(save_id, did).await; + } + push_log( + cfg, + "success", + "pull_save", + format!("Downloaded save '{}' to {}", file_name, dest_path.display()), + ); + Ok(dest_path.to_string_lossy().to_string()) +} + +/// Downloads a single server save state into the inherited NextUI `/Saves//` folder. +pub async fn pull_single_state( + client: &RommClient, + cfg: &mut NextUiConfig, + state_id: i64, + rom_id: i64, + platform_slug: &str, + file_name: &str, +) -> Result { + let (_tag, save_dir) = resolve_save_dest_folder(platform_slug, cfg); + let dest_path = save_dir.join(file_name); + + let bytes = client.download_state_bytes(state_id).await?; + let _ = create_backup(&dest_path, rom_id, false, cfg.settings.max_backups_per_save); + write_downloaded_save(&dest_path, &bytes, false)?; + push_log( + cfg, + "success", + "pull_state", + format!("Downloaded state '{}' to {}", file_name, dest_path.display()), + ); + Ok(dest_path.to_string_lossy().to_string()) +} + +/// Uploads a single local save or state file/folder straight to RomM. +pub async fn push_single_item( + client: &RommClient, + cfg: &mut NextUiConfig, + item: &DiscoveredNextUiSave, + rom_id: i64, +) -> Result { + let (bytes, hash) = read_save_payload_and_hash(Path::new(&item.local_path), item.is_directory)?; + let emu_name = format!("nextui-{}", item.system_tag.to_lowercase()); + if item.is_state { + let existing = client + .get_states(Some(rom_id)) + .await + .unwrap_or_default() + .into_iter() + .find(|s| s.file_name.eq_ignore_ascii_case(&item.file_name)); + if let Some(remote) = existing { + client + .update_state(remote.id, &item.file_name, bytes) + .await?; + } else { + client + .upload_state(rom_id, Some(&emu_name), &item.file_name, bytes) + .await?; + } + cfg.synced_state_hashes.insert(item.local_path.clone(), hash); + push_log( + cfg, + "success", + "push_state", + format!("Uploaded state '{}'", item.file_name), + ); + } else { + let slot = if item.slot.trim().is_empty() { + "default" + } else { + &item.slot + }; + client + .upload_save( + rom_id, + Some(&emu_name), + Some(slot), + cfg.connection.device_id.as_deref(), + None, + true, + &item.file_name, + bytes, + ) + .await?; + push_log( + cfg, + "success", + "push_save", + format!("Uploaded save '{}' (slot: {})", item.file_name, slot), + ); + } + Ok(format!("Uploaded {}", item.file_name)) +} diff --git a/src/web_setup.rs b/src/web_setup.rs new file mode 100644 index 0000000..fcd4ff7 --- /dev/null +++ b/src/web_setup.rs @@ -0,0 +1,725 @@ +use crate::config::{load_config, push_log, save_config, ManualLink}; +use crate::matcher::discover_nextui_saves; +use crate::nextui::{discover_nextui_systems, resolve_rom_dest_folder}; +use crate::romm_api::RommClient; +use crate::sync_engine::{ + load_conflicts, pull_single_save, pull_single_state, push_single_item, resolve_conflict, + run_sync, +}; +use serde::Deserialize; +use std::net::UdpSocket; +use tokio::io::{AsyncReadExt, AsyncWriteExt}; +use tokio::net::{TcpListener, TcpStream}; + +pub fn local_lan_ip() -> String { + if let Ok(sock) = UdpSocket::bind("0.0.0.0:0") { + if sock.connect("8.8.8.8:80").is_ok() { + if let Ok(addr) = sock.local_addr() { + return addr.ip().to_string(); + } + } + } + "127.0.0.1".to_string() +} + +pub async fn serve_web_setup(port: u16) -> Result<(), String> { + let bind_addr = format!("0.0.0.0:{}", port); + let listener = TcpListener::bind(&bind_addr) + .await + .map_err(|e| format!("Failed to bind {}: {}", bind_addr, e))?; + + let ip = local_lan_ip(); + println!("WEB_SETUP_URL=http://{}:{}", ip, port); + + loop { + tokio::select! { + _ = tokio::signal::ctrl_c() => { + break; + } + accepted = listener.accept() => { + if let Ok((stream, _)) = accepted { + tokio::spawn(async move { + let _ = handle_connection(stream).await; + }); + } + } + } + } + Ok(()) +} + +async fn handle_connection(mut stream: TcpStream) -> Result<(), String> { + let mut buf = vec![0u8; 64 * 1024]; + let n = stream.read(&mut buf).await.map_err(|e| e.to_string())?; + if n == 0 { + return Ok(()); + } + let req_str = String::from_utf8_lossy(&buf[..n]); + let mut lines = req_str.lines(); + let request_line = lines.next().unwrap_or(""); + let mut parts = request_line.split_whitespace(); + let method = parts.next().unwrap_or("GET"); + let path = parts.next().unwrap_or("/"); + + let body = req_str + .split("\r\n\r\n") + .nth(1) + .unwrap_or("") + .trim_end_matches('\0'); + + let (status, content_type, resp_body) = match (method, path) { + ("GET", "/") => ("200 OK", "text/html; charset=utf-8", INDEX_HTML.to_string()), + ("GET", "/api/state") => { + let cfg = load_config(); + let systems = discover_nextui_systems(&cfg); + let conflicts = load_conflicts(); + let payload = serde_json::json!({ + "connected": cfg.connection.access_token.is_some() && !cfg.connection.server_url.is_empty(), + "serverUrl": cfg.connection.server_url, + "username": cfg.connection.username, + "deviceId": cfg.connection.device_id, + "deviceName": cfg.connection.device_name, + "settings": cfg.settings, + "systems": systems, + "conflicts": conflicts, + "logs": cfg.sync_logs.iter().take(25).collect::>(), + }); + ("200 OK", "application/json", payload.to_string()) + } + ("POST", "/api/connect") => handle_connect(body).await, + ("POST", "/api/test-server") => handle_test_server(body).await, + ("POST", "/api/device-auth/init") => handle_device_auth_init(body).await, + ("POST", "/api/device-auth/poll") => handle_device_auth_poll(body).await, + ("POST", "/api/sync") => handle_sync().await, + ("POST", "/api/resolve") => handle_resolve(body).await, + ("GET", "/api/saves") => handle_list_saves().await, + ("POST", "/api/link") => handle_manual_link(body).await, + ("POST", "/api/roms/search") => handle_search_roms(body).await, + ("POST", "/api/roms/download") => handle_download_rom(body).await, + ("POST", "/api/roms/assets") => handle_rom_assets(body).await, + ("POST", "/api/saves/pull") => handle_pull_save(body).await, + ("POST", "/api/states/pull") => handle_pull_state(body).await, + ("POST", "/api/saves/push") => handle_push_rom_saves(body).await, + _ => ("404 Not Found", "application/json", r#"{"error":"Not found"}"#.into()), + }; + + let response = format!( + "HTTP/1.1 {}\r\nContent-Type: {}\r\nContent-Length: {}\r\nConnection: close\r\n\r\n{}", + status, + content_type, + resp_body.len(), + resp_body + ); + stream + .write_all(response.as_bytes()) + .await + .map_err(|e| e.to_string())?; + Ok(()) +} + +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +struct ConnectBody { + server_url: String, + device_name: Option, + mode: String, // "pair_code" | "token" | "password" + pair_code: Option, + token: Option, + username: Option, + password: Option, +} + +async fn handle_connect(body: &str) -> (&'static str, &'static str, String) { + let parsed: ConnectBody = match serde_json::from_str(body) { + Ok(b) => b, + Err(e) => return ("400 Bad Request", "application/json", serde_json::json!({"error": e.to_string()}).to_string()), + }; + + let mut cfg = load_config(); + cfg.connection.server_url = parsed.server_url.trim().trim_end_matches('/').to_string(); + if let Some(dn) = parsed.device_name { + if !dn.trim().is_empty() { + cfg.connection.device_name = dn.trim().to_string(); + } + } + + let result: Result = async { + let client = RommClient::new(&cfg.connection.server_url, None)?; + let (access_token, device_id_opt) = match parsed.mode.as_str() { + "pair_code" => { + let code = parsed.pair_code.unwrap_or_default(); + let res = client.exchange_pair_code(&code).await?; + (res.raw_token, res.device_id) + } + "token" => (parsed.token.unwrap_or_default().trim().to_string(), None), + "password" => { + let tok = client + .login_password( + &parsed.username.unwrap_or_default(), + &parsed.password.unwrap_or_default(), + ) + .await?; + cfg.connection.refresh_token = tok.refresh_token; + (tok.access_token, None) + } + _ => return Err("Unsupported auth mode".into()), + }; + + let authed = RommClient::new(&cfg.connection.server_url, Some(access_token.clone()))?; + let user = authed.get_me().await?; + let device_id = match device_id_opt { + Some(id) => Some(id), + None => authed + .register_device(&cfg.connection.device_name) + .await + .ok() + .map(|d| d.id) + .or(user.current_device_id), + }; + + cfg.connection.access_token = Some(access_token); + cfg.connection.device_id = device_id; + cfg.connection.username = Some(user.username.clone()); + push_log(&mut cfg, "success", "auth", format!("Paired handheld as {}", user.username)); + save_config(&cfg)?; + Ok(user.username) + } + .await; + + match result { + Ok(u) => ("200 OK", "application/json", serde_json::json!({"ok": true, "username": u}).to_string()), + Err(e) => ("400 Bad Request", "application/json", serde_json::json!({"error": e}).to_string()), + } +} + +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +struct ServerUrlBody { + server_url: String, + device_name: Option, +} + +async fn handle_test_server(body: &str) -> (&'static str, &'static str, String) { + let parsed: ServerUrlBody = match serde_json::from_str(body) { + Ok(b) => b, + Err(e) => return ("400 Bad Request", "application/json", serde_json::json!({"error": e.to_string()}).to_string()), + }; + let res = async { + let client = RommClient::new(&parsed.server_url, None)?; + client.heartbeat().await + } + .await; + match res { + Ok(_) => ("200 OK", "application/json", r#"{"ok":true}"#.into()), + Err(e) => ("400 Bad Request", "application/json", serde_json::json!({"error": e}).to_string()), + } +} + +async fn handle_device_auth_init(body: &str) -> (&'static str, &'static str, String) { + let parsed: ServerUrlBody = match serde_json::from_str(body) { + Ok(b) => b, + Err(e) => return ("400 Bad Request", "application/json", serde_json::json!({"error": e.to_string()}).to_string()), + }; + let mut cfg = load_config(); + cfg.connection.server_url = parsed.server_url.trim().trim_end_matches('/').to_string(); + if let Some(dn) = parsed.device_name { + if !dn.trim().is_empty() { + cfg.connection.device_name = dn.trim().to_string(); + } + } + let _ = save_config(&cfg); + + let res = async { + let client = RommClient::new(&cfg.connection.server_url, None)?; + client + .device_auth_init( + &cfg.connection.client_device_identifier, + &cfg.connection.device_name, + ) + .await + } + .await; + match res { + Ok(init) => ("200 OK", "application/json", serde_json::to_string(&init).unwrap_or_default()), + Err(e) => ("400 Bad Request", "application/json", serde_json::json!({"error": e}).to_string()), + } +} + +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +struct DevicePollBody { + server_url: String, + device_code: String, +} + +async fn handle_device_auth_poll(body: &str) -> (&'static str, &'static str, String) { + let parsed: DevicePollBody = match serde_json::from_str(body) { + Ok(b) => b, + Err(e) => return ("400 Bad Request", "application/json", serde_json::json!({"error": e.to_string()}).to_string()), + }; + let res = async { + let client = RommClient::new(&parsed.server_url, None)?; + let Some(tok) = client.device_auth_poll(&parsed.device_code).await? else { + return Ok::<_, String>(None); + }; + let authed = RommClient::new(&parsed.server_url, Some(tok.access_token.clone()))?; + let user = authed.get_me().await?; + let mut cfg = load_config(); + cfg.connection.server_url = parsed.server_url.trim().trim_end_matches('/').to_string(); + cfg.connection.access_token = Some(tok.access_token); + cfg.connection.device_id = Some(tok.device_id); + cfg.connection.username = Some(user.username.clone()); + push_log(&mut cfg, "success", "auth", format!("Paired handheld as {}", user.username)); + save_config(&cfg)?; + Ok(Some(user.username)) + } + .await; + match res { + Ok(Some(u)) => ("200 OK", "application/json", serde_json::json!({"ok": true, "username": u}).to_string()), + Ok(None) => ("200 OK", "application/json", r#"{"pending":true}"#.into()), + Err(e) => ("400 Bad Request", "application/json", serde_json::json!({"error": e}).to_string()), + } +} + +async fn handle_sync() -> (&'static str, &'static str, String) { + let mut cfg = load_config(); + let res = async { + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let roms = client.get_all_roms().await?; + let summary = run_sync(&client, &mut cfg, &roms).await?; + save_config(&cfg)?; + Ok::<_, String>(summary) + } + .await; + match res { + Ok(s) => ("200 OK", "application/json", serde_json::to_string(&s).unwrap_or_default()), + Err(e) => ("500 Internal Server Error", "application/json", serde_json::json!({"error": e}).to_string()), + } +} + +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +struct ResolveBody { + conflict_id: String, + resolution: String, +} + +async fn handle_resolve(body: &str) -> (&'static str, &'static str, String) { + let parsed: ResolveBody = match serde_json::from_str(body) { + Ok(b) => b, + Err(e) => return ("400 Bad Request", "application/json", serde_json::json!({"error": e.to_string()}).to_string()), + }; + let mut cfg = load_config(); + let res = async { + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let msg = resolve_conflict(&client, &mut cfg, &parsed.conflict_id, &parsed.resolution).await?; + save_config(&cfg)?; + Ok::<_, String>(msg) + } + .await; + match res { + Ok(msg) => ("200 OK", "application/json", serde_json::json!({"ok": true, "message": msg}).to_string()), + Err(e) => ("400 Bad Request", "application/json", serde_json::json!({"error": e}).to_string()), + } +} + +async fn handle_list_saves() -> (&'static str, &'static str, String) { + let cfg = load_config(); + let roms = match RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone()) { + Ok(c) if cfg.connection.access_token.is_some() => c.get_all_roms().await.unwrap_or_default(), + _ => Vec::new(), + }; + let saves = discover_nextui_saves(&cfg, &roms); + ( + "200 OK", + "application/json", + serde_json::json!({"saves": saves, "romCount": roms.len()}).to_string(), + ) +} + +async fn handle_manual_link(body: &str) -> (&'static str, &'static str, String) { + let link: ManualLink = match serde_json::from_str(body) { + Ok(l) => l, + Err(e) => return ("400 Bad Request", "application/json", serde_json::json!({"error": e.to_string()}).to_string()), + }; + let mut cfg = load_config(); + cfg.manual_links.insert(link.local_path.clone(), link); + match save_config(&cfg) { + Ok(()) => ("200 OK", "application/json", r#"{"ok":true}"#.into()), + Err(e) => ("500 Internal Server Error", "application/json", serde_json::json!({"error": e}).to_string()), + } +} + +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +struct SearchRomsBody { + query: Option, +} + +async fn handle_search_roms(body: &str) -> (&'static str, &'static str, String) { + let parsed: SearchRomsBody = serde_json::from_str(body).unwrap_or(SearchRomsBody { query: None }); + let cfg = load_config(); + let res = async { + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + client.get_roms(None, parsed.query.as_deref(), 40, 0).await + } + .await; + match res { + Ok(page) => ("200 OK", "application/json", serde_json::to_string(&page).unwrap_or_default()), + Err(e) => ("400 Bad Request", "application/json", serde_json::json!({"error": e}).to_string()), + } +} + +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +struct RomDownloadBody { + rom_id: i64, + file_name: String, + platform_slug: String, + platform_display_name: String, +} + +async fn handle_download_rom(body: &str) -> (&'static str, &'static str, String) { + let parsed: RomDownloadBody = match serde_json::from_str(body) { + Ok(b) => b, + Err(e) => return ("400 Bad Request", "application/json", serde_json::json!({"error": e.to_string()}).to_string()), + }; + let mut cfg = load_config(); + let res = async { + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let dest_dir = resolve_rom_dest_folder(&parsed.platform_slug, &parsed.platform_display_name, &cfg); + let dest_file = dest_dir.join(&parsed.file_name); + client.download_rom(parsed.rom_id, &parsed.file_name, &dest_file).await?; + push_log(&mut cfg, "success", "download_rom", format!("Downloaded {} to {}", parsed.file_name, dest_file.display())); + save_config(&cfg)?; + Ok::<_, String>(dest_file.to_string_lossy().to_string()) + } + .await; + match res { + Ok(path) => ("200 OK", "application/json", serde_json::json!({"ok": true, "path": path}).to_string()), + Err(e) => ("400 Bad Request", "application/json", serde_json::json!({"error": e}).to_string()), + } +} + +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +struct RomIdBody { + rom_id: i64, +} + +async fn handle_rom_assets(body: &str) -> (&'static str, &'static str, String) { + let parsed: RomIdBody = match serde_json::from_str(body) { + Ok(b) => b, + Err(e) => return ("400 Bad Request", "application/json", serde_json::json!({"error": e.to_string()}).to_string()), + }; + let cfg = load_config(); + let res = async { + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let saves = client.get_saves(Some(parsed.rom_id), cfg.connection.device_id.as_deref()).await?; + let states = client.get_states(Some(parsed.rom_id)).await?; + Ok::<_, String>(serde_json::json!({"saves": saves, "states": states})) + } + .await; + match res { + Ok(v) => ("200 OK", "application/json", v.to_string()), + Err(e) => ("400 Bad Request", "application/json", serde_json::json!({"error": e}).to_string()), + } +} + +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +struct PullAssetBody { + id: i64, + rom_id: i64, + platform_slug: String, + file_name: String, +} + +async fn handle_pull_save(body: &str) -> (&'static str, &'static str, String) { + let parsed: PullAssetBody = match serde_json::from_str(body) { + Ok(b) => b, + Err(e) => return ("400 Bad Request", "application/json", serde_json::json!({"error": e.to_string()}).to_string()), + }; + let mut cfg = load_config(); + let res = async { + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let path = pull_single_save(&client, &mut cfg, parsed.id, parsed.rom_id, &parsed.platform_slug, &parsed.file_name).await?; + save_config(&cfg)?; + Ok::<_, String>(path) + } + .await; + match res { + Ok(path) => ("200 OK", "application/json", serde_json::json!({"ok": true, "path": path}).to_string()), + Err(e) => ("400 Bad Request", "application/json", serde_json::json!({"error": e}).to_string()), + } +} + +async fn handle_pull_state(body: &str) -> (&'static str, &'static str, String) { + let parsed: PullAssetBody = match serde_json::from_str(body) { + Ok(b) => b, + Err(e) => return ("400 Bad Request", "application/json", serde_json::json!({"error": e.to_string()}).to_string()), + }; + let mut cfg = load_config(); + let res = async { + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let path = pull_single_state(&client, &mut cfg, parsed.id, parsed.rom_id, &parsed.platform_slug, &parsed.file_name).await?; + save_config(&cfg)?; + Ok::<_, String>(path) + } + .await; + match res { + Ok(path) => ("200 OK", "application/json", serde_json::json!({"ok": true, "path": path}).to_string()), + Err(e) => ("400 Bad Request", "application/json", serde_json::json!({"error": e}).to_string()), + } +} + +async fn handle_push_rom_saves(body: &str) -> (&'static str, &'static str, String) { + let parsed: RomIdBody = match serde_json::from_str(body) { + Ok(b) => b, + Err(e) => return ("400 Bad Request", "application/json", serde_json::json!({"error": e.to_string()}).to_string()), + }; + let mut cfg = load_config(); + let res = async { + let client = RommClient::new(&cfg.connection.server_url, cfg.connection.access_token.clone())?; + let roms = client.get_all_roms().await?; + let local = discover_nextui_saves(&cfg, &roms); + let matched: Vec<_> = local.into_iter().filter(|i| i.matched_rom_id == Some(parsed.rom_id)).collect(); + if matched.is_empty() { + return Err("No local saves found on SD card for this game.".into()); + } + let mut count = 0usize; + for item in matched { + push_single_item(&client, &mut cfg, &item, parsed.rom_id).await?; + count += 1; + } + save_config(&cfg)?; + Ok::<_, String>(count) + } + .await; + match res { + Ok(count) => ("200 OK", "application/json", serde_json::json!({"ok": true, "count": count}).to_string()), + Err(e) => ("400 Bad Request", "application/json", serde_json::json!({"error": e}).to_string()), + } +} + +const INDEX_HTML: &str = r#" + + + + +RomM Companion — NextUI Setup + + + +
+
+

RomM Companion for NextUI

+
Loading handheld status...
+
+ +
+

Connect to RomM 5.1.0

+
+ + +
+ + +
Starts RomM 5.1.0 device pairing and gives you a one-tap approval link.
+ + + + +
+
+ +
+

Quick Actions

+ +
+
+ + + +
+

Games & Individual Saves

+
+ + +
+
+
+
+ +
+

Detected NextUI Systems

+
Scanning SD card...
+
+
+ + +"#;