Moon and retrograde calendars, "today in the sky" on the own chart
CI / test (push) Successful in 2m6s
CI / build (push) Skipped
CI / deploy (push) Skipped

New public pages: /holdnaptar (new and full moons, quarters, eclipses and
the Moon's sign changes, month by month, with the Moon of today) and
/retrograd (the retrograde periods of Mercury to Pluto with their shadows,
and which planets are retrograde now), each with a page per year around
the current one. The own chart gets a "Ma az égen" card: the Moon's sign,
phase and natal house, the tightest transits to the chart in fixed
sentences, and the retrograde planets. No AI, nothing stored.

The events come from astro-engine (sampling and bisection, checked against
swetest and the 2026 eclipses) through horoscope-api GET /v1/sky and
/v1/sky/events; the backend serves them at /v1/public/sky… and keeps them
in memory (the sky now for five minutes, a year's events for good). Links
in the mobile menu, the footer, the sitemap and the free tools on the home
page; the desktop header is unchanged (it is full at 1280 px).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-23 17:21:36 +00:00
co-authored by Claude Opus 5.5
parent 3255e939c4
commit 699ce2abbd
30 changed files with 2230 additions and 5 deletions
+47 -1
View File
@@ -90,6 +90,9 @@ async fn fake_forecast(Json(body): Json<Value>) -> (StatusCode, Json<Value>) {
)
}
/// Calls of the fake sky endpoints (only `the_sky_is_shared_and_kept` uses them).
static SKY_CALLS: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
async fn fake_jwks() -> Json<Value> {
Json(
json!({"keys": [{"kid": "test-key", "kty": "RSA", "alg": "RS256", "use": "sig", "n": GOOGLE_KEY_N.trim(), "e": "AQAB"}]}),
@@ -221,6 +224,20 @@ async fn fake_services_with(s3: FakeS3) -> String {
)
.route("/v1/synastry", post(fake_synastry))
.route("/v1/forecast", post(fake_forecast))
.route(
"/v1/sky",
get(|| async {
let n = SKY_CALLS.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
Json(json!({"call": n, "planets": [], "moon": {"phase": "full_moon"}}))
}),
)
.route(
"/v1/sky/events",
get(|axum::extract::Query(q): axum::extract::Query<std::collections::HashMap<String, String>>| async move {
SKY_CALLS.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
Json(json!({"year": q["year"].parse::<i32>().unwrap(), "lunations": []}))
}),
)
.route("/jwks", get(fake_jwks));
let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
let addr = listener.local_addr().unwrap();
@@ -1009,7 +1026,7 @@ async fn export_and_delete_account(pool: PgPool) {
/// config and catalog, shared links, invitation pages, the waitlist and
/// unsubscribing. Every other route (charts, calculations, analyses) needs a
/// logged-in user, so other apps cannot use them.
const PUBLIC_ROUTES: [&str; 22] = [
const PUBLIC_ROUTES: [&str; 24] = [
"/healthz",
// Stripe calls it; the signature proves it.
"/v1/payments/stripe/webhook",
@@ -1035,6 +1052,9 @@ const PUBLIC_ROUTES: [&str; 22] = [
"/v1/public/celebrities",
"/v1/public/celebrities/{slug}",
"/v1/public/photos/{*key}",
// The sky by date, the same for everyone (the moon and retrograde calendars).
"/v1/public/sky",
"/v1/public/sky/events",
];
#[sqlx::test(migrator = "db::MIGRATOR")]
@@ -3237,3 +3257,29 @@ async fn the_user_list_pages_with_a_total(pool: PgPool) {
assert_eq!(r.body["total"].as_i64(), Some(1));
assert_eq!(r.body["stats"], json!({ "users": 5, "buyers": 1, "test_buyers": 1 }));
}
#[sqlx::test(migrator = "db::MIGRATOR")]
async fn the_sky_is_shared_and_kept(pool: PgPool) {
let app = TestApp::new(pool).await;
let calls = || SKY_CALLS.load(std::sync::atomic::Ordering::Relaxed);
let before = calls();
// No login needed; the second call is answered from memory.
let r = app.get("/v1/public/sky", None).await;
assert_eq!(r.status, StatusCode::OK, "{}", r.body);
assert_eq!(r.body["moon"]["phase"], "full_moon");
let again = app.get("/v1/public/sky", None).await;
assert_eq!(again.body, r.body);
assert_eq!(calls() - before, 1);
let year = time::OffsetDateTime::now_utc().year();
let r = app.get(&format!("/v1/public/sky/events?year={}", year + 1), None).await;
assert_eq!(r.status, StatusCode::OK, "{}", r.body);
assert_eq!(r.body["year"], year + 1);
app.get(&format!("/v1/public/sky/events?year={}", year + 1), None).await;
assert_eq!(calls() - before, 2);
for bad in [format!("year={}", year + 6), format!("year={}", year - 6), "year=abc".into(), String::new()] {
let r = app.get(&format!("/v1/public/sky/events?{bad}"), None).await;
assert_eq!(r.status, StatusCode::BAD_REQUEST, "{bad}: {}", r.body);
}
assert_eq!(calls() - before, 2);
}