Skip to content

Commit f58fdfe

Browse files
authored
Merge pull request #3412 from Spinnich/feat/composite-hashing-archives
Composite hashing for compressed archives
2 parents 29f90c0 + 10d731d commit f58fdfe

10 files changed

Lines changed: 890 additions & 317 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""Add archive_members JSON column to rom_files
2+
3+
Revision ID: 0081_add_archive_members
4+
Revises: 0080_add_chd_sha1_hash
5+
Create Date: 2026-05-28 00:00:00.000000
6+
7+
"""
8+
9+
import sqlalchemy as sa
10+
from alembic import op
11+
12+
from utils.database import CustomJSON
13+
14+
revision = "0081_add_archive_members"
15+
down_revision = "0080_add_chd_sha1_hash"
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade() -> None:
21+
with op.batch_alter_table("rom_files", schema=None) as batch_op:
22+
batch_op.add_column(
23+
sa.Column("archive_members", CustomJSON(), nullable=True),
24+
if_not_exists=True,
25+
)
26+
27+
28+
def downgrade() -> None:
29+
with op.batch_alter_table("rom_files", schema=None) as batch_op:
30+
batch_op.drop_column("archive_members", if_exists=True)

backend/endpoints/feeds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
from handler.auth.constants import Scope
4141
from handler.database import db_platform_handler, db_rom_handler
4242
from handler.filesystem import fs_rom_handler
43-
from handler.filesystem.roms_handler import is_compressed_file
4443
from handler.metadata import meta_igdb_handler
4544
from handler.metadata.base_handler import (
4645
SONY_SERIAL_REGEX,
@@ -49,6 +48,7 @@
4948
)
5049
from handler.metadata.base_handler import UniversalPlatformSlug as UPS
5150
from models.rom import Rom, RomFile, RomFileCategory
51+
from utils.archives import is_compressed_file
5252
from utils.router import APIRouter
5353

5454

backend/endpoints/responses/rom.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ def for_user(cls, user_id: int, db_rom: Rom) -> RomUserSchema:
147147
return rom_user_schema_factory()
148148

149149

150+
class ArchiveMemberSchema(TypedDict):
151+
name: str
152+
size: int
153+
crc_hash: str
154+
md5_hash: str
155+
sha1_hash: str
156+
157+
150158
class RomFileSchema(BaseModel):
151159
model_config = ConfigDict(from_attributes=True)
152160

@@ -164,6 +172,7 @@ class RomFileSchema(BaseModel):
164172
sha1_hash: str | None
165173
ra_hash: str | None
166174
chd_sha1_hash: str | None
175+
archive_members: list[ArchiveMemberSchema] | None
167176
category: RomFileCategory | None
168177

169178

0 commit comments

Comments
 (0)