Skip to content

[Migration] Neue NASA APOD Website-Links #85

Description

@oliveratgithub

Describe the solution you'd like

Die APOD Website wird / wurde migriert: nasa/apod-api/issues/172

APOD's main NASA website will be moving from https://apod.nasa.gov/ to https://science.nasa.gov/apod . Please be sure to update

Reasons why we need it

Neue APOD Website ist bereits online, Migration läuft "between August to September (2026)"...

Sicherstellen dass die Links zu APOD Bildern weiterhin funktionieren und keine 404 Not Found-Verlinkungen entstehen.

Additional context

Kurzanalyse der zorgch/zorg-code Codebase auf relevante Anpassungen, mittels DeepWiki Devin:

https://deepwiki.com/search/the-apod-base-url-to-apod-imag_22d0b7fc-dbc5-433b-9067-3a0004bb8f97?mode=fast

  • .env.example#L149-150
  • public/includes/config.inc.php#L314-317
  • public/includes/apod.inc.php#L92-94
  • public/includes/smarty.fnc.php#L1659
APOD Domain Migration Impact

(apod.nasa.gov → science.nasa.gov/apod)
Maps how the NASA APOD base URL flows from environment config through PHP constants into the fetch/build logic and template rendering. Key affected spots: [1b] and [2c] (hardcoded/env URL), [2d] archive URL builder, [2e] malformed-URL workaround.

1. Env vars → PHP constants

Configuration layer: how NASA_APOD_SOURCE/API env vars become APOD_SOURCE/APOD_API constants used app-wide.

1a. API endpoint env var (.env.example:149)

Uses api.nasa.gov domain — unaffected by the announced migration

NASA_APOD_API="https://api.nasa.gov/planetary/apod?api_key=${NASA_API_KEY}"

1b. APOD source base URL env var (.env.example:150)

The value that must be updated to https://science.nasa.gov/apod

NASA_APOD_SOURCE="https://apod.nasa.gov/apod/"

1c. APOD_SOURCE constant defined (config.inc.php:316)

Maps env var into constant consumed by apod.inc.php; no code change needed here

if (!defined('APOD_SOURCE')) define('APOD_SOURCE', (isset($_ENV['NASA_APOD_SOURCE']) ? $_ENV['NASA_APOD_SOURCE'] : null));

1d. APOD_API constant defined (config.inc.php:317)

Maps API endpoint env var; separate domain, unaffected

if (!defined('APOD_API')) define('APOD_API', (isset($_ENV['NASA_APOD_API']) ? $_ENV['NASA_APOD_API'] : null));

2. get_apod() fetch & URL construction

Core business logic: fetches today's APOD from NASA API, fixes a known malformed-URL bug, and builds the archive link — all domain-dependent.

2a. Fetch APOD JSON from NASA API (apod.inc.php:63)

Calls api.nasa.gov via APOD_API constant; returns hdurl/url fields that reference apod.nasa.gov

$apod_data = cURLfetchJSON(APOD_API . (!empty($apod_date_input) ? '&date='.$apod_date_input : ''));

2b. Example API response (doc comment) (apod.inc.php:77)

Illustrates the malformed double-prefixed URL bug this code works around

[hdurl] => https://apod.nasa.gov/apod/http://nusoft.fnal.gov/...

2c. Hardcoded malformed-URL fix (small img) (apod.inc.php:92)

Hardcoded old domain string — must be verified/updated for new domain's bug behavior

$new_apod_img_small = str_replace('https://apod.nasa.gov/apod/http', 'http', $apod_data['url']);

2d. Hardcoded malformed-URL fix (large img) (apod.inc.php:93)

Same hardcoded domain workaround applied to hdurl field

$new_apod_img_large = str_replace('https://apod.nasa.gov/apod/http', 'http', $apod_data['hdurl']);

2e. Build archive URL from APOD_SOURCE (apod.inc.php:94)

Uses APOD_SOURCE constant + date pattern — path structure must match new science.nasa.gov/apod site

$new_apod_archive_url = APOD_SOURCE . 'ap'.$new_apod_date.'.html';

2f. Archive URL embedded into posted comment (apod.inc.php:275)

Archive link is stored permanently in the comment text posted to the gallery pic

$new_apod_comment = t('apod-pic-comment', 'apod', [ ... $new_apod_archive_url, ... ]);

3. Template rendering of stored APOD data

Presentation layer: how already-fetched/stored APOD data (independent of live NASA domain) gets displayed on the gallery overview page.

3a. Template tag invokes APOD block (overview.tpl:18)

Smarty template calls the registered {apod} function to render latest APOD thumbnail

{apod}

3b. Registers {apod} tag to smarty_apod() (smarty.fnc.php:1659)

Smarty function registration table maps template tag to PHP handler

'apod' => [ 'smarty_apod', 'apod', 'APOD', 'Astronomy Picture of the Day (APOD)', false, false ]

3c. smarty_apod() reads DB, formats thumbnail (smarty.fnc.php:784)

Fetches latest stored APOD pic ID from DB — no live NASA domain reference here, unaffected by migration

$rs = get_apod_id(); return formatGalleryThumb($rs);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

dependenciesPull requests that update a dependency fileenhancementNew feature or request

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions