Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.1.0 #822

Merged
merged 85 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
1af05d4
add platform endpoint added
zurdi15 Feb 10, 2024
d784928
Merge branch 'mobygames-new-api' into feature/add_platform
zurdi15 Mar 19, 2024
c44eac6
Merge branch 'master' into feature/add_platform
zurdi15 Mar 19, 2024
69f760a
Merge "master" into "feature/add_platform"
zurdi15 Mar 26, 2024
16db9b0
[HOTFIX] Fix nightly scans resetting igdb/moby IDs
gantoine Apr 2, 2024
5b578c1
fix ui error messages
gantoine Apr 3, 2024
b042b28
Rename studio-ii.ico to rca-studio-ii.ico for Mobygames compatibility
Casuallynoted Apr 3, 2024
6b926fb
Rename videopac-plus.ico to videopac-g7400.ico for Mobygames compatib…
Casuallynoted Apr 3, 2024
33ff821
Rename pv-1000.ico to casio-pv-1000.ico for Mobygames compatibility
Casuallynoted Apr 3, 2024
f37211e
Merge pull request #785 from rommapp/nightly-scan-hotfix
zurdi15 Apr 3, 2024
411a52c
Merge pull request #787 from Casuallynoted/release
zurdi15 Apr 3, 2024
0154ca0
Misc hotfixes from casuallynotes testing
gantoine Apr 3, 2024
8271645
correctly fetch cover art
gantoine Apr 3, 2024
577bf3e
add scripts folder
gantoine Apr 3, 2024
6d3bcff
move files to utils
gantoine Apr 4, 2024
47018cc
add ttinfoil feed
gantoine Apr 4, 2024
3abc074
show full title on hover
gantoine Apr 4, 2024
a573780
fix edge case with item not returning name
gantoine Apr 4, 2024
eda6d78
add env to disable auth on download endpoint
gantoine Apr 4, 2024
c5dffaa
little UI tweaks
zurdi15 Apr 5, 2024
ad53325
Merge pull request #788 from rommapp/hotfixes-mobygames-api
zurdi15 Apr 5, 2024
893fb81
added delete cover UI
zurdi15 Apr 5, 2024
5d9a4e6
improved edit artwork file input UI
zurdi15 Apr 5, 2024
d1bdfed
viewer role UI permissions fixed
zurdi15 Apr 5, 2024
2d66d4a
Merge pull request #794 from rommapp/fix-viewer-role-ui
zurdi15 Apr 5, 2024
bea7754
refactor edit artwork/avatar interface
zurdi15 Apr 5, 2024
0cbc0d2
preview user avatar before update
zurdi15 Apr 6, 2024
053c27d
preview game custom artwork before update
zurdi15 Apr 6, 2024
c3e1f4f
[ROMM-618] Add last logged in and last active for users
gantoine Apr 6, 2024
27be753
remove artwork added
zurdi15 Apr 6, 2024
4add86f
Merge pull request #797 from rommapp/romm-618
zurdi15 Apr 7, 2024
7669c1a
fixed remove cover
zurdi15 Apr 7, 2024
3750c4f
Merge branch 'master' into '792-feature-remove-cover-art'
zurdi15 Apr 7, 2024
a5ec000
metric system disoplay for last login date
zurdi15 Apr 7, 2024
5d409bd
added multi-select layer button
zurdi15 Apr 7, 2024
d32f5cf
fix cover removal not sticking
gantoine Apr 7, 2024
dd2f57f
re-fetch screenshots only when changed game match
zurdi15 Apr 7, 2024
d9d7eea
Merge pull request #799 from rommapp/737-uiux-improve-multi-select-in…
zurdi15 Apr 7, 2024
508b5db
Merge pull request #796 from rommapp/792-feature-remove-cover-art
zurdi15 Apr 8, 2024
4c2c4ec
fixed readme links
zurdi15 Apr 8, 2024
35ed459
Merge branch 'master' into feature/add_platform
zurdi15 Apr 8, 2024
cff9d16
improved upload roms dialog
zurdi15 Apr 8, 2024
1fe73c7
add platform dialog added
zurdi15 Apr 8, 2024
df047cc
upload roms button in drawer added
zurdi15 Apr 8, 2024
492d821
upload roms icon fixed
zurdi15 Apr 8, 2024
a2d5e2d
fixed quick scan from gallery
zurdi15 Apr 8, 2024
2e26d06
dialogs unified into home page
zurdi15 Apr 8, 2024
7a7ccd9
upload roms dialog revamped
zurdi15 Apr 8, 2024
a920393
Merge pull request #800 from rommapp/fix-readme
gantoine Apr 9, 2024
3d78f4e
scan platform after creating it
zurdi15 Apr 9, 2024
c099f82
improved add platform and upload roms dialogs
zurdi15 Apr 9, 2024
46bb75a
Merge branch 'master' into feature/add_platform
zurdi15 Apr 9, 2024
9e43e14
fixed loading dialog
zurdi15 Apr 9, 2024
b122e93
remove unused code
zurdi15 Apr 9, 2024
680e680
improved scan logs
zurdi15 Apr 9, 2024
b10b2e2
Merge branch 'feature/add_platform' of https://github.com/zurdi15/rom…
zurdi15 Apr 9, 2024
1128ccb
upload roms dialog responsive
zurdi15 Apr 9, 2024
e9264ba
new dialogs responsiveness improvement
zurdi15 Apr 9, 2024
c8db768
added all supported platforms to upload rom dialog
zurdi15 Apr 10, 2024
34ac7de
create platform when uploading roms if needed
zurdi15 Apr 10, 2024
d3864ff
create platform if not exists when adding roms fixed
zurdi15 Apr 10, 2024
13014db
improved scan logs
zurdi15 Apr 10, 2024
f9d4c18
unified metadataOptions into hearthbeat store
zurdi15 Apr 11, 2024
0cdab86
fixed mobygames cover update
zurdi15 Apr 11, 2024
5108b22
fixed sources metadata management
zurdi15 Apr 11, 2024
d58d651
improved cover selection from multi-source
zurdi15 Apr 11, 2024
6729a21
source filter to match rom dialog added
zurdi15 Apr 11, 2024
ba1b6fd
fixed source filter in rom match
zurdi15 Apr 11, 2024
10cc41f
show source filters only of enabled
zurdi15 Apr 11, 2024
8207d70
match rom dialog UX improved
zurdi15 Apr 11, 2024
53ef186
fixed manual search button
zurdi15 Apr 11, 2024
ec70f29
improved steam deck resolution dashboard view
zurdi15 Apr 12, 2024
4128450
added copy download link button to details view
zurdi15 Apr 12, 2024
98f60fb
adds more configuration for external redis
HellLord77 Apr 13, 2024
6c6ddd7
Merge pull request #811 from HellLord77/master
zurdi15 Apr 15, 2024
485276d
Merge branch 'master' into feature/add_platform
zurdi15 Apr 15, 2024
5cee548
Merge branch 'master' into feature/copy_download_link
zurdi15 Apr 15, 2024
b726bb5
extracted build download link to utils
zurdi15 Apr 16, 2024
2972e85
Merge pull request #804 from rommapp/feature/add_platform
zurdi15 Apr 16, 2024
0b07abc
Merge branch 'master' into feature/copy_download_link
zurdi15 Apr 16, 2024
3c5bff3
Bump gunicorn from 21.2.0 to 22.0.0
dependabot[bot] Apr 17, 2024
a2476c5
Merge branch 'master' into dependabot/pip/gunicorn-22.0.0
zurdi15 Apr 17, 2024
c65e530
Merge pull request #815 from rommapp/dependabot/pip/gunicorn-22.0.0
zurdi15 Apr 17, 2024
df68141
Merge branch 'master' into feature/copy_download_link
zurdi15 Apr 17, 2024
fdac52a
Merge pull request #810 from rommapp/feature/copy_download_link
zurdi15 Apr 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RomM (ROM Manager) allows you to scan, enrich, and browse your game collection w

## Features

- Scans your existing games library and enchances it with metadata from [IGDB][igdb] and [MobyGames][mobygames]
- Scans your existing games library and enchances it with metadata from [IGDB][igdb-api] and [MobyGames][mobygames-api]
- Supports a large number of **[platforms][platform-support]**
- Play games directly from the browser using [EmulatorJS][wiki-emulatorjs-url]
- Share your library with friend while [limiting access and permissions][authentication]
Expand Down
39 changes: 39 additions & 0 deletions backend/alembic/versions/0016_user_last_login_active.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""empty message

Revision ID: 0016_user_last_login_active
Revises: 0015_mobygames_data
Create Date: 2024-04-06 15:16:50.539968

"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "0016_user_last_login_active"
down_revision = "0015_mobygames_data"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("users", schema=None) as batch_op:
batch_op.add_column(
sa.Column("last_login", sa.DateTime(timezone=True), nullable=True)
)
batch_op.add_column(
sa.Column("last_active", sa.DateTime(timezone=True), nullable=True)
)

# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("users", schema=None) as batch_op:
batch_op.drop_column("last_active")
batch_op.drop_column("last_login")

# ### end Alembic commands ###
5 changes: 5 additions & 0 deletions backend/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
REDIS_HOST: Final = os.environ.get("REDIS_HOST", "127.0.0.1")
REDIS_PORT: Final = os.environ.get("REDIS_PORT", 6379)
REDIS_PASSWORD: Final = os.environ.get("REDIS_PASSWORD")
REDIS_USERNAME: Final = os.environ.get("REDIS_USERNAME", "")
REDIS_DB: Final = int(os.environ.get("REDIS_DB", 0))

# IGDB
IGDB_CLIENT_ID: Final = os.environ.get(
Expand All @@ -54,6 +56,9 @@
"ROMM_AUTH_SECRET_KEY", secrets.token_hex(32)
)
DISABLE_CSRF_PROTECTION = os.environ.get("DISABLE_CSRF_PROTECTION", "false") == "true"
DISABLE_DOWNLOAD_ENDPOINT_AUTH = (
os.environ.get("DISABLE_DOWNLOAD_ENDPOINT_AUTH", "false") == "true"
)

# SCANS
SCAN_TIMEOUT: Final = int(os.environ.get("SCAN_TIMEOUT", 60 * 60 * 4)) # 4 hours
Expand Down
9 changes: 7 additions & 2 deletions backend/endpoints/auth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import timedelta
from datetime import timedelta, datetime
from typing import Annotated, Final

from endpoints.forms.identity import OAuth2RequestForm
Expand All @@ -7,7 +7,7 @@
from exceptions.auth_exceptions import AuthCredentialsException, DisabledException
from fastapi import APIRouter, Depends, HTTPException, Request, status
from fastapi.security.http import HTTPBasic
from handler import auth_handler, oauth_handler
from handler import auth_handler, oauth_handler, db_user_handler

ACCESS_TOKEN_EXPIRE_MINUTES: Final = 30
REFRESH_TOKEN_EXPIRE_DAYS: Final = 7
Expand Down Expand Up @@ -156,6 +156,11 @@ def login(request: Request, credentials=Depends(HTTPBasic())) -> MessageResponse

request.session.update({"iss": "romm:auth", "sub": user.username})

# Update last login and active times
db_user_handler.update_user(
user.id, {"last_login": datetime.now(), "last_active": datetime.now()}
)

return {"msg": "Successfully logged in"}


Expand Down
55 changes: 48 additions & 7 deletions backend/endpoints/webrcade.py → backend/endpoints/feeds.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
from config import ROMM_HOST
from config import ROMM_HOST, DISABLE_DOWNLOAD_ENDPOINT_AUTH
from decorators.auth import protected_route
from endpoints.responses.webrcade import (
from models.rom import Rom
from fastapi import APIRouter, Request
from handler import db_platform_handler, db_rom_handler
from .responses.feeds import (
WEBRCADE_SLUG_TO_TYPE_MAP,
WEBRCADE_SUPPORTED_PLATFORM_SLUGS,
WebrcadeFeedSchema,
TinfoilFeedSchema,
)
from fastapi import APIRouter, Request
from handler import db_platform_handler, db_rom_handler

router = APIRouter()


@protected_route(router.get, "/webrcade/feed", ["roms.read"])
@protected_route(
router.get,
"/webrcade/feed",
[] if DISABLE_DOWNLOAD_ENDPOINT_AUTH else ["roms.read"],
)
def platforms_webrcade_feed(request: Request) -> WebrcadeFeedSchema:
"""Get webrcade feed endpoint

Expand Down Expand Up @@ -45,12 +51,47 @@ def platforms_webrcade_feed(request: Request) -> WebrcadeFeedSchema:
"type": WEBRCADE_SLUG_TO_TYPE_MAP.get(p.slug, p.slug),
"thumbnail": f"{ROMM_HOST}/assets/romm/resources/{rom.path_cover_s}",
"background": f"{ROMM_HOST}/assets/romm/resources/{rom.path_cover_l}",
"props": {"rom": f"{ROMM_HOST}/api/roms/{rom.id}/content/{rom.file_name}"},
"props": {
"rom": f"{ROMM_HOST}/api/roms/{rom.id}/content/{rom.file_name}"
},
}
for rom in session.scalars(db_rom_handler.get_roms(platform_id=p.id)).all()
for rom in session.scalars(
db_rom_handler.get_roms(platform_id=p.id)
).all()
],
}
for p in platforms
if p.slug in WEBRCADE_SUPPORTED_PLATFORM_SLUGS
],
}


@protected_route(router.get, "/tinfoil/feed", ["roms.read"])
def tinfoil_index_feed(request: Request, slug: str = "switch") -> TinfoilFeedSchema:
"""Get tinfoil custom index feed endpoint
https://blawar.github.io/tinfoil/custom_index/

Args:
request (Request): Fastapi Request object
slug (str, optional): Platform slug. Defaults to "switch".

Returns:
TinfoilFeedSchema: Tinfoil feed object schema
"""
switch = db_platform_handler.get_platform_by_fs_slug(slug)
with db_rom_handler.session.begin() as session:
files: list[Rom] = session.scalars(
db_rom_handler.get_roms(platform_id=switch.id)
).all()

return {
"files": [
{
"url": f"{ROMM_HOST}/api/roms/{file.id}/content/{file.file_name}",
"size": file.file_size_bytes,
}
for file in files
],
"directories": [],
"success": "RomM Switch Library",
}
2 changes: 1 addition & 1 deletion backend/endpoints/heartbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def heartbeat() -> HeartbeatResponse:
"ENABLED": ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB, # noqa
"CRON": SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON,
"TITLE": "Scheduled Switch TitleDB update",
"MESSAGE": "Updates the Nintedo Switch TitleDB file",
"MESSAGE": "Updates the Nintendo Switch TitleDB file",
},
}
}
46 changes: 42 additions & 4 deletions backend/endpoints/platform.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
from decorators.auth import protected_route
from endpoints.responses import MessageResponse
from endpoints.responses.platform import PlatformSchema
from exceptions.fs_exceptions import PlatformAlreadyExistsException
from fastapi import APIRouter, HTTPException, Request, status
from handler import db_platform_handler
from handler import db_platform_handler, fs_platform_handler
from handler.metadata_handler.igdb_handler import IGDB_PLATFORM_LIST
from handler.scan_handler import scan_platform
from logger.logger import log

router = APIRouter()


@protected_route(router.post, "/platforms", ["platforms.write"])
def add_platforms(request: Request) -> MessageResponse:
async def add_platforms(request: Request) -> PlatformSchema:
"""Create platform endpoint

Args:
request (Request): Fastapi Request object

Returns:
MessageResponse: Standard message response
PlatformSchema: Just created platform
"""

return {"msg": "Enpoint not available yet"}
data = await request.json()
fs_slug = data["fs_slug"]
try:
fs_platform_handler.add_platforms(fs_slug=fs_slug)
except PlatformAlreadyExistsException:
log.info(f"Detected platform: {fs_slug}")
scanned_platform = scan_platform(fs_slug, [fs_slug])
platform = db_platform_handler.add_platform(scanned_platform)
return platform


@protected_route(router.get, "/platforms", ["platforms.read"])
Expand All @@ -37,6 +48,33 @@ def get_platforms(request: Request) -> list[PlatformSchema]:
return db_platform_handler.get_platforms()


@protected_route(router.get, "/platforms/supported", ["platforms.read"])
def get_supported_platforms(request: Request) -> list[PlatformSchema]:
"""Get list of supported platforms endpoint

Args:
request (Request): Fastapi Request object

Returns:
list[PlatformSchema]: List of supported platforms
"""

supported_platforms = []
db_platforms: list = db_platform_handler.get_platforms()
# This double loop probably can be done better
for platform in IGDB_PLATFORM_LIST:
platform["id"] = -1
for p in db_platforms:
if p.name == platform["name"]:
platform["id"] = p.id
platform["fs_slug"] = platform["slug"]
platform["logo_path"] = ""
platform["roms"] = []
platform["rom_count"] = 0
supported_platforms.append(PlatformSchema.model_validate(platform).model_dump())
return supported_platforms


@protected_route(router.get, "/platforms/{id}", ["platforms.read"])
def get_platform(request: Request, id: int) -> PlatformSchema:
"""Get platforms endpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,9 @@ class WebrcadeFeedSchema(TypedDict):
thumbnail: str
background: str
categories: list[dict]


class TinfoilFeedSchema(TypedDict):
files: list[dict]
directories: list[str]
success: str
3 changes: 3 additions & 0 deletions backend/endpoints/responses/identity.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime
from models.user import Role
from pydantic import BaseModel

Expand All @@ -9,6 +10,8 @@ class UserSchema(BaseModel):
role: Role
oauth_scopes: list[str]
avatar_path: str
last_login: datetime | None
last_active: datetime | None

class Config:
from_attributes = True
4 changes: 2 additions & 2 deletions backend/endpoints/responses/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class PlatformSchema(BaseModel):
igdb_id: Optional[int] = None
sgdb_id: Optional[int] = None
moby_id: Optional[int] = None
name: Optional[str]
logo_path: str
name: str
logo_path: Optional[str] = ""
rom_count: int

class Config:
Expand Down
3 changes: 2 additions & 1 deletion backend/endpoints/responses/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ class SearchRomSchema(BaseModel):
slug: str
name: str
summary: str
url_cover: str
igdb_url_cover: str = ""
moby_url_cover: str = ""
url_screenshots: list[str]
Loading
Loading