Skip to content

Commit

Permalink
Optimize catalog generation and improve stability
Browse files Browse the repository at this point in the history
  • Loading branch information
mreid-tt committed Feb 23, 2025
1 parent 3b1a574 commit 076d5a5
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions spkrepo/views/nas.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def get_catalog(arch, build, major, language, beta):

# Step 4: Construct response with "packages"
packages = []
for b in latest_build.all():
packages.append(build_package_entry(b, language))
for b in latest_build:
packages.append(build_package_entry(b, language, arch, build))

# DSM 5.1
if build >= 5004:
Expand All @@ -152,7 +152,7 @@ def get_catalog(arch, build, major, language, beta):
return packages


def build_package_entry(b, language):
def build_package_entry(b, language, arch, build):
entry = {
"package": b.version.package.name,
"version": b.version.version_string,
Expand All @@ -163,11 +163,7 @@ def build_package_entry(b, language):
language, b.version.descriptions["enu"]
).description,
"link": url_for(
".data",
path=b.path,
arch=b.architectures[0].code,
build=b.firmware.build,
_external=True,
".data", path=b.path, arch=arch, build=build, _external=True,
),
"thumbnail": [
url_for(".data", path=icon.path, _external=True)
Expand Down Expand Up @@ -247,7 +243,7 @@ def catalog():
if build < 40000:
beta = request.values.get("package_update_channel") == "beta"
else:
beta = False
beta = False # Ensure no beta packages are returned for DSM 7+
# Check if "major" is provided
if "major" in request.values:
try:
Expand Down

0 comments on commit 076d5a5

Please sign in to comment.