Merge pull request #426 from outis1one/claude/wolf-pair-port-conflict-7nz8qg
Claude/wolf pair port conflict 7nz8qg
This commit is contained in:
+78
-4
@@ -1719,8 +1719,16 @@ CATALOG = {
|
||||
),
|
||||
'desktop': dict(
|
||||
name='WolfDesktop', title='Desktop',
|
||||
icon='https://games-on-whales.github.io/wildlife/apps/desktop/assets/icon.png',
|
||||
image='ghcr.io/games-on-whales/desktop:edge',
|
||||
# NOT "desktop" — ghcr.io/games-on-whales/desktop never existed.
|
||||
# Confirmed live: Wolf logged "[DOCKER] error 404 - No such image:
|
||||
# ghcr.io/games-on-whales/desktop:edge" and silently dropped back to
|
||||
# the Moonlight app list with no other indication of failure. The
|
||||
# games-on-whales/gow repo's apps/ directory names this app "xfce",
|
||||
# and ghcr.io/games-on-whales/xfce:edge is the real, currently
|
||||
# published image (confirmed against the GHCR package's own tag
|
||||
# list). The icon path uses the same "xfce" naming.
|
||||
icon='https://games-on-whales.github.io/wildlife/apps/xfce/assets/icon.png',
|
||||
image='ghcr.io/games-on-whales/xfce:edge',
|
||||
# Shares the SAME persistent home (.config/.local/share) and
|
||||
# emulators/ -> ~/Applications mount as esde/retroarch below — a real
|
||||
# XFCE multi-window session is a much more reliable place to run a
|
||||
@@ -1812,6 +1820,33 @@ def update_field(lines, wolf_name, field, new_value):
|
||||
return True
|
||||
return False
|
||||
|
||||
def update_scalar_field(lines, wolf_name, field, new_value):
|
||||
# Same block-bounding as update_field, but for a single-line scalar
|
||||
# string field (image, icon_png_path) that Wolf never reformats across
|
||||
# multiple lines. update_field's array logic (which scans forward
|
||||
# hunting for a closing ']') isn't safe to reuse here — a scalar line
|
||||
# has no ']' of its own and that scan would run off into an unrelated
|
||||
# array field further down the same block (e.g. 'ports = []'),
|
||||
# corrupting it. Confirmed needed live: a stale 'image' field (e.g. the
|
||||
# games-on-whales/desktop -> xfce rename) was NOT refreshed by
|
||||
# update_field, since only 'mounts'/'env' were ever passed to it — an
|
||||
# already-installed app's broken image reference survived every
|
||||
# reinstall/'./manage.sh apps' re-run until this was added.
|
||||
for i, line in enumerate(lines):
|
||||
if f"name = '{wolf_name}'" in line:
|
||||
block_start = i
|
||||
while block_start > 0 and lines[block_start].strip() != '[[profiles.apps]]':
|
||||
block_start -= 1
|
||||
block_end = i + 1
|
||||
while block_end < len(lines) and lines[block_end].strip() not in ('[[profiles.apps]]', '[[profiles]]'):
|
||||
block_end += 1
|
||||
for j in range(block_start, block_end):
|
||||
if lines[j].lstrip().startswith(field + " = '"):
|
||||
indent = lines[j][:len(lines[j]) - len(lines[j].lstrip())]
|
||||
lines[j] = f"{indent}{field} = '{new_value}'\n"
|
||||
return True
|
||||
return False
|
||||
|
||||
with open(cfg, 'r') as f:
|
||||
lines = f.readlines()
|
||||
|
||||
@@ -1838,6 +1873,8 @@ for key in list(CATALOG.keys()):
|
||||
if already:
|
||||
ok = update_field(lines, wolf_name, 'mounts', new_mounts)
|
||||
ok = update_field(lines, wolf_name, 'env', new_env) or ok
|
||||
ok = update_scalar_field(lines, wolf_name, 'image', app['image']) or ok
|
||||
ok = update_scalar_field(lines, wolf_name, 'icon_png_path', app['icon']) or ok
|
||||
if ok:
|
||||
updated.append(app['title'])
|
||||
else:
|
||||
@@ -3134,8 +3171,16 @@ CATALOG = {
|
||||
),
|
||||
'desktop': dict(
|
||||
name='WolfDesktop', title='Desktop',
|
||||
icon='https://games-on-whales.github.io/wildlife/apps/desktop/assets/icon.png',
|
||||
image='ghcr.io/games-on-whales/desktop:edge',
|
||||
# NOT "desktop" — ghcr.io/games-on-whales/desktop never existed.
|
||||
# Confirmed live: Wolf logged "[DOCKER] error 404 - No such image:
|
||||
# ghcr.io/games-on-whales/desktop:edge" and silently dropped back to
|
||||
# the Moonlight app list with no other indication of failure. The
|
||||
# games-on-whales/gow repo's apps/ directory names this app "xfce",
|
||||
# and ghcr.io/games-on-whales/xfce:edge is the real, currently
|
||||
# published image (confirmed against the GHCR package's own tag
|
||||
# list). The icon path uses the same "xfce" naming.
|
||||
icon='https://games-on-whales.github.io/wildlife/apps/xfce/assets/icon.png',
|
||||
image='ghcr.io/games-on-whales/xfce:edge',
|
||||
# Shares the SAME persistent home (.config/.local/share) and
|
||||
# emulators/ -> ~/Applications mount as esde/retroarch below — a real
|
||||
# XFCE multi-window session is a much more reliable place to run a
|
||||
@@ -3228,6 +3273,33 @@ def update_field(lines, wolf_name, field, new_value):
|
||||
return True
|
||||
return False
|
||||
|
||||
def update_scalar_field(lines, wolf_name, field, new_value):
|
||||
# Same block-bounding as update_field, but for a single-line scalar
|
||||
# string field (image, icon_png_path) that Wolf never reformats across
|
||||
# multiple lines. update_field's array logic (which scans forward
|
||||
# hunting for a closing ']') isn't safe to reuse here — a scalar line
|
||||
# has no ']' of its own and that scan would run off into an unrelated
|
||||
# array field further down the same block (e.g. 'ports = []'),
|
||||
# corrupting it. Confirmed needed live: a stale 'image' field (e.g. the
|
||||
# games-on-whales/desktop -> xfce rename) was NOT refreshed by
|
||||
# update_field, since only 'mounts'/'env' were ever passed to it — an
|
||||
# already-installed app's broken image reference survived every
|
||||
# './manage.sh apps' re-run until this was added.
|
||||
for i, line in enumerate(lines):
|
||||
if f"name = '{wolf_name}'" in line:
|
||||
block_start = i
|
||||
while block_start > 0 and lines[block_start].strip() != '[[profiles.apps]]':
|
||||
block_start -= 1
|
||||
block_end = i + 1
|
||||
while block_end < len(lines) and lines[block_end].strip() not in ('[[profiles.apps]]', '[[profiles]]'):
|
||||
block_end += 1
|
||||
for j in range(block_start, block_end):
|
||||
if lines[j].lstrip().startswith(field + " = '"):
|
||||
indent = lines[j][:len(lines[j]) - len(lines[j].lstrip())]
|
||||
lines[j] = f"{indent}{field} = '{new_value}'\n"
|
||||
return True
|
||||
return False
|
||||
|
||||
with open(cfg, 'r') as f:
|
||||
lines = f.readlines()
|
||||
|
||||
@@ -3257,6 +3329,8 @@ for key in list(CATALOG.keys()): # preserve display order
|
||||
if already:
|
||||
ok = update_field(lines, wolf_name, 'mounts', new_mounts)
|
||||
ok = update_field(lines, wolf_name, 'env', new_env) or ok
|
||||
ok = update_scalar_field(lines, wolf_name, 'image', app['image']) or ok
|
||||
ok = update_scalar_field(lines, wolf_name, 'icon_png_path', app['icon']) or ok
|
||||
if ok:
|
||||
updated.append(app['title'])
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user