diff --git a/.github/resources/discord_banner.png b/.github/resources/discord_banner.png new file mode 100644 index 000000000..7e1f339e1 Binary files /dev/null and b/.github/resources/discord_banner.png differ diff --git a/romm.png b/.github/resources/romm.png similarity index 100% rename from romm.png rename to .github/resources/romm.png diff --git a/romm.svg b/.github/resources/romm.svg similarity index 100% rename from romm.svg rename to .github/resources/romm.svg diff --git a/.github/screenshots/details.png b/.github/resources/screenshots/details.png similarity index 100% rename from .github/screenshots/details.png rename to .github/resources/screenshots/details.png diff --git a/.github/screenshots/gallery.png b/.github/resources/screenshots/gallery.png similarity index 100% rename from .github/screenshots/gallery.png rename to .github/resources/screenshots/gallery.png diff --git a/.github/screenshots/home.png b/.github/resources/screenshots/home.png similarity index 100% rename from .github/screenshots/home.png rename to .github/resources/screenshots/home.png diff --git a/.github/screenshots/m_details.png b/.github/resources/screenshots/m_details.png similarity index 100% rename from .github/screenshots/m_details.png rename to .github/resources/screenshots/m_details.png diff --git a/.github/screenshots/m_gallery.png b/.github/resources/screenshots/m_gallery.png similarity index 100% rename from .github/screenshots/m_gallery.png rename to .github/resources/screenshots/m_gallery.png diff --git a/.github/screenshots/m_home.png b/.github/resources/screenshots/m_home.png similarity index 100% rename from .github/screenshots/m_home.png rename to .github/resources/screenshots/m_home.png diff --git a/.github/screenshots/m_search.png b/.github/resources/screenshots/m_search.png similarity index 100% rename from .github/screenshots/m_search.png rename to .github/resources/screenshots/m_search.png diff --git a/.github/resources/screenshots/romm-desktop-slider.gif b/.github/resources/screenshots/romm-desktop-slider.gif new file mode 100644 index 000000000..1019b4268 Binary files /dev/null and b/.github/resources/screenshots/romm-desktop-slider.gif differ diff --git a/.github/resources/screenshots/romm-mobile-slider.gif b/.github/resources/screenshots/romm-mobile-slider.gif new file mode 100644 index 000000000..595b730e2 Binary files /dev/null and b/.github/resources/screenshots/romm-mobile-slider.gif differ diff --git a/.github/screenshots/search.png b/.github/resources/screenshots/search.png similarity index 100% rename from .github/screenshots/search.png rename to .github/resources/screenshots/search.png diff --git a/.github/resources/wiki_banner.png b/.github/resources/wiki_banner.png new file mode 100644 index 000000000..c26bf6169 Binary files /dev/null and b/.github/resources/wiki_banner.png differ diff --git a/.gitignore b/.gitignore index 70459ffae..0f06ff0e0 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,7 @@ backend/romm_test/logs # service worker frontend/dev-dist + +# outside data +switch_titledb.json +mame.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 32e68e391..7f71b8209 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,30 @@ +# v2.1.0 (_31-10-2023_) + +## Added + - Added ``Scheduler`` to run scheduled scans and ``Watchdog`` to perform scans when adding/renamed/deleted any rom from the filesystem. Added a lot of new environment variables to configure both features. Check the [readme.md](README.md#๐Ÿ“…-scheduler) for an explanation of how to configure them. + - Added new `REDIS_PASSWORD` environment variable to support secured redis with pasword. Closes [#412](https://github.com/zurdi15/romm/issues/412) + - New ``Recently Added`` section in the dashboard shows the last 15 added roms. Closes [#400](https://github.com/zurdi15/romm/issues/400) + +## Fixed + - Upload rom feature is now working properly. + - Fixed order roms by size in the gallery list view. Fixes [#423](https://github.com/zurdi15/romm/issues/423) + +## Changed + - Now platforms without roms will be hidden in the drawer and the dashboard. Closes [#396](https://github.com/zurdi15/romm/issues/396) + +
+ +# v2.0.1 (_29-10-2023_) + +## Fixed + - Fixed an error that caused to show the wrong roms for one platform if user navigates directly to that platform from a rom details page. Fixes [#408](https://github.com/zurdi15/romm/issues/408) + +
+ # v2.0.0 (_27-10-2023_) ## Added - - User management system. Check the [docker-compose.example.yml](docker/docker-compose.example.yml) for all the needed changes and environment variables. Closes [#24](https://github.com/zurdi15/romm/issues/24) + - User management system. Check the [docker-compose.example.yml](examples/docker-compose.example.yml) for all the needed changes and environment variables. Closes [#24](https://github.com/zurdi15/romm/issues/24) - Gallery bulk selection. Closes [#50](https://github.com/zurdi15/romm/issues/50) - Roms upload feature. - Custom cover art. @@ -43,7 +66,7 @@ # v1.9.1 (_01-08-2023_) ## Added - - RomM logs are now stored in `/romm/logs` in docker and path can be binded in docker-compose. Check [docker-compose.example.yml](docker/docker-compose.example.yml). Solves [#303](https://github.com/zurdi15/romm/issues/303) + - RomM logs are now stored in `/romm/logs` in docker and path can be binded in docker-compose. Check [docker-compose.example.yml](examples/docker-compose.example.yml). Solves [#303](https://github.com/zurdi15/romm/issues/303) ## Fixed - Fixed multipart roms scanning. @@ -190,14 +213,14 @@ # v1.6.1 (_04-04-2023_) ## Added - - Now sqlite database location needs to be binded to ``/romm/database``. Check [docker-compose](docker/docker-compose.example.yml) example. - - Now resources location (games cover) needs to be binded to ``/romm/resources``. Check [docker-compose](docker/docker-compose.example.yml) example. + - Now sqlite database location needs to be binded to ``/romm/database``. Check [docker-compose](examples/docker-compose.example.yml) example. + - Now resources location (games cover) needs to be binded to ``/romm/resources``. Check [docker-compose](examples/docker-compose.example.yml) example. - More platforms support. Check [platforms support](https://github.com/zurdi15/romm#platforms-support) - Now RomM version appears in the bottom of the settings panel ## Fixed - Download feature is now fixed for RomM structucture 1 ## Changed - - Library path binding changed from ``/library`` to ``/romm/library``. Check [docker-compose](docker/docker-compose.example.yml) + - Library path binding changed from ``/library`` to ``/romm/library``. Check [docker-compose](examples/docker-compose.example.yml)
@@ -280,7 +303,7 @@ Columns to modify (examples in case that you set it with database name as romm, ## Added - Notification added when downloading a game ## Changed - - Database name when using mariadb now can be changed with the new variable DB_NAME. Check [docker-compos.example.yml](https://github.com/zurdi15/romm/blob/master/docker/docker-compose.example.yml) + - Database name when using mariadb now can be changed with the new variable DB_NAME. Check [docker-compos.example.yml](https://github.com/zurdi15/romm/blob/master/examples/docker-compose.example.yml) ## Fixed - Potential password error when using mariadb if the password have special characters - Some other bugs @@ -293,7 +316,7 @@ Columns to modify (examples in case that you set it with database name as romm, - SQLite support - Dreamcast support (https://github.com/zurdi15/romm#platforms-support) ## Changed - - SQLite is now the database by default if ROMM_DB_DRIVER is not set. Check [docker-compos.example.yml](https://github.com/zurdi15/romm/blob/master/docker/docker-compose.example.yml) + - SQLite is now the database by default if ROMM_DB_DRIVER is not set. Check [docker-compos.example.yml](https://github.com/zurdi15/romm/blob/master/examples/docker-compose.example.yml) - Platforms and games are now shown by alphabetical order
diff --git a/README.md b/README.md index a7d620559..aa2b38b12 100644 --- a/README.md +++ b/README.md @@ -1,307 +1,210 @@
-

RomM Logo

+

RomM Logo

GitHub GitHub release (latest SemVer) GitHub Workflow Status (with branch) -
- - Docker Pulls - Docker Image Size (latest by date) - - Discord
-
- Buy Me A Coffee + + Docker Pulls + + + Docker Image Size (latest by date) + + + Discord + +
+ +
+ +
+ + Buy Me A Coffee +
# Overview -RomM (stands for Rom Manager) is a game library manager focused in retro gaming. Manage and organize all of your games from a web browser. +RomM (**ROM M**anager) is a game library manager focused on retro gaming. It enables you to efficiently manage and organize all your games from a web browser. -Inspired by [Jellyfin](https://jellyfin.org/), allows you to manage all your games from a modern interface while enriching them with IGDB metadata. +Inspired by [Jellyfin](https://jellyfin.org/), RomM allows you to handle all your games through a modern interface while enhancing them with IGDB metadata. ## โšก Features -* Scan your game library (all at once or by platform) and enriches it with IGDB metadata -* Access your library via your web-browser -* Possibility to select one of the matching IGDB results if the scan doesn't get the right one -* Upload games directly from your web-browser -* Set a custom cover for each game -* EmuDeck folder structure compatibility -* Multiple files games support -* Download games directly from your web-browser -* Edit your game files directly from your web-browser -* Region, revision/version and extra tags support -* Works with SQLite or MaridDB (SQLite by default) -* Responsive design -* Light and dark theme +- Scan your game library (all at once or by platform) and enrich it with IGDB metadata. +- Access your library via your web browser. +- Easily choose from matching IGDB results if the scan doesn't find the right one. +- Compatible with EmuDeck folder structures. +- Supports games with multiple files. +- Download games directly from your web browser. +- Edit your game files directly from your web browser. +- Upload games directly from your web-browser +- Set a custom cover for each game +- Includes region, revision/version, and extra tags support. +- Works with SQLite or MaridDB. +- Features a responsive design with dark mode support. # Preview ## ๐Ÿ–ฅ Desktop -
-
- Expand to preview - ![Desktop home](.github/screenshots/home.png "RomM home") - ![Desktop gallery](.github/screenshots/gallery.png "RomM gallery") - ![Desktop details](.github/screenshots/details.png "RomM details") - ![Desktop search](.github/screenshots/search.png "RomM search") - -
-
+ ## ๐Ÿ“ฑ Mobile -
-
- Expand to preview - ![Mobile home](.github/screenshots/m_home.png "RomM home") - ![Mobile gallery](.github/screenshots/m_gallery.png "RomM gallery") - ![Mobile details](.github/screenshots/m_details.png "RomM details") - ![Mobile search](.github/screenshots/m_search.png "RomM search") + -
-
+# The RomM Community -# The RomM community -[Wiki](https://github.com/zurdi15/romm/wiki)
-[Discord](https://discord.gg/P5HtHnhUDH)
+discord-banner +wiki-banner # Installation ## ๐Ÿณ Docker -Docker should be installed and set up before running the [image](https://hub.docker.com/r/zurdi15/romm/tags). +Before running the [image](https://hub.docker.com/r/zurdi15/romm/tags), ensure that Docker is installed and set up. -1. Generate an API key for [IGDB](https://www.igdb.com/), and set the `IGDB_CLIENT_ID` and `IGDB_CLIENT_SECRET` variables. _This is required to run a library scan._ Instructions on generating the ID and Secret are [here](https://api-docs.igdb.com/#about). Note that IGDB requires a Twitch account with 2FA enabled to generate the ID and Secret. +1. Generate an API key for [IGDB](https://www.igdb.com/) and set the `IGDB_CLIENT_ID` and `IGDB_CLIENT_SECRET` variables. This step is essential for running a library scan. Instructions for generating the ID and Secret can be found [here](https://api-docs.igdb.com/#about). Note that IGDB requires a Twitch account with 2FA enabled to generate the ID and Secret. 2. Verify that your library folder structure matches one of the options listed in the [following section](#folder-structure). -3. Create a docker-compose file. See the following example [docker-compose.yml](https://github.com/zurdi15/romm/blob/master/examples/docker-compose.example.yml) file for reference. Customize for your setup and include the `IGDB_CLIENT_ID` and `IGDB_CLIENT_SECRET` variables where indicated in the environment section of the file. +3. Create a docker-compose file. Refer to the example [docker-compose.yml](https://github.com/zurdi15/romm/blob/master/examples/docker-compose.example.yml) file for guidance. Customize it for your setup and include the `IGDB_CLIENT_ID` and `IGDB_CLIENT_SECRET` variables in the environment section of the file. 4. Launch the container: - - ```bash - docker-compose up -d - ``` - - + +```bash +docker-compose up -d +``` + # Configuration -

๐Ÿ“ Folder structure

+## ๐Ÿ“ Folder Structure -RomM accepts two different folder structure by priority. RomM will try to find the structure 1 and if it doesn't exists, RomM will try to find structure 2. +RomM accepts two different folder structures by priority. RomM will attempt to find structure 1, and if it doesn't exist, it will look for structure 2. -Review the [Platforms support](#platform-support) section for device naming conventions, and the [Configuration file](#configuration-file) section to override default system names in the folder structure, if your directories are named differently. +For device naming conventions, review the [Platforms Support](#platform-support) section. To override default system names in the folder structure (if your directories are named differently), see the [Configuration File](#configuration-file) section. - - Structure 1 (high priority) - roms folder at root of library folder: - ``` - library/ - โ”œโ”€ roms/ - โ”œโ”€ gbc/ - โ”‚ โ”œโ”€ rom_1.gbc - โ”‚ โ”œโ”€ rom_2.gbc - โ”‚ - โ”œโ”€ gba/ - โ”‚ โ”œโ”€ rom_1.gba - โ”‚ โ”œโ”€ rom_2.gba - โ”‚ - โ”œโ”€ ps/ - โ”œโ”€ my_multifile_game/ - โ”‚ โ”œโ”€ my_game_cd1.iso - โ”‚ โ”œโ”€ my_game_cd2.iso - โ”‚ - โ”œโ”€ rom_1.iso - ``` - - Structure 2 (low priority) - roms folder inside each platform folder - ``` - library/ - โ”œโ”€ gbc/ - โ”‚ โ”œโ”€ roms/ - โ”‚ โ”œโ”€ rom_1.gbc - โ”‚ โ”œโ”€ rom_2.gbc - | - โ”œโ”€ gba/ - โ”‚ โ”œโ”€ roms/ - โ”‚ โ”œโ”€ rom_1.gba - โ”‚ โ”œโ”€ rom_2.gba - | - โ”œโ”€ ps/ - โ”‚ โ”œโ”€ roms/ - โ”‚ โ”œโ”€ my_multifile_game/ - โ”‚ โ”‚ โ”œโ”€ my_game_cd1.iso - โ”‚ โ”‚ โ”œโ”€ my_game_cd2.iso - โ”‚ โ”‚ - โ”‚ โ”œโ”€ rom_1.iso - ``` +### Structure A (high-priority) -

๐Ÿ”’ Authentication

+Example: `library/roms/gbc/game.zip` -If you want to enable the user management system, a redis container and some environment variables needs to be set. In the [docker-compose.yml](https://github.com/zurdi15/romm/blob/master/examples/docker-compose.example.yml) you will find the needed variables and an example of how to spin up a redis container: +``` +library/ +โ”œโ”€ roms/ +โ”‚ โ”œโ”€ gbc/ +โ”‚ โ”‚ โ”œโ”€ rom_1.gbc +โ”‚ โ”‚ โ”œโ”€ rom_2.gbc +โ”‚ โ”‚ +โ”‚ โ”œโ”€ gba/ +โ”‚ โ”‚ โ”œโ”€ rom_1.gba +โ”‚ โ”‚ โ”œโ”€ rom_2.gba +โ”‚ โ”‚ +โ”‚ โ”œโ”€ ps/ +โ”‚ โ”œโ”€ my_multifile_game/ +โ”‚ โ”‚ โ”œโ”€ my_game_cd1.iso +โ”‚ โ”‚ โ”œโ”€ my_game_cd2.iso +โ”‚ โ”‚ +โ”‚ โ”œโ”€ rom_1.iso +``` - - `ROMM_AUTH_ENABLED` and `ENABLE_EXPERIMENTAL_REDIS` must be set as `true` - - `ROMM_AUTH_SECRET_KEY` must be generated with `openssl rand -hex 32` - - `ROMM_AUTH_USERNAME` and `ROMM_AUTH_PASSWORD` can be set as wanted, being both `admin` by default. - - `REDIS_HOST` and `REDIS_PORT` must point to your redis instance +### Structure B (low-priority) -

โš™๏ธ Configuration file

+Example: `library/gbc/roms/game.zip` -RomM can be configured through a yml file. +``` +library/ +โ”œโ”€ gbc/ +โ”‚ โ”œโ”€ roms/ +โ”‚ โ”œโ”€ rom_1.gbc +โ”‚ โ”œโ”€ rom_2.gbc +โ”‚ +โ”œโ”€ gba/ +โ”‚ โ”œโ”€ roms/ +โ”‚ โ”œโ”€ rom_1.gba +โ”‚ โ”œโ”€ rom_2.gba +โ”‚ +โ”œโ”€ ps/ +โ”‚ โ”œโ”€ roms/ +โ”‚ โ”œโ”€ my_multifile_game/ +โ”‚ โ”‚ โ”œโ”€ my_game_cd1.iso +โ”‚ โ”‚ โ”œโ”€ my_game_cd2.iso +โ”‚ โ”‚ +โ”‚ โ”œโ”€ rom_1.iso +``` -For a configuration change to take effect, RomM must be restarted. +## โš™๏ธ Configuration File -Check the [config.yml](https://github.com/zurdi15/romm/blob/master/examples/config.example.yml) example. +RomM can be configured through a YAML file. To apply configuration changes, you must restart RomM. -Check the [docker-compose.yml](https://github.com/zurdi15/romm/blob/master/examples/docker-compose.example.yml) example to see how to bind it. +Refer to the [config.example.yml](https://github.com/zurdi15/romm/blob/master/examples/config.example.yml) file and the [docker-compose.example.yml](https://github.com/zurdi15/romm/blob/master/examples/docker-compose.example.yml) for guidance on how to configure it. -# Naming convention +## ๐Ÿ”’ Authentication -

๐ŸŽฎ Platform support

+If you want to enable the user management system, a redis container and some environment variables needs to be set. Complete instructions are available in the [wiki](https://github.com/zurdi15/romm/wiki/Authentication). -If the RomM [folder structure](#๐Ÿ“-folder-structure) is followed, any kind of platform/folder-name is supported for the core features. For having extra metadata as well as cover images and platforms icons, the following table shows how to name your platforms folders. -This will change over the time, adding games metadata for more platforms. +## ๐Ÿ“… Scheduler -
-
- Platform support list - +The scheduler allows to scheduled async tasks that run in the Redis container at regular intervals. Jobs can be run at a specific time in the future, after a time delta, or at recurring internals using cron notation. -| slug | name | games metadata | -|-------------------------|-------------------------------------| :----: | -| 3ds | Nintendo 3DS | โœ… | -| amiga | Amiga | โœ… | -| acpc | Amstrad CPC | โœ… | -| arcade | Arcade | โœ… | -| atari | atari | โŒ | -| atari2600 | Atari 2600 | โœ… | -| atari5200 | Atari 5200 | โœ… | -| atari7800 | Atari 7800 | โœ… | -| coleco | coleco | โŒ | -| c64 | Commodore C64/128/MAX | โœ… | -| cpc | cpc | โŒ | -| cps1 | cps1 | โŒ | -| cps2 | cps2 | โŒ | -| cps3 | cps3 | โŒ | -| daphne | daphne | โŒ | -| dc | Dreamcast | โœ… | -| doom | doom | โŒ | -| dos | DOS | โœ… | -| fairchild | fairchild | โŒ | -| fba2012 | fba2012 | โŒ | -| fbneo | fbneo | โŒ | -| fds | Family Computer Disk System | โœ… | -| game-and-watch | Game & Watch | โœ… | -| gb | Game Boy | โœ… | -| gba | Game Boy Advance | โœ… | -| gbc | Game Boy Color | โœ… | -| genesis-slash-megadrive | Sega Mega Drive/Genesis | โœ… | -| gamegear | Sega Game Gear | โœ… | -| gw | gw | โŒ | -| intellivision | Intellivision | โœ… | -| jaguar | Atari Jaguar | โœ… | -| lynx | Atari Lynx | โœ… | -| md | md | โŒ | -| megaduck | megaduck | โŒ | -| ms | ms | โŒ | -| msx | MSX | โœ… | -| n64 | Nintendo 64 | โœ… | -| nds | Nintendo DS | โœ… | -| neocd | neocd | โŒ | -| neogeo | neogeo | โŒ | -| nes | Nintendo Entertainment System | โœ… | -| ngc | Nintendo GameCube | โœ… | -| ngp | ngp | โŒ | -| odyssey | odyssey | โŒ | -| pc-98 | PC-98 | โœ… | -| pce | pce | โŒ | -| pcecd | pcecd | โŒ | -| pico | pico | โŒ | -| pokemon-mini | Pokรฉmon mini | โœ… | -| ps | PlayStation | โœ… | -| ps2 | PlayStation 2 | โœ… | -| ps3 | PlayStation 3 | โœ… | -| ps4 | ps4 | โŒ | -| psp | PlayStation Portable | โœ… | -| psvita | PlayStation Vita | โœ… | -| saturn | Sega Saturn | โœ… | -| sega32 | Sega 32X | โœ… | -| scummvm | scummvm | โŒ | -| segacd | Sega CD | โœ… | -| segasgone | segasgone | โŒ | -| sms | Sega Master System/Mark III | โœ… | -| sgb | sgb | โŒ | -| sgfx | sgfx | โŒ | -| snes | Super Nintendo Entertainment System | โœ… | -| supervision | supervision | โŒ | -| switch | Nintendo Switch | โœ… | -| virtualboy | Virtual Boy | โœ… | -| wii | Wii | โœ… | -| win | PC (Microsoft Windows) | โœ… | -| wiiu | Wii U | โœ… | -| wonderswan | WonderSwan | โœ… | -| wonderswan-color | WonderSwan Color | โœ… | -| xbox | Xbox | โœ… | -| xbox360 | Xbox 360 | โœ… | -| xboxone | Xbox One | โœ… | +Jobs can be toggled using these environment variables: - -
-
+``` +ENABLE_SCHEDULED_RESCAN: Whether to rescan on a schedule +SCHEDULED_RESCAN_CRON: Cron expression for scheduled rescan +ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB: Whether to update the switch title database on a schedule +SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON: Cron expression for scheduled switch title database update +ENABLE_SCHEDULED_UPDATE_MAME_XML: Whether to update the MAME XML on a schedule +SCHEDULED_UPDATE_MAME_XML_CRON: Cron expression for scheduled MAME XML update +``` -## ๐Ÿ“‘ Tags support +### Scheduled rescan -Games can be tagged with region, revision or other tags using parenthesis in the file name. +Users can opt to enable scheduled rescans, and set the interval using cron notation. Not that the scan will **not completely rescan** every file, only catch those which have been added/updated. - - Regions will be detected according to the following dictionary: +### Switch titleDB update -| shortcode | region | -|-----------|---------------| -| A | Australia | -| AS | Asia | -| B | Brazil | -| C | Canada | -| CH | China | -| E | Europe | -| F | France | -| FN | Finland | -| G | Germany | -| GR | Greece | -| H | Holland | -| HK | Hong Kong | -| I | Italy | -| J | Japan | -| K | Korea | -| NL | Netherlands | -| NO | Norway | -| PD | Public Domain | -| R | Russia | -| S | Spain | -| SW | Sweden | -| T | Taiwan | -| U | USA | -| UK | England | -| UNK | Unknown | -| UNL | Unlicensed | -| W | World | +Support was added for Nintendo Switch ROMs with filenames using the [titleid/programid format](https://switchbrew.org/w/index.php?title=Title_list/Games&mobileaction=toggle_view_desktop) (e.g. 0100000000010000.xci). If a file under the `switch` folder matches the regex, the scanner will use the index to attempt to match it to a game. If a match is found, the IGDB handler will use the matched name as the search term. -*Aditionally, region can be set adding **"reg-"** as prefix: (reg-E) / (reg-Spain) / (reg-USA) +The associated task updates the `/fixtures/switch_titledb.json` file at a regular interval to support new game releases. - - Revision tags must be prefixed with **"rev "** or with **"rev-"**: (rev v1) / (rev-v1) / (rev-whatever) +### MAME XML update - - Any other tag can have any structure +Support was also added for MAME arcade games with shortcode names (e.g. `actionhw.zip` -> ACTION HOLLYWOOD), and works in the same way as the titleid matcher (without the regex). - - Example: **my_game (E)(rev v1)(fav)(aditional_tag).gba** +The associated task updates the `/fixtures/mame.xml` file at a regular interval to support updates to the library. -**NOTE:** Tags can be used with the search bar to help to filter your library. +## ๐Ÿ” Watchdog -# โ› Troubleshoot +A watchdog was added which monitors the filesystem for events (files created/moved/deleted) and schedules a rescan of the platform (or entire library is a new platform was added). -* After the first installation, sometimes the RomM container can have problems connecting with the database. Restarting the RomM container may solve the problem. +Jobs can be toggled using these environment variables: -# ๐Ÿงพ References +``` +ENABLE_RESCAN_ON_FILESYSTEM_CHANGE: Whether to rescan when the filesystem changes +RESCAN_ON_FILESYSTEM_CHANGE_DELAY: Delay in minutes before rescanning on filesystem change +``` -* Complete [changelog](https://github.com/zurdi15/romm/blob/master/CHANGELOG.md) +The watcher will monitor the `/library/roms` folder for changes to the filesystem, such as files being added, moved or deleted. It will ignore certain events (like modifying the file content or metadata), and will skip default OS files (like `.DS_Store` on mac). + +When a change is detected, a scan will be scheduled for sometime in the future (default 5 minutes). If other events are triggered between now and the time at which the scan starts, more platforms will be added to the scan list (or the scan may switch to a full scan). This is done to reduce the number of tasks scheduled when many big changes happen to the library (mass upload, new mount, etc.) + +# Naming Convention + +## ๐ŸŽฎ Platform Support + +If you adhere to the [RomM folder structure](#๐Ÿ“-folder-structure), RomM supports any platform listed in the [IGDB platforms list](https://www.igdb.com/platforms). RomM will retrieve game information, metadata, and covers for platforms in that list. Additionally, some of these platforms have custom icons available ([learn more about platform icons in our wiki](https://github.com/zurdi15/romm/wiki/Custom-Platform-Icons)). + +## ๐Ÿ“‘ Tag Support + +Games can be tagged with region, revision, or other tags by using parentheses in the file name. + +\*Additionally, you can set the region by adding **"reg-"** as a prefix: (reg-E) / (reg-Spain) / (reg-USA) + +- Revision tags must be prefixed with **"rev "** or **"rev-"**: (rev v1) / (rev-v1) / (rev-whatever) +- Other tags will also be imported, for example: **my_game (E)(rev v1)(fav)(additional_tag).gba** + +**NOTE:** You can use these tags with the search bar to filter your library effectively. # ๐ŸŽ– Credits -* Pc and Mac icon support - Keyboard and mouse icons created by Flat Icons - Flaticon -* Default user icon - User Default icon by Icons8 +- Pc and Mac icon support - Keyboard and mouse icons created by Flat Icons - Flaticon +- Default user icon - User Default icon by Icons8 diff --git a/backend/config/__init__.py b/backend/config/__init__.py index b80a5c44b..f01dd7b0e 100644 --- a/backend/config/__init__.py +++ b/backend/config/__init__.py @@ -43,6 +43,7 @@ ENABLE_EXPERIMENTAL_REDIS: Final = ( ) REDIS_HOST: Final = os.environ.get("REDIS_HOST", "localhost") REDIS_PORT: Final = os.environ.get("REDIS_PORT", "6379") +REDIS_PASSWORD: Final = os.environ.get("REDIS_PASSWORD") # IGDB IGDB_CLIENT_ID: Final = os.environ.get( @@ -65,3 +66,29 @@ ROMM_AUTH_PASSWORD: Final = os.environ.get("ROMM_AUTH_PASSWORD", "admin") ROMM_AUTH_SECRET_KEY: Final = os.environ.get( "ROMM_AUTH_SECRET_KEY", secrets.token_hex(32) ) + +# TASKS +ENABLE_RESCAN_ON_FILESYSTEM_CHANGE: Final = ( + os.environ.get("ENABLE_RESCAN_ON_FILESYSTEM_CHANGE", "false") == "true" +) +RESCAN_ON_FILESYSTEM_CHANGE_DELAY: Final = int( + os.environ.get("RESCAN_ON_FILESYSTEM_CHANGE_DELAY", 5) # 5 minutes +) +ENABLE_SCHEDULED_RESCAN: Final = ( + os.environ.get("ENABLE_SCHEDULED_RESCAN", "false") == "true" +) +SCHEDULED_RESCAN_CRON: Final = os.environ.get( + "SCHEDULED_RESCAN_CRON", "0 3 * * *" # At 3:00 AM every day +) +ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB: Final = ( + os.environ.get("ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB", "false") == "true" +) +SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON: Final = os.environ.get( + "SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON", "0 4 * * *" # At 4:00 AM every day +) +ENABLE_SCHEDULED_UPDATE_MAME_XML: Final = ( + os.environ.get("ENABLE_SCHEDULED_UPDATE_MAME_XML", "false") == "true" +) +SCHEDULED_UPDATE_MAME_XML_CRON: Final = os.environ.get( + "SCHEDULED_UPDATE_MAME_XML_CRON", "0 4 * * *" # At 4:00 AM every day +) diff --git a/backend/endpoints/rom.py b/backend/endpoints/rom.py index 1a993872f..6b7f65164 100644 --- a/backend/endpoints/rom.py +++ b/backend/endpoints/rom.py @@ -48,6 +48,7 @@ class RomSchema(BaseModel): file_path: str file_size: float file_size_units: str + file_size_bytes: int r_name: str r_slug: str @@ -89,7 +90,7 @@ def upload_roms(request: Request, p_slug: str, roms: list[UploadFile] = File(... log.info(f"Uploading files to: {platform_fs_slug}") if roms is not None: roms_path = build_upload_roms_path(platform_fs_slug) - for rom in roms: #TODO: Refactor code to avoid double loop + for rom in roms: # TODO: Refactor code to avoid double loop if _rom_exists(p_slug, rom.filename): error = f"{rom.filename} already exists" log.error(error) @@ -99,10 +100,11 @@ def upload_roms(request: Request, p_slug: str, roms: list[UploadFile] = File(... for rom in roms: log.info(f" - Uploading {rom.filename}") file_location = f"{roms_path}/{rom.filename}" - f = open(file_location, 'wb+') + f = open(file_location, "wb+") while True: - chunk = rom.file.read(1024) - if not chunk: break + chunk = rom.file.read(1024) + if not chunk: + break f.write(chunk) f.close() dbh.update_n_roms(p_slug) @@ -141,6 +143,12 @@ def download_rom(request: Request, id: int, files: str): ) +@protected_route(router.get, "/roms/recent", ["roms.read"]) +def recentRoms(request: Request) -> list[RomSchema]: + """Returns the last 10 added roms""" + return dbh.get_recent_roms() + + @protected_route(router.get, "/platforms/{p_slug}/roms", ["roms.read"]) def roms( request: Request, @@ -203,7 +211,7 @@ async def update_rom( cleaned_data.update( fs.get_cover( - overwrite=not db_rom.has_cover, + overwrite=True, p_slug=db_platform.slug, r_name=cleaned_data["file_name_no_tags"], url_cover=cleaned_data.get("url_cover", ""), diff --git a/backend/endpoints/scan.py b/backend/endpoints/scan.py index 3c69b127e..480880e57 100644 --- a/backend/endpoints/scan.py +++ b/backend/endpoints/scan.py @@ -1,22 +1,21 @@ import emoji import socketio # type: ignore -from rq import Queue from logger.logger import log from utils import fs, fastapi from exceptions.fs_exceptions import PlatformsNotFoundException, RomsNotFoundException from handler import dbh from utils.socket import socket_server -from utils.cache import redis_client, redis_url +from utils.redis import high_prio_queue, redis_url from endpoints.platform import PlatformSchema from endpoints.rom import RomSchema from config import ENABLE_EXPERIMENTAL_REDIS -scan_queue = Queue(connection=redis_client) - async def scan_platforms( - platform_slugs: list[str], complete_rescan: bool, selected_roms: list[str] + platform_slugs: list[str], + complete_rescan: bool = False, + selected_roms: list[str] = (), ): # Connect to external socketio server sm = ( @@ -57,7 +56,7 @@ async def scan_platforms( if rom_id and rom_id not in selected_roms and not complete_rescan: continue - scanned_rom = fastapi.scan_rom(scanned_platform, fs_rom) + scanned_rom = await fastapi.scan_rom(scanned_platform, fs_rom) if rom_id: scanned_rom.id = rom_id @@ -90,7 +89,7 @@ async def scan_handler(_sid: str, options: dict): # Run in worker if redis is available if ENABLE_EXPERIMENTAL_REDIS: - return scan_queue.enqueue( + return high_prio_queue.enqueue( scan_platforms, platform_slugs, complete_rescan, diff --git a/backend/endpoints/tests/test_heartbeat.py b/backend/endpoints/tests/test_heartbeat.py index 3aba4ef3f..d095924a3 100644 --- a/backend/endpoints/tests/test_heartbeat.py +++ b/backend/endpoints/tests/test_heartbeat.py @@ -8,4 +8,14 @@ client = TestClient(app) def test_heartbeat(): response = client.get("/heartbeat") assert response.status_code == 200 - assert response.json() == {"ROMM_AUTH_ENABLED": True} + assert response.json() == { + 'ROMM_AUTH_ENABLED': True, + 'ENABLE_RESCAN_ON_FILESYSTEM_CHANGE': True, + 'ENABLE_SCHEDULED_RESCAN': True, + 'ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB': True, + 'ENABLE_SCHEDULED_UPDATE_MAME_XML': True, + 'RESCAN_ON_FILESYSTEM_CHANGE_DELAY': 5, + 'SCHEDULED_RESCAN_CRON': '0 3 * * *', + 'SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON': '0 4 * * *', + 'SCHEDULED_UPDATE_MAME_XML_CRON': '0 4 * * *', + } diff --git a/backend/handler/db_handler.py b/backend/handler/db_handler.py index d88dc0ac8..f14ffe2f3 100644 --- a/backend/handler/db_handler.py +++ b/backend/handler/db_handler.py @@ -77,6 +77,13 @@ class DBHandler: except ProgrammingError as e: self.raise_error(e) + def get_recent_roms(self): + try: + with self.session.begin() as session: + return session.scalars(select(Rom).order_by(Rom.id.desc()).limit(15)).all() + except ProgrammingError as e: + self.raise_error(e) + def get_rom(self, id): try: with self.session.begin() as session: diff --git a/backend/handler/ps2_opl_index.py b/backend/handler/fixtures/ps2_opl_index.json similarity index 99% rename from backend/handler/ps2_opl_index.py rename to backend/handler/fixtures/ps2_opl_index.json index db5172667..af330465c 100644 --- a/backend/handler/ps2_opl_index.py +++ b/backend/handler/fixtures/ps2_opl_index.json @@ -1,4 +1,4 @@ -opl_index = { +{ "SLES_556.71": { "Name": "Fifa '14", "Region": "PAL" diff --git a/backend/handler/igdb_handler.py b/backend/handler/igdb_handler.py index bbf0a4418..6981dc089 100644 --- a/backend/handler/igdb_handler.py +++ b/backend/handler/igdb_handler.py @@ -4,6 +4,9 @@ import pydash import requests import re import time +import os +import json +import xmltodict from unidecode import unidecode as uc from requests.exceptions import HTTPError, Timeout from typing import Final @@ -12,13 +15,27 @@ from config import IGDB_CLIENT_ID, IGDB_CLIENT_SECRET from utils import get_file_name_with_no_tags as get_search_term from logger.logger import log from utils.cache import cache -from .ps2_opl_index import opl_index +from tasks.update_switch_titledb import update_switch_titledb_task +from tasks.update_mame_xml import update_mame_xml_task MAIN_GAME_CATEGORY: Final = 0 EXPANDED_GAME_CATEGORY: Final = 10 N_SCREENSHOTS: Final = 5 PS2_IGDB_ID: Final = 8 +SWITCH_IGDB_ID: Final = 130 +ARCADE_IGDB_ID: Final = 52 + PS2_OPL_REGEX: Final = r"^([A-Z]{4}_\d{3}\.\d{2})\..*$" +PS2_OPL_INDEX_FILE: Final = os.path.join( + os.path.dirname(__file__), "fixtures", "ps2_opl_index.json" +) + +SWITCH_TITLEDB_REGEX: Final = r"^(70[0-9]{12})$" +SWITCH_TITLEDB_INDEX_FILE: Final = os.path.join( + os.path.dirname(__file__), "fixtures", "switch_titledb.json" +) + +MAME_XML_FILE: Final = os.path.join(os.path.dirname(__file__), "fixtures", "mame.xml") class IGDBHandler: @@ -141,16 +158,66 @@ class IGDBHandler: } @check_twitch_token - def get_rom(self, file_name: str, p_igdb_id: int): + async def get_rom(self, file_name: str, p_igdb_id: int): search_term = get_search_term(file_name) # Patch support for PS2 OPL flename format match = re.match(PS2_OPL_REGEX, search_term) if p_igdb_id == PS2_IGDB_ID and match: serial_code = match.group(1) - index_entry = opl_index.get(serial_code, None) - if index_entry: - search_term = index_entry["Name"] # type: ignore + + with open(PS2_OPL_INDEX_FILE, "r") as index_json: + opl_index = json.loads(index_json.read()) + index_entry = opl_index.get(serial_code, None) + if index_entry: + search_term = index_entry["Name"] # type: ignore + + # Patch support for switch titleID filename format + match = re.match(SWITCH_TITLEDB_REGEX, search_term) + if p_igdb_id == SWITCH_IGDB_ID and match: + title_id = match.group(1) + titledb_index = {} + + try: + with open(SWITCH_TITLEDB_INDEX_FILE, "r") as index_json: + titledb_index = json.loads(index_json.read()) + except FileNotFoundError: + log.warning("Fetching the Switch titleDB index file...") + await update_switch_titledb_task.run(force=True) + + try: + with open(SWITCH_TITLEDB_INDEX_FILE, "r") as index_json: + titledb_index = json.loads(index_json.read()) + except FileNotFoundError: + log.error("Could not fetch the Switch titleDB index file") + finally: + index_entry = titledb_index.get(title_id, None) + if index_entry: + search_term = index_entry["name"] # type: ignore + + if p_igdb_id == ARCADE_IGDB_ID: + mame_index = { "menu": { "game": [] } } + + try: + with open(MAME_XML_FILE, "r") as index_xml: + mame_index = xmltodict.parse(index_xml.read()) + except FileNotFoundError: + log.warning("Fetching the MAME XML file from HyperspinFE...") + await update_mame_xml_task.run(force=True) + + try: + with open(MAME_XML_FILE, "r") as index_xml: + mame_index = xmltodict.parse(index_xml.read()) + except FileNotFoundError: + log.error("Could not fetch the MAME XML file from HyperspinFE") + finally: + index_entry = [ + game + for game in mame_index["menu"]["game"] + if game["@name"] == search_term + ] + if index_entry: + search_term = index_entry[0].get("description", search_term) res = ( self._search_rom(uc(search_term), p_igdb_id, MAIN_GAME_CATEGORY) diff --git a/backend/handler/tests/cassettes/test_switch_titleid_rom.yaml b/backend/handler/tests/cassettes/test_switch_titleid_rom.yaml new file mode 100644 index 000000000..13a5b3849 --- /dev/null +++ b/backend/handler/tests/cassettes/test_switch_titleid_rom.yaml @@ -0,0 +1,821 @@ +interactions: +- request: + body: "\n search \"70000000000000\";\n fields id, + slug, name, summary, screenshots;\n where platforms=[130] ;\n + \ " + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer test_token + Client-ID: + - dxhlue92dw8wz4kdtdx710g88366rb + Connection: + - keep-alive + Content-Length: + - '155' + User-Agent: + - python-requests/2.31.0 + method: POST + uri: https://api.igdb.com/v4/games/ + response: + body: + string: "{\n \"message\": \"Authorization Failure. Have you tried:\",\n \"Tip + 1\": \"Ensure you are sending Authorization and Client-ID as headers.\",\n + \ \"Tip 2\": \"Ensure Authorization value starts with 'Bearer ', including + the space\",\n \"Tip 3\": \"Ensure Authorization value ends with the App + Access Token you generated, NOT your Client Secret.\",\n \"Docs\": \"https://api-docs.igdb.com/#authentication\",\n + \ \"Discord\": \"https://discord.gg/FrvfwQg\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8011eb20ee5d53fb-YYZ + Connection: + - keep-alive + Content-Length: + - '437' + Content-Type: + - application/json + Date: + - Sun, 03 Sep 2023 23:54:32 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=rcqImVV1aXFkeF1zuEHsbDFjjGHReU8.sjGEEBvL35Q-1693785272-0-ASCi3Y77ivK7JQVEd6NmsJnEpxeubVqKLmHsjUHzOY85Ix4U7726Vwb8FKpC/hqRGWO8I9pKA2btEDWnIg4mm0o=; + path=/; expires=Mon, 04-Sep-23 00:24:32 GMT; domain=.igdb.com; HttpOnly; Secure; + SameSite=None + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Via: + - 1.1 490c6f54e6cd81b80f07ff6be833267e.cloudfront.net (CloudFront) + X-Amz-Cf-Id: + - 3Rm7flPHd4BwBsl6bX2XlcDzTwpTNCPTrRf-yVia4VuoH__oqr2ZeA== + X-Amz-Cf-Pop: + - YTO50-P1 + X-Cache: + - Error from cloudfront + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + x-amz-apigw-id: + - KtFs4GinvHcFRDQ= + x-amzn-ErrorType: + - AccessDeniedException + x-amzn-RequestId: + - 71c25a45-7ae5-4520-858b-4ddc0317d9d6 + status: + code: 401 + message: Unauthorized +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - python-requests/2.31.0 + method: POST + uri: https://id.twitch.tv/oauth2/token?client_id=dxhlue92dw8wz4kdtdx710g88366rb&client_secret=ko5cy0bygkkd76m8od2ko5ts2hhbza&grant_type=client_credentials + response: + body: + string: '{"access_token":"ntsg56bepujq2u93g4fn7mtfqqf6ir","expires_in":5304074,"token_type":"bearer"} + + ' + headers: + Access-Control-Allow-Origin: + - '*' + Connection: + - keep-alive + Content-Length: + - '93' + Content-Type: + - application/json + Date: + - Sun, 03 Sep 2023 23:54:33 GMT + Server: + - nginx + X-Ctxlog-Logid: + - 1-64f51cb8-1b8abffc323d93c567cfd96d + status: + code: 200 + message: OK +- request: + body: "\n search \"70000000000000\";\n fields id, + slug, name, summary, screenshots;\n where platforms=[130] ;\n + \ " + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer ntsg56bepujq2u93g4fn7mtfqqf6ir + Client-ID: + - dxhlue92dw8wz4kdtdx710g88366rb + Connection: + - keep-alive + Content-Length: + - '155' + User-Agent: + - python-requests/2.31.0 + method: POST + uri: https://api.igdb.com/v4/games/ + response: + body: + string: '[]' + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8011eb255fb639cf-YYZ + Connection: + - keep-alive + Content-Length: + - '2' + Content-Type: + - application/json + Date: + - Sun, 03 Sep 2023 23:54:33 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=FhFwhPdt0bH0rJy5S9J_K0O40kfc0xUH.w0ev0uCJpg-1693785273-0-ASLtRTzm0dXLJM9ikj+ur78Xs3a8DkSgLWGPD5s1vbcp139xlySoGZGNPVIRwvpgH+R/94fjBQcByjpKqDfxYko=; + path=/; expires=Mon, 04-Sep-23 00:24:33 GMT; domain=.igdb.com; HttpOnly; Secure; + SameSite=None + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Via: + - 1.1 4076c9a26c97a2e765053f508fa5d748.cloudfront.net (CloudFront) + X-Amz-Cf-Id: + - YMfDTNy5NAQmQjVUWx2qhsNFh5a7FLIjgaIfLmUyse80jYqIzLlVhw== + X-Amz-Cf-Pop: + - YTO50-P1 + X-Cache: + - Miss from cloudfront + X-Content-Type-Options: + - nosniff + X-Count: + - '0' + alt-svc: + - h3=":443"; ma=86400 + x-amz-apigw-id: + - KtFtAHR3vHcF4lg= + x-amzn-Remapped-Content-Length: + - '2' + x-amzn-Remapped-Date: + - Sun, 03 Sep 2023 23:54:33 GMT + x-amzn-RequestId: + - f52b24e7-fb36-4b12-9fea-7b3cb669d6af + status: + code: 200 + message: OK +- request: + body: "\n search \"70000000000000\";\n fields id, + slug, name, summary, screenshots;\n where platforms=[130] & category=10;\n + \ " + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer ntsg56bepujq2u93g4fn7mtfqqf6ir + Client-ID: + - dxhlue92dw8wz4kdtdx710g88366rb + Connection: + - keep-alive + Content-Length: + - '168' + User-Agent: + - python-requests/2.31.0 + method: POST + uri: https://api.igdb.com/v4/games/ + response: + body: + string: '[]' + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8011eb280aff3739-YYZ + Connection: + - keep-alive + Content-Length: + - '2' + Content-Type: + - application/json + Date: + - Sun, 03 Sep 2023 23:54:33 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=iUNglWLvhwhT8qjl210blH43.Sm4Bndhxuixs3H0jvg-1693785273-0-AXshPb476uhsEwxYMXU9+GqH9XVvo+gizrEOlM/+YC3S8GS+OrUg61zFDLjffdSAcSZ/NchuwsURKBFZK5F4Gwc=; + path=/; expires=Mon, 04-Sep-23 00:24:33 GMT; domain=.igdb.com; HttpOnly; Secure; + SameSite=None + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Via: + - 1.1 b17b94cbc6db5cb82e8f8d6e55e1e85a.cloudfront.net (CloudFront) + X-Amz-Cf-Id: + - W3tVhAXtiek0KfDaRqDIaAln6kDRVGFho_bEMIrwvoFRu7ByWk6LcQ== + X-Amz-Cf-Pop: + - YTO50-P1 + X-Cache: + - Miss from cloudfront + X-Content-Type-Options: + - nosniff + X-Count: + - '0' + alt-svc: + - h3=":443"; ma=86400 + x-amz-apigw-id: + - KtFtEFbrvHcFUnw= + x-amzn-Remapped-Content-Length: + - '2' + x-amzn-Remapped-Date: + - Sun, 03 Sep 2023 23:54:33 GMT + x-amzn-RequestId: + - ab504f27-4360-4bf0-8063-85484d539c72 + status: + code: 200 + message: OK +- request: + body: "\n search \"70000000000000\";\n fields id, + slug, name, summary, screenshots;\n where platforms=[130] ;\n + \ " + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer ntsg56bepujq2u93g4fn7mtfqqf6ir + Client-ID: + - dxhlue92dw8wz4kdtdx710g88366rb + Connection: + - keep-alive + Content-Length: + - '155' + User-Agent: + - python-requests/2.31.0 + method: POST + uri: https://api.igdb.com/v4/games/ + response: + body: + string: '[]' + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8011eb2a99f536c4-YYZ + Connection: + - keep-alive + Content-Length: + - '2' + Content-Type: + - application/json + Date: + - Sun, 03 Sep 2023 23:54:34 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=6zEHQVhPcapEW5s4CmjoIpb6gwYJ1R.1.12SaCfXExA-1693785274-0-AXJ90Wdhnxu3RjeW4iT+FdnF8K/BXmrCFuPTA/UVv1CXuKI3NVuVNZNgIiUPsH0fRf1B3qup929B6UznZwnZ1PY=; + path=/; expires=Mon, 04-Sep-23 00:24:34 GMT; domain=.igdb.com; HttpOnly; Secure; + SameSite=None + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Via: + - 1.1 a44cf9ed8a499212c53e0b8f57aa31f4.cloudfront.net (CloudFront) + X-Amz-Cf-Id: + - zlvrzizpKd92GDmCu760fd7bV_EPqSHic7gX31EL_QBvqsAFasKl6g== + X-Amz-Cf-Pop: + - YTO50-P1 + X-Cache: + - Miss from cloudfront + X-Content-Type-Options: + - nosniff + X-Count: + - '0' + alt-svc: + - h3=":443"; ma=86400 + x-amz-apigw-id: + - KtFtHEC-PHcFc_A= + x-amzn-Remapped-Content-Length: + - '2' + x-amzn-Remapped-Date: + - Sun, 03 Sep 2023 23:54:34 GMT + x-amzn-RequestId: + - eab5d6d9-45a9-4893-89bb-575ec3bcc878 + status: + code: 200 + message: OK +- request: + body: fields url; where game=0; + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer ntsg56bepujq2u93g4fn7mtfqqf6ir + Client-ID: + - dxhlue92dw8wz4kdtdx710g88366rb + Connection: + - keep-alive + Content-Length: + - '25' + User-Agent: + - python-requests/2.31.0 + method: POST + uri: https://api.igdb.com/v4/covers/ + response: + body: + string: '[]' + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8011eb2c0b3b39c9-YYZ + Connection: + - keep-alive + Content-Length: + - '2' + Content-Type: + - application/json + Date: + - Sun, 03 Sep 2023 23:54:34 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=iFc6Wab27uPyNsoVy4ygSD87iMO.oCdE5DILXoushps-1693785274-0-AYcmnSabMtbe+aM4bmnORs8cHGKXsZs7EtU2EsKOcNC9aGr+craK8N+7H1QkowRccw639134wJDP8dFqJ//NQ0A=; + path=/; expires=Mon, 04-Sep-23 00:24:34 GMT; domain=.igdb.com; HttpOnly; Secure; + SameSite=None + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Via: + - 1.1 3758a948ce5cf1a44c10afecd9aed040.cloudfront.net (CloudFront) + X-Amz-Cf-Id: + - KGeEKySgOep4Mmq2eER2m-lZ3ucxV1k-dFZFSMTD4sMamO5qMYqXbA== + X-Amz-Cf-Pop: + - YTO50-P1 + X-Cache: + - Miss from cloudfront + X-Content-Type-Options: + - nosniff + X-Count: + - '0' + alt-svc: + - h3=":443"; ma=86400 + x-amz-apigw-id: + - KtFtKHdbvHcFRRg= + x-amzn-Remapped-Content-Length: + - '2' + x-amzn-Remapped-Date: + - Sun, 03 Sep 2023 23:54:34 GMT + x-amzn-RequestId: + - d4b16177-21f1-4e09-a814-f2791f55ffa5 + status: + code: 200 + message: OK +- request: + body: fields url; where game=0; limit 5; + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer ntsg56bepujq2u93g4fn7mtfqqf6ir + Client-ID: + - dxhlue92dw8wz4kdtdx710g88366rb + Connection: + - keep-alive + Content-Length: + - '34' + User-Agent: + - python-requests/2.31.0 + method: POST + uri: https://api.igdb.com/v4/screenshots/ + response: + body: + string: '[]' + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8011eb2e6ec636c4-YYZ + Connection: + - keep-alive + Content-Length: + - '2' + Content-Type: + - application/json + Date: + - Sun, 03 Sep 2023 23:54:34 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=uZcMv.CrKwFvv2CX9tDgvEQt3lF.Ei2zPQ0MTfEMRUA-1693785274-0-AYxFFcbtBwbEnMvWJEbV/JrODpskMJRYj5bJ4dsHpi1OGPjp3NszSDF10Q05LwJGSFu5QVT2OvdaaqH6hd4GBwo=; + path=/; expires=Mon, 04-Sep-23 00:24:34 GMT; domain=.igdb.com; HttpOnly; Secure; + SameSite=None + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Via: + - 1.1 a44cf9ed8a499212c53e0b8f57aa31f4.cloudfront.net (CloudFront) + X-Amz-Cf-Id: + - eyBDuYLMtrit0J4lVGb_51kmv0tQmQPErZyZ0M4AIv1zLvLvgy-_fg== + X-Amz-Cf-Pop: + - YTO50-P1 + X-Cache: + - Miss from cloudfront + X-Content-Type-Options: + - nosniff + X-Count: + - '0' + alt-svc: + - h3=":443"; ma=86400 + x-amz-apigw-id: + - KtFtOEr8PHcF7dw= + x-amzn-Remapped-Content-Length: + - '2' + x-amzn-Remapped-Date: + - Sun, 03 Sep 2023 23:54:34 GMT + x-amzn-RequestId: + - a6552c23-c4d2-443b-8d8a-90b94990466b + status: + code: 200 + message: OK +- request: + body: "\n search \"Blaster Master Zero\";\n fields + id, slug, name, summary, screenshots;\n where platforms=[130] + ;\n " + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer test_token + Client-ID: + - dxhlue92dw8wz4kdtdx710g88366rb + Connection: + - keep-alive + Content-Length: + - '160' + User-Agent: + - python-requests/2.31.0 + method: POST + uri: https://api.igdb.com/v4/games/ + response: + body: + string: "{\n \"message\": \"Authorization Failure. Have you tried:\",\n \"Tip + 1\": \"Ensure you are sending Authorization and Client-ID as headers.\",\n + \ \"Tip 2\": \"Ensure Authorization value starts with 'Bearer ', including + the space\",\n \"Tip 3\": \"Ensure Authorization value ends with the App + Access Token you generated, NOT your Client Secret.\",\n \"Docs\": \"https://api-docs.igdb.com/#authentication\",\n + \ \"Discord\": \"https://discord.gg/FrvfwQg\"\n}\n" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8011eb325cdfa24d-YYZ + Connection: + - keep-alive + Content-Length: + - '437' + Content-Type: + - application/json + Date: + - Sun, 03 Sep 2023 23:54:35 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=Rv_sl_0gcFKY.IkY7XMVs_UOP7QWIB8nlzG7M1Mwl_M-1693785275-0-AfR5zmHzAjkwMc3WpQG6/zHyk9gj80QjmUn1dZEC6B5UHIesGeaqYKdiBxlYhLFj4TJ3YxQ6KGcPS8kCD4hRyow=; + path=/; expires=Mon, 04-Sep-23 00:24:35 GMT; domain=.igdb.com; HttpOnly; Secure; + SameSite=None + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Via: + - 1.1 490c6f54e6cd81b80f07ff6be833267e.cloudfront.net (CloudFront) + X-Amz-Cf-Id: + - W7dIKX7Qqb_dKJKMdaSI3-av5hE-AMBWfa1fql5dxvj_dOY9hjM_uw== + X-Amz-Cf-Pop: + - YTO50-P1 + X-Cache: + - Error from cloudfront + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + x-amz-apigw-id: + - KtFtTHYgvHcF2qg= + x-amzn-ErrorType: + - AccessDeniedException + x-amzn-RequestId: + - 6862f001-c92f-44ef-b7c4-64e797bbb68a + status: + code: 401 + message: Unauthorized +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - python-requests/2.31.0 + method: POST + uri: https://id.twitch.tv/oauth2/token?client_id=dxhlue92dw8wz4kdtdx710g88366rb&client_secret=ko5cy0bygkkd76m8od2ko5ts2hhbza&grant_type=client_credentials + response: + body: + string: '{"access_token":"v2xs6sqx28xjzrpbpzuc6v490g2ko4","expires_in":5443433,"token_type":"bearer"} + + ' + headers: + Access-Control-Allow-Origin: + - '*' + Connection: + - keep-alive + Content-Length: + - '93' + Content-Type: + - application/json + Date: + - Sun, 03 Sep 2023 23:54:35 GMT + Server: + - nginx + X-Ctxlog-Logid: + - 1-64f51cbb-203933bf07df26dc2f955c56 + status: + code: 200 + message: OK +- request: + body: "\n search \"Blaster Master Zero\";\n fields + id, slug, name, summary, screenshots;\n where platforms=[130] + ;\n " + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer v2xs6sqx28xjzrpbpzuc6v490g2ko4 + Client-ID: + - dxhlue92dw8wz4kdtdx710g88366rb + Connection: + - keep-alive + Content-Length: + - '160' + User-Agent: + - python-requests/2.31.0 + method: POST + uri: https://api.igdb.com/v4/games/ + response: + body: + string: "[\n {\n \"id\": 145058,\n \"name\": \"Blaster Master Zero III\",\n + \ \"screenshots\": [\n 486697,\n 486698,\n 486699,\n 486700,\n + \ 486701\n ],\n \"slug\": \"blaster-master-zero-iii\",\n \"summary\": + \"The Pinnacle of Mutant Blasting Action \u2014 Blaster Master Zero\\u0027s + hybrid side-scrolling and top-down action is back for its 3rd chapter! Series + protagonist Jason travels to where the series all began, the planet Sophia, + in order to save the heroine Eve in this final installment of the trilogy.\"\n + \ },\n {\n \"id\": 171205,\n \"name\": \"Blaster Master Zero: EX Character + - Shantae\",\n \"screenshots\": [\n 633769,\n 633771,\n 633774,\n + \ 633777,\n 633780,\n 633782\n ],\n \"slug\": \"blaster-master-zero-ex-character-shantae\",\n + \ \"summary\": \"This unlocks the EX Character \\\"Shantae.\\\"\"\n },\n + \ {\n \"id\": 171206,\n \"name\": \"Blaster Master Zero: EX Character + - Shovel Knight\",\n \"screenshots\": [\n 633773,\n 633776,\n + \ 633779,\n 633783,\n 633786,\n 633788\n ],\n \"slug\": + \"blaster-master-zero-ex-character-shovel-knight\",\n \"summary\": \"This + unlocks the EX Character \\\"Shovel Knight.\\\"\"\n },\n {\n \"id\": + 27438,\n \"name\": \"Blaster Master Zero\",\n \"screenshots\": [\n 37817,\n + \ 153241,\n 153242,\n 153243,\n 153244,\n 153245,\n + \ 153246,\n 153247,\n 153248,\n 153249,\n 153250,\n + \ 153251\n ],\n \"slug\": \"blaster-master-zero\",\n \"summary\": + \"A loose reboot of the original Blaster Master by Inti Creates, utilizing + elements from the original game, the \\\"Worlds of Power\\\" novelization, + and the original Japanese version.\"\n },\n {\n \"id\": 116416,\n \"name\": + \"Blaster Master Zero 2\",\n \"screenshots\": [\n 293024,\n 293025,\n + \ 293026,\n 293027,\n 293028,\n 293029\n ],\n \"slug\": + \"blaster-master-zero-2\",\n \"summary\": \"The side-scrolling/top-down + hybrid action adventure gameplay returns with a brand new sequel to Blaster + Master Zero!\"\n },\n {\n \"id\": 238159,\n \"name\": \"Blaster Master + Zero: Ex Character - Ekoro\",\n \"slug\": \"blaster-master-zero-ex-character-ekoro\"\n + \ },\n {\n \"id\": 238160,\n \"name\": \"Blaster Master Zero: Ex Character + - Gunvolt\",\n \"slug\": \"blaster-master-zero-ex-character-gunvolt\"\n + \ },\n {\n \"id\": 145059,\n \"name\": \"Blaster Master Zero Trilogy: + MetaFight Chronicle\",\n \"screenshots\": [\n 551670,\n 551671,\n + \ 551672,\n 551673,\n 551674,\n 551675,\n 551676,\n + \ 551677,\n 551678\n ],\n \"slug\": \"blaster-master-zero-trilogy-metafight-chronicle\",\n + \ \"summary\": \"The epic anthology of mutant blasting action!\\n\\nIt\\u0027s + been 33 years since the release of the original Blaster Master, and now, a + new legend is born!\"\n }\n]" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8011eb366d005413-YYZ + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Length: + - '881' + Content-Type: + - application/json + Date: + - Sun, 03 Sep 2023 23:54:36 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=XwYlgNMvptZ2Ilaryuj6GlM8FQm7fqLsJyKJXPT1v0U-1693785276-0-ARi2BIbcWnQ5XcwHTj9Z2Tyiz70aTb+wSKz+hqImgkBk4nXTV2yEbLNjASIyplLoZd9T5db8NsM3OWLjqQ9jCds=; + path=/; expires=Mon, 04-Sep-23 00:24:36 GMT; domain=.igdb.com; HttpOnly; Secure; + SameSite=None + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Via: + - 1.1 614ee5305862f7e9bae65335466e5512.cloudfront.net (CloudFront) + X-Amz-Cf-Id: + - nAxSatkb9qVnN6MCIcu-KWHOf-zu48nUGnENfOroyOpCz_MxxSeIIA== + X-Amz-Cf-Pop: + - YTO50-P1 + X-Cache: + - Miss from cloudfront + X-Content-Type-Options: + - nosniff + X-Count: + - '8' + alt-svc: + - h3=":443"; ma=86400 + x-amz-apigw-id: + - KtFtbHiiPHcFazw= + x-amzn-Remapped-Content-Length: + - '881' + x-amzn-Remapped-Date: + - Sun, 03 Sep 2023 23:54:36 GMT + x-amzn-RequestId: + - 8b24bf02-a3b0-4ec9-843c-139d5cab4c68 + status: + code: 200 + message: OK +- request: + body: fields url; where game=145058; + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer v2xs6sqx28xjzrpbpzuc6v490g2ko4 + Client-ID: + - dxhlue92dw8wz4kdtdx710g88366rb + Connection: + - keep-alive + Content-Length: + - '30' + User-Agent: + - python-requests/2.31.0 + method: POST + uri: https://api.igdb.com/v4/covers/ + response: + body: + string: "[\n {\n \"id\": 135539,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co2wkz.jpg\"\n + \ }\n]" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8011eb38ac8c36c4-YYZ + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sun, 03 Sep 2023 23:54:36 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=vhk0wlW98f5dq8LfCeGzl8IKyuJ2YclIIJeaBP0rk8A-1693785276-0-Afip4GG6hh6ZViqPjPt9I0g6LzGjUXmZRgQZz/krR/e8zrG3WCZn6fXNydbQn6HtTehWYu0jOsDwXVAyHAWhH3k=; + path=/; expires=Mon, 04-Sep-23 00:24:36 GMT; domain=.igdb.com; HttpOnly; Secure; + SameSite=None + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + Via: + - 1.1 54f8dfc32403dc4b8a1c2d5ea7335730.cloudfront.net (CloudFront) + X-Amz-Cf-Id: + - erMR6FQtpbddMncO98k-gvncFLyD6ZzoNop5J-EO7HebEs9s1FvquQ== + X-Amz-Cf-Pop: + - YTO50-P1 + X-Cache: + - Miss from cloudfront + X-Content-Type-Options: + - nosniff + X-Count: + - '1' + alt-svc: + - h3=":443"; ma=86400 + x-amz-apigw-id: + - KtFteGQgPHcFoaQ= + x-amzn-Remapped-Content-Length: + - '97' + x-amzn-Remapped-Date: + - Sun, 03 Sep 2023 23:54:36 GMT + x-amzn-RequestId: + - 037b6555-cfc3-489e-b61e-7bb1598c3514 + status: + code: 200 + message: OK +- request: + body: fields url; where game=145058; limit 5; + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer v2xs6sqx28xjzrpbpzuc6v490g2ko4 + Client-ID: + - dxhlue92dw8wz4kdtdx710g88366rb + Connection: + - keep-alive + Content-Length: + - '39' + User-Agent: + - python-requests/2.31.0 + method: POST + uri: https://api.igdb.com/v4/screenshots/ + response: + body: + string: "[\n {\n \"id\": 486698,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/scafje.jpg\"\n + \ },\n {\n \"id\": 486697,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/scafjd.jpg\"\n + \ },\n {\n \"id\": 486699,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/scafjf.jpg\"\n + \ },\n {\n \"id\": 486700,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/scafjg.jpg\"\n + \ },\n {\n \"id\": 486701,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/scafjh.jpg\"\n + \ }\n]" + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8011eb3a4dc5542b-YYZ + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Sun, 03 Sep 2023 23:54:36 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=WsUoJYddNZO7J.j1UqFnrIR1Zzc4JfkDGVxBYicH7IY-1693785276-0-AQ0jeyNCuJbpYeCFaSNHhG5cVFgwEfw0ERNNpBiTBTfNPAUr4U/aFUsMWTWa4RwPSCOAv7pIJlGzBCst9DIVjHs=; + path=/; expires=Mon, 04-Sep-23 00:24:36 GMT; domain=.igdb.com; HttpOnly; Secure; + SameSite=None + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + Via: + - 1.1 614ee5305862f7e9bae65335466e5512.cloudfront.net (CloudFront) + X-Amz-Cf-Id: + - wqBEcDt10hGAJR_4m8v4TkA2yu5oJYdhIek8Ob8JGoEx6dihqDAbsA== + X-Amz-Cf-Pop: + - YTO50-P1 + X-Cache: + - Miss from cloudfront + X-Content-Type-Options: + - nosniff + X-Count: + - '5' + alt-svc: + - h3=":443"; ma=86400 + x-amz-apigw-id: + - KtFthEwJvHcFXug= + x-amzn-Remapped-Content-Length: + - '477' + x-amzn-Remapped-Date: + - Sun, 03 Sep 2023 23:54:36 GMT + x-amzn-RequestId: + - 1a1b3462-8ece-468a-8c92-5a6e46b9731f + status: + code: 200 + message: OK +version: 1 diff --git a/backend/handler/tests/test_igdb_handler.py b/backend/handler/tests/test_igdb_handler.py index b8ef6f0b8..b3608d16c 100644 --- a/backend/handler/tests/test_igdb_handler.py +++ b/backend/handler/tests/test_igdb_handler.py @@ -18,8 +18,8 @@ def test_get_platform(): @pytest.mark.vcr() -def test_get_rom(): - rom = igdbh.get_rom("Paper Mario (USA).n64", 4) +async def test_get_rom(): + rom = await igdbh.get_rom("Paper Mario (USA).n64", 4) assert rom["r_igdb_id"] == 3340 assert rom["r_slug"] == "paper-mario" assert rom["r_name"] == "Paper Mario" @@ -27,7 +27,7 @@ def test_get_rom(): assert urlparse(rom["url_cover"]).hostname == "images.igdb.com" assert urlparse(rom["url_screenshots"][0]).hostname == "images.igdb.com" - rom = igdbh.get_rom("Not a real game title", 4) + rom = await igdbh.get_rom("Not a real game title", 4) assert rom["r_igdb_id"] == "" assert rom["r_slug"] == "" assert rom["r_name"] == "Not a real game title" @@ -37,8 +37,8 @@ def test_get_rom(): @pytest.mark.vcr() -def test_get_ps2_opl_rom(): - rom = igdbh.get_rom("WWE Smack.iso", 8) +async def test_get_ps2_opl_rom(): + rom = await igdbh.get_rom("WWE Smack.iso", 8) assert rom["r_igdb_id"] == "" assert rom["r_slug"] == "" assert rom["r_name"] == "WWE Smack" @@ -46,7 +46,7 @@ def test_get_ps2_opl_rom(): assert rom["url_cover"] == "" assert not rom["url_screenshots"] - rom = igdbh.get_rom("SLUS_210.60.WWE Smack.iso", 8) + rom = await igdbh.get_rom("SLUS_210.60.WWE Smack.iso", 8) assert rom["r_igdb_id"] == 80852 assert rom["r_slug"] == "wwe-smackdown-vs-raw" assert rom["r_name"] == "WWE Smackdown! vs. Raw" diff --git a/backend/logger/logger.py b/backend/logger/logger.py index e8ea853ed..80a5e851e 100644 --- a/backend/logger/logger.py +++ b/backend/logger/logger.py @@ -4,8 +4,8 @@ from datetime import datetime from pathlib import Path from config import LOGS_BASE_PATH -from logger.stdout_formatter import StdoutFormatter -from logger.file_formatter import FileFormatter +from .stdout_formatter import StdoutFormatter +from .file_formatter import FileFormatter # Create logs folder if not exists Path(LOGS_BASE_PATH).mkdir(parents=True, exist_ok=True) diff --git a/backend/main.py b/backend/main.py index 7cf95527c..d8d6551a7 100644 --- a/backend/main.py +++ b/backend/main.py @@ -8,7 +8,20 @@ from fastapi_pagination import add_pagination from starlette.middleware.authentication import AuthenticationMiddleware from starlette.middleware.sessions import SessionMiddleware -from config import DEV_PORT, DEV_HOST, ROMM_AUTH_SECRET_KEY, ROMM_AUTH_ENABLED +from config import ( + DEV_PORT, + DEV_HOST, + ROMM_AUTH_SECRET_KEY, + ROMM_AUTH_ENABLED, + ENABLE_RESCAN_ON_FILESYSTEM_CHANGE, + RESCAN_ON_FILESYSTEM_CHANGE_DELAY, + ENABLE_SCHEDULED_RESCAN, + SCHEDULED_RESCAN_CRON, + ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB, + SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON, + ENABLE_SCHEDULED_UPDATE_MAME_XML, + SCHEDULED_UPDATE_MAME_XML_CRON, +) from endpoints import search, platform, rom, identity, oauth, scan # noqa from handler import dbh from utils.socket import socket_app @@ -63,7 +76,17 @@ app.mount("/ws", socket_app) # Endpoint to set the CSRF token in cache @app.get("/heartbeat") def heartbeat(): - return {"ROMM_AUTH_ENABLED": ROMM_AUTH_ENABLED} + return { + "ROMM_AUTH_ENABLED": ROMM_AUTH_ENABLED, + "ENABLE_RESCAN_ON_FILESYSTEM_CHANGE": ENABLE_RESCAN_ON_FILESYSTEM_CHANGE, + "RESCAN_ON_FILESYSTEM_CHANGE_DELAY": RESCAN_ON_FILESYSTEM_CHANGE_DELAY, + "ENABLE_SCHEDULED_RESCAN": ENABLE_SCHEDULED_RESCAN, + "SCHEDULED_RESCAN_CRON": SCHEDULED_RESCAN_CRON, + "ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB": ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB, # noqa + "SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON": SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON, + "ENABLE_SCHEDULED_UPDATE_MAME_XML": ENABLE_SCHEDULED_UPDATE_MAME_XML, + "SCHEDULED_UPDATE_MAME_XML_CRON": SCHEDULED_UPDATE_MAME_XML_CRON, + } @app.on_event("startup") diff --git a/backend/models/rom.py b/backend/models/rom.py index b39d4d571..313d74ae0 100644 --- a/backend/models/rom.py +++ b/backend/models/rom.py @@ -3,6 +3,15 @@ from sqlalchemy import Integer, Column, String, Text, Boolean, Float, JSON from config import DEFAULT_PATH_COVER_S, DEFAULT_PATH_COVER_L, FRONT_LIBRARY_PATH from .base import BaseModel +SIZE_UNIT_TO_BYTES = { + "B": 1, + "KB": 1024, + "MB": 1024^2, + "GB": 1024^3, + "TB": 1024^4, + "PB": 1024^5, +} + class Rom(BaseModel): __tablename__ = "roms" id = Column(Integer(), primary_key=True, autoincrement=True) @@ -49,6 +58,10 @@ class Rom(BaseModel): @property def download_path(self) -> str: return f"{FRONT_LIBRARY_PATH}/{self.full_path}" + + @property + def file_size_bytes(self) -> int: + return int(self.file_size * SIZE_UNIT_TO_BYTES[self.file_size_units or 'B']) def __repr__(self) -> str: return self.file_name diff --git a/backend/scheduler.py b/backend/scheduler.py new file mode 100644 index 000000000..f36132a91 --- /dev/null +++ b/backend/scheduler.py @@ -0,0 +1,22 @@ +import sys + +from config import ENABLE_EXPERIMENTAL_REDIS +from tasks.utils import tasks_scheduler +from logger.logger import log +from tasks.scan_library import scan_library_task +from tasks.update_switch_titledb import update_switch_titledb_task +from tasks.update_mame_xml import update_mame_xml_task + +if __name__ == "__main__": + if not ENABLE_EXPERIMENTAL_REDIS: + sys.exit(0) + + # Initialize the tasks + scan_library_task.init() + update_switch_titledb_task.init() + update_mame_xml_task.init() + + log.info("Starting scheduler") + + # Start the scheduler + tasks_scheduler.run() diff --git a/backend/tasks/__init__.py b/backend/tasks/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/backend/tasks/exceptions.py b/backend/tasks/exceptions.py new file mode 100644 index 000000000..c5f3da58b --- /dev/null +++ b/backend/tasks/exceptions.py @@ -0,0 +1,7 @@ +class SchedulerException(Exception): + def __init__(self, message: str): + self.message = message + super().__init__(self.message) + + def __repr__(self): + return self.message diff --git a/backend/tasks/scan_library.py b/backend/tasks/scan_library.py new file mode 100644 index 000000000..9a43ef063 --- /dev/null +++ b/backend/tasks/scan_library.py @@ -0,0 +1,30 @@ +from logger.logger import log +from config import ( + ENABLE_SCHEDULED_RESCAN, + SCHEDULED_RESCAN_CRON, +) +from endpoints.scan import scan_platforms +from .utils import PeriodicTask + + +class ScanLibraryTask(PeriodicTask): + def __init__(self): + super().__init__( + func="tasks.scan_library.scan_library_task.run", + description="library scan", + enabled=ENABLE_SCHEDULED_RESCAN, + cron_string=SCHEDULED_RESCAN_CRON, + ) + + async def run(self): + if not ENABLE_SCHEDULED_RESCAN: + log.info("Scheduled library scan not enabled, unscheduling...") + self.unschedule() + return + + log.info("Scheduled library scan started...") + scan_platforms([]) + log.info("Scheduled library scan done") + + +scan_library_task = ScanLibraryTask() diff --git a/backend/tasks/update_mame_xml.py b/backend/tasks/update_mame_xml.py new file mode 100644 index 000000000..23aa78910 --- /dev/null +++ b/backend/tasks/update_mame_xml.py @@ -0,0 +1,28 @@ +import os +from pathlib import Path + +from typing import Final +from config import ( + ENABLE_SCHEDULED_UPDATE_MAME_XML, + SCHEDULED_UPDATE_MAME_XML_CRON, +) +from .utils import RemoteFilePullTask + +FIXTURE_FILE_PATH: Final = ( + Path(os.path.dirname(__file__)).parent / "handler" / "fixtures" / "mame.xml" +) + + +class UpdateMAMEXMLTask(RemoteFilePullTask): + def __init__(self): + super().__init__( + func="tasks.update_mame_xml.update_mame_xml_task.run", + description="mame xml update", + enabled=ENABLE_SCHEDULED_UPDATE_MAME_XML, + cron_string=SCHEDULED_UPDATE_MAME_XML_CRON, + url="https://hyperlist.hyperspin-fe.com/genall.php?system=6", + file_path=FIXTURE_FILE_PATH, + ) + + +update_mame_xml_task = UpdateMAMEXMLTask() diff --git a/backend/tasks/update_switch_titledb.py b/backend/tasks/update_switch_titledb.py new file mode 100644 index 000000000..eb48ba1b5 --- /dev/null +++ b/backend/tasks/update_switch_titledb.py @@ -0,0 +1,31 @@ +import os +from pathlib import Path + +from typing import Final +from config import ( + ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB, + SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON, +) +from .utils import RemoteFilePullTask + +FIXTURE_FILE_PATH: Final = ( + Path(os.path.dirname(__file__)).parent + / "handler" + / "fixtures" + / "switch_titledb.json" +) + + +class UpdateSwitchTitleDBTask(RemoteFilePullTask): + def __init__(self): + super().__init__( + func="tasks.update_switch_titledb.update_switch_titledb_task.run", + description="switch titledb update", + enabled=ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB, + cron_string=SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON, + url="https://raw.githubusercontent.com/blawar/titledb/master/US.en.json", + file_path=FIXTURE_FILE_PATH, + ) + + +update_switch_titledb_task = UpdateSwitchTitleDBTask() diff --git a/backend/tasks/utils.py b/backend/tasks/utils.py new file mode 100644 index 000000000..140f18793 --- /dev/null +++ b/backend/tasks/utils.py @@ -0,0 +1,104 @@ +import requests +from rq_scheduler import Scheduler +from abc import ABC, abstractmethod + +from utils.redis import low_prio_queue +from config import ENABLE_EXPERIMENTAL_REDIS +from logger.logger import log +from .exceptions import SchedulerException + +tasks_scheduler = Scheduler(queue=low_prio_queue, connection=low_prio_queue.connection) + + +class PeriodicTask(ABC): + def __init__( + self, + func: str, + description, + enabled: bool = False, + cron_string: str = None, + ): + self.func = func + self.description = description or func + self.enabled = enabled + self.cron_string = cron_string + + def _get_existing_job(self): + existing_jobs = tasks_scheduler.get_jobs() + for job in existing_jobs: + if job.func_name == self.func: + return job + + return None + + def init(self): + job = self._get_existing_job() + + if self.enabled and not job: + return self.schedule() + elif job and not self.enabled: + return self.unschedule() + + @abstractmethod + async def run(self): + pass + + def schedule(self): + if not ENABLE_EXPERIMENTAL_REDIS: + raise SchedulerException( + f"Redis not connectable, {self.description} is not scheduled." + ) + + if not self.enabled: + raise SchedulerException(f"Scheduled {self.description} is not enabled.") + + if self._get_existing_job(): + log.info(f"{self.description.capitalize()} is already scheduled.") + return + + if self.cron_string: + return tasks_scheduler.cron( + self.cron_string, + func=self.func, + repeat=None, + ) + + return None + + def unschedule(self): + job = self._get_existing_job() + + if not job: + log.info(f"{self.description.capitalize()} is not scheduled.") + return + + tasks_scheduler.cancel(job) + log.info(f"{self.description.capitalize()} unscheduled.") + + +class RemoteFilePullTask(PeriodicTask): + def __init__(self, *args, url: str, file_path: str, **kwargs): + super().__init__(*args, **kwargs) + + self.url = url + self.file_path = file_path + + async def run(self, force: bool = False): + if not self.enabled and not force: + log.info(f"Scheduled {self.description} not enabled, unscheduling...") + self.unschedule() + return + + log.info(f"Scheduled {self.description} started...") + + try: + response = requests.get(self.url) + response.raise_for_status() + + with open(self.file_path, "wb") as fixture: + fixture.write(response.content) + + log.info(f"Scheduled {self.description} done") + except requests.exceptions.RequestException as e: + log.error(f"Scheduled {self.description} failed", exc_info=True) + log.error(e) diff --git a/backend/utils/cache.py b/backend/utils/cache.py index 461850682..23a9e0428 100644 --- a/backend/utils/cache.py +++ b/backend/utils/cache.py @@ -1,9 +1,6 @@ from redis import Redis -from config import REDIS_HOST, REDIS_PORT, ENABLE_EXPERIMENTAL_REDIS - -redis_client = Redis(host=REDIS_HOST, port=int(REDIS_PORT), db=0) -redis_url = f"redis://{REDIS_HOST}:{REDIS_PORT}" +from config import REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, ENABLE_EXPERIMENTAL_REDIS class FallbackCache: @@ -34,7 +31,11 @@ class FallbackCache: # A seperate client that auto-decodes responses is needed _cache_client = Redis( - host=REDIS_HOST, port=int(REDIS_PORT), db=0, decode_responses=True + host=REDIS_HOST, + port=int(REDIS_PORT), + password=REDIS_PASSWORD, + db=0, + decode_responses=True, ) _fallback_cache = FallbackCache() cache = _cache_client if ENABLE_EXPERIMENTAL_REDIS else _fallback_cache diff --git a/backend/utils/fastapi.py b/backend/utils/fastapi.py index 20c79a737..2f3099285 100644 --- a/backend/utils/fastapi.py +++ b/backend/utils/fastapi.py @@ -41,7 +41,7 @@ def scan_platform(fs_slug: str) -> Platform: return Platform(**platform_attrs) -def scan_rom( +async def scan_rom( platform: Platform, rom_attrs: dict, r_igbd_id_search: str = "", @@ -57,7 +57,7 @@ def scan_rom( log.info(f"\t\t ยท {file}") # Update properties that don't require IGDB - file_size, file_size_units = fs.get_rom_size( + file_size, file_size_units = fs.get_rom_file_size( multi=rom_attrs["multi"], file_name=rom_attrs["file_name"], multi_files=rom_attrs["files"], @@ -86,7 +86,7 @@ def scan_rom( igdbh_rom = ( igdbh.get_rom_by_id(int(r_igbd_id_search)) if r_igbd_id_search - else igdbh.get_rom(rom_attrs["file_name"], platform.igdb_id) + else await igdbh.get_rom(rom_attrs["file_name"], platform.igdb_id) ) rom_attrs.update(igdbh_rom) diff --git a/backend/utils/fs.py b/backend/utils/fs.py index acd58bba8..a6346a45b 100644 --- a/backend/utils/fs.py +++ b/backend/utils/fs.py @@ -254,7 +254,7 @@ def get_roms(p_slug: str): ] -def get_rom_size(roms_path: str, file_name: str, multi: bool, multi_files: list = []): +def get_rom_file_size(roms_path: str, file_name: str, multi: bool, multi_files: list = []): files = ( [f"{LIBRARY_BASE_PATH}/{roms_path}/{file_name}"] if not multi diff --git a/backend/utils/redis.py b/backend/utils/redis.py new file mode 100644 index 000000000..c6e13d950 --- /dev/null +++ b/backend/utils/redis.py @@ -0,0 +1,19 @@ +from redis import Redis +from rq import Queue + +from config import REDIS_HOST, REDIS_PORT, REDIS_PASSWORD + + +redis_client = Redis( + host=REDIS_HOST, port=int(REDIS_PORT), password=REDIS_PASSWORD, db=0 +) +redis_url = ( + f"redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}" + if REDIS_PASSWORD + else f"redis://{REDIS_HOST}:{REDIS_PORT}" +) + + +high_prio_queue = Queue(name="high", connection=redis_client) +default_queue = Queue(name="default", connection=redis_client) +low_prio_queue = Queue(name="low", connection=redis_client) diff --git a/backend/utils/socket.py b/backend/utils/socket.py index f5c0f8bc1..81eb6eb13 100644 --- a/backend/utils/socket.py +++ b/backend/utils/socket.py @@ -1,6 +1,6 @@ import socketio # type: ignore -from utils.cache import redis_url +from utils.redis import redis_url from config import ENABLE_EXPERIMENTAL_REDIS diff --git a/backend/utils/tests/test_fastapi.py b/backend/utils/tests/test_fastapi.py index 1e78d9754..c6ab6dd76 100644 --- a/backend/utils/tests/test_fastapi.py +++ b/backend/utils/tests/test_fastapi.py @@ -21,9 +21,9 @@ def test_scan_platform(): @pytest.mark.vcr() -def test_scan_rom(): +async def test_scan_rom(): platform = Platform(slug="n64", igdb_id=4) - rom = scan_rom( + rom = await scan_rom( platform, { "file_name": "Paper Mario (USA).z64", diff --git a/backend/utils/tests/test_fs.py b/backend/utils/tests/test_fs.py index 2c31e2709..1bd433425 100644 --- a/backend/utils/tests/test_fs.py +++ b/backend/utils/tests/test_fs.py @@ -5,7 +5,7 @@ from ..fs import ( get_platforms, get_roms_structure, get_roms, - get_rom_size, + get_rom_file_size, # get_rom_files, # TODO: write test # rename_rom, # TODO: write test # remove_rom, # TODO: write test @@ -112,7 +112,7 @@ def test_get_roms(): def test_rom_size(): - rom_size = get_rom_size( + rom_size = get_rom_file_size( roms_path=get_roms_structure(p_slug="n64"), file_name="Paper Mario (USA).z64", multi=False, @@ -120,7 +120,7 @@ def test_rom_size(): assert rom_size == (1.0, "KB") - rom_size = get_rom_size( + rom_size = get_rom_file_size( roms_path=get_roms_structure(p_slug="n64"), file_name="Super Mario 64 (J) (Rev A)", multi=True, diff --git a/backend/watcher.py b/backend/watcher.py new file mode 100644 index 000000000..1e096210e --- /dev/null +++ b/backend/watcher.py @@ -0,0 +1,81 @@ +import os +from datetime import timedelta +from watchdog.observers import Observer +from watchdog.events import FileSystemEventHandler + +from endpoints.scan import scan_platforms +from logger.logger import log +from tasks.utils import tasks_scheduler + + +from config import ( + HIGH_PRIO_STRUCTURE_PATH, + LIBRARY_BASE_PATH, + ENABLE_RESCAN_ON_FILESYSTEM_CHANGE, + RESCAN_ON_FILESYSTEM_CHANGE_DELAY, +) + +path = ( + HIGH_PRIO_STRUCTURE_PATH + if os.path.exists(HIGH_PRIO_STRUCTURE_PATH) + else LIBRARY_BASE_PATH +) + + +class EventHandler(FileSystemEventHandler): + def on_any_event(self, event): + if not ENABLE_RESCAN_ON_FILESYSTEM_CHANGE: + return + + # Ignore .DS_Store files + if event.src_path.endswith(".DS_Store"): + return + + # Ignore modified events + if event.event_type == "modified": + return + + event_src = event.src_path.split(path)[-1] + platform_slug = event_src.split("/")[1] + + log.info(f"Filesystem event: {event.event_type} {event_src}") + + # Skip if a scan is already scheduled + for job in tasks_scheduler.get_jobs(): + if job.func_name == "endpoints.scan.scan_platforms": + if job.args[0] == []: + log.info("Full rescan already scheduled") + return + + if platform_slug in job.args[0]: + log.info(f"Scan already scheduled for {platform_slug}") + return + + time_delta = timedelta(minutes=RESCAN_ON_FILESYSTEM_CHANGE_DELAY) + rescan_in_msg = f"rescanning in {RESCAN_ON_FILESYSTEM_CHANGE_DELAY} minutes." + + # Any change to a platform directory should trigger a full rescan + if event.is_directory and event_src.count("/") == 1: + log.info(f"Platform directory changed, {rescan_in_msg}") + tasks_scheduler.enqueue_in(time_delta, scan_platforms, []) + else: + # Otherwise trigger a rescan for the specific platform + log.info(f"Change detected in {platform_slug} folder, {rescan_in_msg}") + return tasks_scheduler.enqueue_in( + time_delta, scan_platforms, [platform_slug] + ) + + +if __name__ == "__main__": + observer = Observer() + observer.schedule(EventHandler(), path, recursive=True) + observer.start() + + log.info(f"Watching {path} for changes") + + try: + while observer.is_alive(): + observer.join(1) + finally: + observer.stop() + observer.join() diff --git a/backend/worker.py b/backend/worker.py index cef4e5fa3..21a3ce6e8 100755 --- a/backend/worker.py +++ b/backend/worker.py @@ -2,7 +2,7 @@ import sys from rq import Worker, Queue, Connection from config import ENABLE_EXPERIMENTAL_REDIS -from utils.cache import redis_client +from utils.redis import redis_client listen = ["high", "default", "low"] @@ -11,6 +11,9 @@ if __name__ == "__main__": if not ENABLE_EXPERIMENTAL_REDIS: sys.exit(0) + # Start the worker with Connection(redis_client): worker = Worker(map(Queue, listen)) worker.work() + + diff --git a/docker-compose.yml b/docker-compose.yml index fadac7b25..203d11d58 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,16 @@ services: redis: image: redis:alpine container_name: redis + command: + # - /bin/sh + # - -c + # # - Double dollars, so that the variable is not expanded by Docker Compose + # # - Surround by quotes, so that the shell does not split the password + # # - The ${variable:?message} syntax causes shell to exit with a non-zero + # # code and print a message, when the variable is not set or empty + # - redis-server --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}" restart: unless-stopped ports: - ${REDIS_PORT}:6379 + env_file: + - .env diff --git a/docker/init_scripts/init b/docker/init_scripts/init index 318776de6..014d5592b 100755 --- a/docker/init_scripts/init +++ b/docker/init_scripts/init @@ -20,6 +20,12 @@ cd /backend || { echo "/backend directory doesn't seem to exist"; exit 1; } # Start rq worker /init_worker & +# Start rq scheduler +/init_scheduler & + +# Start watchdog +/init_watchdog & + # Wait for any process to exit wait -n diff --git a/docker/init_scripts/init_scheduler b/docker/init_scripts/init_scheduler new file mode 100755 index 000000000..9af27d288 --- /dev/null +++ b/docker/init_scripts/init_scheduler @@ -0,0 +1,3 @@ +#!/bin/bash + +[[ ${ENABLE_EXPERIMENTAL_REDIS} == "true" ]] && python3 scheduler.py || sleep infinity diff --git a/docker/init_scripts/init_watchdog b/docker/init_scripts/init_watchdog new file mode 100755 index 000000000..f55564fc6 --- /dev/null +++ b/docker/init_scripts/init_watchdog @@ -0,0 +1,3 @@ +#!/bin/bash + +python3 watcher.py diff --git a/docker/init_scripts/init_worker b/docker/init_scripts/init_worker index fdb2db867..21685c9c0 100755 --- a/docker/init_scripts/init_worker +++ b/docker/init_scripts/init_worker @@ -1,3 +1,3 @@ #!/bin/bash -[[ ${ENABLE_EXPERIMENTAL_REDIS} == "true" ]] && rq worker high default low --logging_level WARN || sleep infinity +[[ ${ENABLE_EXPERIMENTAL_REDIS} == "true" ]] && python3 worker.py || sleep infinity diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf index 7a1233603..ad760681f 100644 --- a/docker/nginx/default.conf +++ b/docker/nginx/default.conf @@ -15,6 +15,7 @@ http { scgi_temp_path /tmp/scgi; sendfile on; + client_max_body_size 0; tcp_nopush on; # types_hash_max_size 2048; diff --git a/env.template b/env.template index 339d5e4d4..fadefe4c5 100644 --- a/env.template +++ b/env.template @@ -11,7 +11,7 @@ STEAMGRIDDB_API_KEY= # Database driver (mariadb, sqlite) ROMM_DB_DRIVER= -# Database config (only for mariadb) +# Database config (mariadb only) DB_HOST=127.0.0.1 DB_PORT=3306 DB_NAME=romm @@ -20,12 +20,26 @@ DB_PASSWD= DB_ROOT_PASSWD= # Redis config (optional) +ENABLE_EXPERIMENTAL_REDIS=true REDIS_HOST=127.0.0.1 REDIS_PORT=6379 ENABLE_EXPERIMENTAL_REDIS=true +#REDIS_PASSWORD=admin_redis -# Authentication -ROMM_AUTH_SECRET_KEY= +# Authentication (optional) ROMM_AUTH_ENABLED=true ROMM_AUTH_USERNAME=admin ROMM_AUTH_PASSWORD=admin +ROMM_AUTH_SECRET_KEY= + +# Filesystem watcher (optional) +ENABLE_RESCAN_ON_FILESYSTEM_CHANGE=true +RESCAN_ON_FILESYSTEM_CHANGE_DELAY=5 + +# Periodic Tasks (optional) +ENABLE_SCHEDULED_RESCAN=true +SCHEDULED_RESCAN_CRON=0 3 * * * +ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB=true +SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON=0 4 * * * +ENABLE_SCHEDULED_UPDATE_MAME_XML=true +SCHEDULED_UPDATE_MAME_XML_CRON=0 4 * * * diff --git a/examples/docker-compose.example.yml b/examples/docker-compose.example.yml index e8d6f9c9a..383231f87 100644 --- a/examples/docker-compose.example.yml +++ b/examples/docker-compose.example.yml @@ -8,7 +8,7 @@ services: environment: - ROMM_DB_DRIVER=mariadb # mariadb | sqlite (default: sqlite) # [Optional] Only required if using MariaDB as the database - - DB_HOST=mariadb + - DB_HOST=romm_db - DB_PORT=3306 - DB_USER=romm-user - DB_NAME=romm # Should match the MYSQL_DATABASE value in the mariadb container @@ -27,6 +27,7 @@ services: - ENABLE_EXPERIMENTAL_REDIS=true # default: false - REDIS_HOST=redis # default: localhost - REDIS_PORT=6379 # default: 6379 + - REDIS_PASSWORD= # [Optional] Support for secured redis volumes: - "/path/to/library:/romm/library" - "/path/to/resources:/romm/resources" # [Optional] Path where roms metadata (covers) are stored @@ -40,9 +41,9 @@ services: restart: "unless-stopped" # [Optional] Only required if using MariaDB as the database - mariadb: + romm_db: image: mariadb:latest - container_name: mariadb + container_name: romm_db environment: - MYSQL_ROOT_PASSWORD= - MYSQL_DATABASE=romm diff --git a/frontend/package-lock.json b/frontend/package-lock.json index c7686479f..331f2da0b 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,16 +1,17 @@ { "name": "romm", - "version": "2.0.1", + "version": "2.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "romm", - "version": "2.0.0", + "version": "2.0.1", "dependencies": { "@mdi/font": "7.0.96", "axios": "^1.3.4", "core-js": "^3.8.3", + "cronstrue": "^2.31.0", "file-saver": "^2.0.5", "js-cookie": "^3.0.5", "jszip": "^3.10.1", @@ -2868,6 +2869,14 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, + "node_modules/cronstrue": { + "version": "2.31.0", + "resolved": "https://registry.npmjs.org/cronstrue/-/cronstrue-2.31.0.tgz", + "integrity": "sha512-A1cyfGyLSRdvT9MNn/pggoCTlvxnJyiCUItU9XHSXk89ZyK2YY9q9q7Rf4j8NhV9YwN1BjB0wimZlvKYb/9Bwg==", + "bin": { + "cronstrue": "bin/cli.js" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", diff --git a/frontend/package.json b/frontend/package.json index 31e7a9382..53bc52b71 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "romm", - "version": "2.0.1", + "version": "2.1.0", "private": true, "scripts": { "dev": "vite --host", @@ -12,6 +12,7 @@ "@mdi/font": "7.0.96", "axios": "^1.3.4", "core-js": "^3.8.3", + "cronstrue": "^2.31.0", "file-saver": "^2.0.5", "js-cookie": "^3.0.5", "jszip": "^3.10.1", diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 67de1337b..fc05eeca0 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,11 +1,9 @@