Public sign calculator and the twelve sign pages, SEO basics
/aszcendens-kalkulator: Sun, Moon and Ascendant signs from birth data
without an account. A calculation only (no AI, nothing saved), limited to
30 calculations and 300 place searches an hour per visitor address
(POST /v1/public/signs, GET /v1/public/geo/*). Without a birth time there
is no Ascendant, and signs near a border are marked uncertain.
/csillagjegyek and /csillagjegyek/{jegy}: the twelve signs with facts,
Sun, Moon and Ascendant, love, work, a common misbelief and an offer,
each written on its own. Links to the calculator and sign-up.
SEO: metadataBase and canonical addresses, hreflang between the
Hungarian and English privacy pages, Organization and WebSite JSON-LD on
the home page, FAQPage on the calculator, BreadcrumbList on the sign
pages; the sitemap lists the new pages, the footers link them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -175,6 +175,14 @@ async fn fake_services() -> String {
|
||||
.route("/v1/checkout/sessions", post(fake_stripe_create))
|
||||
.route("/v1/checkout/sessions/{id}", get(fake_stripe_get))
|
||||
.route("/v1/natal", post(fake_natal))
|
||||
.route("/v1/countries", get(|| async { Json(json!({"countries": [{"iso2": "HU", "name": "Hungary"}]})) }))
|
||||
.route(
|
||||
"/v1/places",
|
||||
get(|axum::extract::Query(q): axum::extract::Query<std::collections::HashMap<String, String>>| async move {
|
||||
Json(json!({"places": [{"geonames_id": 715429, "name": format!("{}ed", q["q"]), "country_code": q["country"],
|
||||
"region": null, "population": 160000}], "limit": q["limit"]}))
|
||||
}),
|
||||
)
|
||||
.route("/v1/synastry", post(fake_synastry))
|
||||
.route("/v1/forecast", post(fake_forecast))
|
||||
.route("/jwks", get(fake_jwks));
|
||||
@@ -933,7 +941,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; 16] = [
|
||||
const PUBLIC_ROUTES: [&str; 19] = [
|
||||
"/healthz",
|
||||
// Stripe calls it; the signature proves it.
|
||||
"/v1/payments/stripe/webhook",
|
||||
@@ -951,8 +959,56 @@ const PUBLIC_ROUTES: [&str; 16] = [
|
||||
"/v1/public/invitations/unsubscribe",
|
||||
"/v1/public/invitations/{token}",
|
||||
"/v1/public/waitlist",
|
||||
// The sign calculator (limited per visitor address).
|
||||
"/v1/public/signs",
|
||||
"/v1/public/geo/countries",
|
||||
"/v1/public/geo/places",
|
||||
];
|
||||
|
||||
#[sqlx::test(migrator = "db::MIGRATOR")]
|
||||
async fn the_public_sign_calculator(pool: PgPool) {
|
||||
let app = TestApp::new(pool).await;
|
||||
let visitor = ("x-real-ip", "203.0.113.9");
|
||||
let birth = json!({"date": "1990-06-21", "time": "14:30", "country": "HU", "geonames_id": 715429});
|
||||
let r = app.call_with("POST", "/v1/public/signs", None, Some(birth.clone()), &[visitor]).await;
|
||||
assert_eq!(r.status, StatusCode::OK, "{}", r.body);
|
||||
assert_eq!(
|
||||
(&r.body["sun"]["sign"], &r.body["moon"]["sign"], &r.body["ascendant"]["sign"]),
|
||||
(&json!("cancer"), &json!("pisces"), &json!("aries"))
|
||||
);
|
||||
// Without a birth time there is no Ascendant.
|
||||
let r = app
|
||||
.call_with(
|
||||
"POST",
|
||||
"/v1/public/signs",
|
||||
None,
|
||||
Some(json!({"date": "1990-06-21", "country": "HU", "geonames_id": 715429})),
|
||||
&[visitor],
|
||||
)
|
||||
.await;
|
||||
assert_eq!((r.status, &r.body["ascendant"], &r.body["time_known"]), (StatusCode::OK, &Value::Null, &json!(false)));
|
||||
let r = app.call_with("POST", "/v1/public/signs", None, Some(json!({"date": "1990-06-21"})), &[visitor]).await;
|
||||
assert_eq!(r.status, StatusCode::BAD_REQUEST);
|
||||
|
||||
// The place search passes the query on, with a capped limit.
|
||||
let r = app.call_with("GET", "/v1/public/geo/places?country=HU&q=Szeg&limit=50", None, None, &[visitor]).await;
|
||||
assert_eq!(r.status, StatusCode::OK, "{}", r.body);
|
||||
assert_eq!((&r.body["places"][0]["name"], &r.body["limit"]), (&json!("Szeged"), &json!("10")));
|
||||
let r = app.call_with("GET", "/v1/public/geo/places?country=hu&q=S", None, None, &[visitor]).await;
|
||||
assert_eq!(r.status, StatusCode::BAD_REQUEST);
|
||||
assert_eq!(app.get("/v1/public/geo/countries", None).await.body["countries"][0]["iso2"], "HU");
|
||||
|
||||
// 30 calculations an hour per address (the malformed request did not count).
|
||||
for _ in 0..28 {
|
||||
let r = app.call_with("POST", "/v1/public/signs", None, Some(birth.clone()), &[visitor]).await;
|
||||
assert_eq!(r.status, StatusCode::OK);
|
||||
}
|
||||
let r = app.call_with("POST", "/v1/public/signs", None, Some(birth.clone()), &[visitor]).await;
|
||||
assert_eq!(r.status, StatusCode::TOO_MANY_REQUESTS);
|
||||
let r = app.call_with("POST", "/v1/public/signs", None, Some(birth), &[("x-real-ip", "198.51.100.2")]).await;
|
||||
assert_eq!(r.status, StatusCode::OK);
|
||||
}
|
||||
|
||||
#[sqlx::test(migrator = "db::MIGRATOR")]
|
||||
async fn a_visit_by_someone_else_earns_one_question_once(pool: PgPool) {
|
||||
let app = TestApp::new(pool).await;
|
||||
|
||||
Reference in New Issue
Block a user