Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f037522052 | ||
|
|
c7600608d3 |
@@ -145,6 +145,8 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
BACKEND_URL: http://backend:8081
|
BACKEND_URL: http://backend:8081
|
||||||
HOROSCOPE_API_URL: http://horoscope-api:8080
|
HOROSCOPE_API_URL: http://horoscope-api:8080
|
||||||
|
# Absolute links of the share previews (og:image).
|
||||||
|
PUBLIC_BASE_URL: https://${DOMAIN}
|
||||||
depends_on:
|
depends_on:
|
||||||
backend:
|
backend:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# Megosztás
|
||||||
|
|
||||||
|
A képletoldalon, a rövid összefoglaló alatt van a **Megosztás** gomb. Ez egy nyilvános linket ad (`/s/<kód>`), amelyen a képlet rajza és a legfrissebb rövid összefoglaló látszik. Név és születési adatok nem kerülnek rá.
|
||||||
|
|
||||||
|
- **Ugyanaz a link:** ha ugyanazt a képletet újra megosztod, a már nyitott link jön vissza (`POST /v1/shares`: új linknél 201, meglévőnél 200).
|
||||||
|
- **Visszavonás:** a „Link visszavonása” gomb után az oldal és a kép is 404-et ad.
|
||||||
|
- **Keresők:** az oldal `noindex`, a keresők nem listázzák.
|
||||||
|
|
||||||
|
## Előnézet (Facebook, Messenger, WhatsApp, LinkedIn, X)
|
||||||
|
|
||||||
|
Az oldal `og:` és `twitter:` meta tagjei:
|
||||||
|
|
||||||
|
| Tag | Tartalom |
|
||||||
|
|---|---|
|
||||||
|
| cím | az összefoglaló címe |
|
||||||
|
| leírás | az összefoglaló első ~200 karaktere |
|
||||||
|
| kép | `/s/<kód>/kep/<verzió>.png` |
|
||||||
|
|
||||||
|
A kép egy 1200×630-as PNG. A Next.js beépített képgenerálója (`next/og`) készíti kérésre, a következőkkel:
|
||||||
|
|
||||||
|
- a radix (`src/lib/wheelSvg.ts`; ugyanaz a `<ChartWheel>`, mint az oldalon, beégetett színekkel);
|
||||||
|
- a cím és a szöveg eleje;
|
||||||
|
- a Nap, a Hold és az Aszcendens jegye.
|
||||||
|
|
||||||
|
Működése:
|
||||||
|
|
||||||
|
- **Betűtípusok:** a `src/assets/og` mappából olvassa őket. Hiányzó karakter miatt soha nem tölt le fontot az internetről, mert a nem betű, szám vagy írásjel karaktereket kiszűri.
|
||||||
|
- **Verzió:** a fájlnévben lévő verzió az összefoglaló azonosítójából és elkészültének idejéből készül. Ha az összefoglaló újragenerálódik, új címet kap a kép, és a Facebook újra letölti.
|
||||||
|
- **Gyorsítótár:** `Cache-Control: public, max-age=3600, s-maxage=86400`. A Cloudflare egy napig tartja, így egy visszavont link képe legfeljebb egy napig marad ott. A Facebook a saját példányát a saját szabályai szerint tartja meg, nagyjából 30 napig.
|
||||||
|
- **Frissítés kézzel:** a Facebook megosztás-ellenőrzőjében (Sharing Debugger) a „Scrape Again” gombbal.
|
||||||
|
|
||||||
|
A frontend a `PUBLIC_BASE_URL` alapján írja az abszolút címeket; élesben ez `https://${DOMAIN}`.
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
//! Public sharing links. Creating and revoking a link needs login; opening
|
//! Public sharing links. Creating and revoking a link needs login; opening
|
||||||
//! one (`GET /v1/public/shares/{slug}`) does not. The public view never
|
//! one (`GET /v1/public/shares/{slug}`) does not. The public view never
|
||||||
//! contains birth data unless the owner allowed it for their own chart.
|
//! contains birth data unless the owner allowed it for their own chart.
|
||||||
|
//! A shared chart comes with its newest short summary (the share page and
|
||||||
|
//! its preview image show both). Sharing the same thing again returns the
|
||||||
|
//! link that is already open.
|
||||||
|
|
||||||
use axum::Json;
|
use axum::Json;
|
||||||
use axum::extract::{Path, State};
|
use axum::extract::{Path, State};
|
||||||
@@ -109,6 +112,24 @@ pub async fn create(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
let title = req.title.map(|t| t.trim().chars().take(120).collect::<String>()).filter(|t| !t.is_empty());
|
let title = req.title.map(|t| t.trim().chars().take(120).collect::<String>()).filter(|t| !t.is_empty());
|
||||||
|
let open: Option<ShareRow> = sqlx::query_as(&format!(
|
||||||
|
"SELECT {SHARE_COLUMNS} FROM shares WHERE owner_id = $1 AND kind = $2 AND revoked_at IS NULL \
|
||||||
|
AND chart_id IS NOT DISTINCT FROM $3 AND synastry_id IS NOT DISTINCT FROM $4 \
|
||||||
|
AND analysis_id IS NOT DISTINCT FROM $5 AND title IS NOT DISTINCT FROM $6 AND show_birth_data = $7 \
|
||||||
|
ORDER BY created_at DESC LIMIT 1"
|
||||||
|
))
|
||||||
|
.bind(auth.id())
|
||||||
|
.bind(kind)
|
||||||
|
.bind(chart_id)
|
||||||
|
.bind(synastry_id)
|
||||||
|
.bind(analysis_id)
|
||||||
|
.bind(&title)
|
||||||
|
.bind(req.show_birth_data)
|
||||||
|
.fetch_optional(&state.db)
|
||||||
|
.await?;
|
||||||
|
if let Some(row) = open {
|
||||||
|
return Ok((StatusCode::OK, Json(row.view(&state.config.public_base_url))));
|
||||||
|
}
|
||||||
let row: ShareRow = sqlx::query_as(&format!(
|
let row: ShareRow = sqlx::query_as(&format!(
|
||||||
"INSERT INTO shares (id, owner_id, slug, kind, chart_id, synastry_id, analysis_id, title, show_birth_data) \
|
"INSERT INTO shares (id, owner_id, slug, kind, chart_id, synastry_id, analysis_id, title, show_birth_data) \
|
||||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING {SHARE_COLUMNS}"
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING {SHARE_COLUMNS}"
|
||||||
@@ -175,6 +196,7 @@ async fn public_body(db: &PgPool, share: &ShareRow) -> Result<Value, ApiError> {
|
|||||||
if let Some(chart_id) = share.chart_id {
|
if let Some(chart_id) = share.chart_id {
|
||||||
let chart = find_chart(db, chart_id).await?.ok_or(ApiError::NotFound("share"))?;
|
let chart = find_chart(db, chart_id).await?.ok_or(ApiError::NotFound("share"))?;
|
||||||
body["chart"] = public_chart_block(&chart, share);
|
body["chart"] = public_chart_block(&chart, share);
|
||||||
|
body["summary"] = latest_summary(db, chart_id).await?;
|
||||||
} else if let Some(synastry_id) = share.synastry_id {
|
} else if let Some(synastry_id) = share.synastry_id {
|
||||||
let s = load_synastry(db, synastry_id).await?.ok_or(ApiError::NotFound("share"))?;
|
let s = load_synastry(db, synastry_id).await?.ok_or(ApiError::NotFound("share"))?;
|
||||||
body["synastry"] = public_synastry_block(&s, share);
|
body["synastry"] = public_synastry_block(&s, share);
|
||||||
@@ -198,6 +220,28 @@ async fn public_body(db: &PgPool, share: &ShareRow) -> Result<Value, ApiError> {
|
|||||||
Ok(body)
|
Ok(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The newest finished short summary of a chart (`null` if none).
|
||||||
|
async fn latest_summary(db: &PgPool, chart_id: Uuid) -> Result<Value, sqlx::Error> {
|
||||||
|
type Row = (Uuid, String, Option<Value>, Option<OffsetDateTime>);
|
||||||
|
let row: Option<Row> = sqlx::query_as(
|
||||||
|
"SELECT id, language, content, completed_at FROM analyses \
|
||||||
|
WHERE chart_id = $1 AND kind = 'summary' AND status = 'done' ORDER BY completed_at DESC LIMIT 1",
|
||||||
|
)
|
||||||
|
.bind(chart_id)
|
||||||
|
.fetch_optional(db)
|
||||||
|
.await?;
|
||||||
|
Ok(match row {
|
||||||
|
Some((id, language, content, completed_at)) => json!({
|
||||||
|
"id": id,
|
||||||
|
"language": language,
|
||||||
|
"title": content.as_ref().and_then(|c| c["title"].as_str()),
|
||||||
|
"summary": content.as_ref().and_then(|c| c["summary"].as_str()),
|
||||||
|
"completed_at": rfc3339_opt(completed_at),
|
||||||
|
}),
|
||||||
|
None => Value::Null,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Public: the shared content for the share page and its OG image.
|
/// Public: the shared content for the share page and its OG image.
|
||||||
pub async fn public_view(State(state): St, Path(slug): Path<String>) -> ApiResult<Json<Value>> {
|
pub async fn public_view(State(state): St, Path(slug): Path<String>) -> ApiResult<Json<Value>> {
|
||||||
let share: ShareRow = sqlx::query_as(&format!(
|
let share: ShareRow = sqlx::query_as(&format!(
|
||||||
|
|||||||
@@ -628,6 +628,30 @@ async fn public_shares(pool: PgPool) {
|
|||||||
for hidden in ["input", "location", "time", "astronomy", "birth"] {
|
for hidden in ["input", "location", "time", "astronomy", "birth"] {
|
||||||
assert!(shown.get(hidden).is_none(), "{hidden} must not be public");
|
assert!(shown.get(hidden).is_none(), "{hidden} must not be public");
|
||||||
}
|
}
|
||||||
|
assert!(r.body["summary"].is_null(), "no finished summary yet");
|
||||||
|
|
||||||
|
// the newest finished summary comes with the chart
|
||||||
|
sqlx::query(
|
||||||
|
"INSERT INTO analyses (id, kind, chart_id, requested_by, language, model, prompt_version, cache_key, \
|
||||||
|
credits_charged, status, content, completed_at) \
|
||||||
|
VALUES ($1, 'summary', $2::uuid, (SELECT id FROM users WHERE email = 'anna@example.com'), 'hu', 'm', 'v', \
|
||||||
|
'k', 0, 'done', $3, now())",
|
||||||
|
)
|
||||||
|
.bind(uuid::Uuid::now_v7())
|
||||||
|
.bind(chart_id)
|
||||||
|
.bind(json!({"title": "Csendes erő", "summary": "Rövid **összefoglaló**."}))
|
||||||
|
.execute(&app.pool)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
let r = app.get(&format!("/v1/public/shares/{slug}"), None).await;
|
||||||
|
assert_eq!(r.body["summary"]["title"], "Csendes erő");
|
||||||
|
assert_eq!(r.body["summary"]["summary"], "Rövid **összefoglaló**.");
|
||||||
|
|
||||||
|
// sharing the same again gives the open link
|
||||||
|
let r = app
|
||||||
|
.post("/v1/shares", Some(&anna), json!({"kind": "chart", "target_id": chart_id, "title": "A radixom"}))
|
||||||
|
.await;
|
||||||
|
assert_eq!((r.status, r.body["slug"].as_str()), (StatusCode::OK, Some(slug.as_str())));
|
||||||
|
|
||||||
let r = app
|
let r = app
|
||||||
.post("/v1/shares", Some(&anna), json!({"kind": "chart", "target_id": chart_id, "show_birth_data": true}))
|
.post("/v1/shares", Some(&anna), json!({"kind": "chart", "target_id": chart_id, "show_birth_data": true}))
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<!-- BEGIN:nextjs-agent-rules -->
|
||||||
|
|
||||||
|
## This is NOT the Next.js you know
|
||||||
|
|
||||||
|
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.
|
||||||
|
|
||||||
|
This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.
|
||||||
|
|
||||||
|
<!-- END:nextjs-agent-rules -->
|
||||||
@@ -4,6 +4,8 @@ const config: NextConfig = {
|
|||||||
// Small self-contained server for the container image.
|
// Small self-contained server for the container image.
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
poweredByHeader: false,
|
poweredByHeader: false,
|
||||||
|
// The fonts of the share preview images are read from disk at run time.
|
||||||
|
outputFileTracingIncludes: { "/s/[slug]/kep/[file]": ["./src/assets/og/*.ttf"] },
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|||||||
@@ -695,3 +695,14 @@ a.pair-row:hover strong { color: var(--gold); }
|
|||||||
.site-header { gap: 8px 12px; }
|
.site-header { gap: 8px 12px; }
|
||||||
.logo { font-size: 25px; }
|
.logo { font-size: 25px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sharing a chart (summary card) and the public share page */
|
||||||
|
.share { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
|
||||||
|
.share-open { align-items: stretch; padding: 14px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel-2); }
|
||||||
|
.share-link { display: flex; gap: 8px; }
|
||||||
|
.share-link .inp { min-height: 36px; font-size: 14px; }
|
||||||
|
.share-trio { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: 14px; }
|
||||||
|
.share-trio .sym { color: var(--gold); }
|
||||||
|
.share-cta { gap: 12px; }
|
||||||
|
.share-cta h2 { font-size: 24px; }
|
||||||
|
.share-cta .btn { align-self: flex-start; }
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
// The link preview image of a shared chart (og:image): 1200×630 PNG with the
|
||||||
|
// wheel, the title and the text of the short summary. The file name carries
|
||||||
|
// a version (see `imageVersion`), so a rewritten summary gets a new address
|
||||||
|
// and Facebook and co. fetch it again.
|
||||||
|
import { readFile } from "node:fs/promises";
|
||||||
|
import { join } from "node:path";
|
||||||
|
|
||||||
|
import { ImageResponse } from "next/og";
|
||||||
|
|
||||||
|
import { SIGNS, signName } from "@/lib/astro";
|
||||||
|
import { bigThree, loadShare, plain, shorten } from "@/lib/share";
|
||||||
|
import { wheelSvg } from "@/lib/wheelSvg";
|
||||||
|
|
||||||
|
const W = 1200;
|
||||||
|
const H = 630;
|
||||||
|
const WHEEL = 590;
|
||||||
|
|
||||||
|
const FONTS = join(process.cwd(), "src/assets/og");
|
||||||
|
let fonts: Promise<{ name: string; data: Buffer; weight: 400 | 600; style: "normal" }[]> | null = null;
|
||||||
|
|
||||||
|
function loadFonts() {
|
||||||
|
fonts ??= Promise.all(
|
||||||
|
(
|
||||||
|
[
|
||||||
|
["Cormorant Garamond", "CormorantGaramond-SemiBold.ttf", 600],
|
||||||
|
["Inter", "Inter-Regular.ttf", 400],
|
||||||
|
["Inter", "Inter-SemiBold.ttf", 600],
|
||||||
|
["DejaVu Sans", "DejaVuSans.ttf", 400],
|
||||||
|
] as const
|
||||||
|
).map(async ([name, file, weight]) => ({
|
||||||
|
name,
|
||||||
|
data: await readFile(join(FONTS, file)),
|
||||||
|
weight,
|
||||||
|
style: "normal" as const,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
return fonts;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Letters, digits, punctuation and spaces only: a character missing from the
|
||||||
|
// fonts would make the renderer download a font from the internet.
|
||||||
|
const printable = (s: string) => s.replace(/[^\p{L}\p{N}\p{P}\p{Zs}+=<>°]/gu, "");
|
||||||
|
|
||||||
|
export async function GET(_req: Request, { params }: { params: Promise<{ slug: string; file: string }> }) {
|
||||||
|
const { slug } = await params;
|
||||||
|
const share = await loadShare(slug);
|
||||||
|
const chart = share?.chart?.chart;
|
||||||
|
if (!share || !chart) return new Response("Not found", { status: 404 });
|
||||||
|
|
||||||
|
const title = printable(share.summary?.title ?? "Születési képlet");
|
||||||
|
const text = printable(shorten(plain(share.summary?.summary ?? ""), 280));
|
||||||
|
const svg = wheelSvg(chart, chart.time_known, WHEEL);
|
||||||
|
const trio = bigThree(chart);
|
||||||
|
|
||||||
|
const image = new ImageResponse(
|
||||||
|
(
|
||||||
|
<div style={{ display: "flex", width: W, height: H, background: "#0d1220", color: "#ece6d8", fontFamily: "Inter" }}>
|
||||||
|
<div style={{ display: "flex", width: WHEEL + 40, height: H, alignItems: "center", justifyContent: "center" }}>
|
||||||
|
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||||
|
<img
|
||||||
|
src={`data:image/svg+xml;base64,${Buffer.from(svg).toString("base64")}`}
|
||||||
|
width={WHEEL}
|
||||||
|
height={WHEEL}
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
flex: 1,
|
||||||
|
padding: "56px 56px 44px 8px",
|
||||||
|
gap: 18,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div style={{ display: "flex", fontSize: 17, fontWeight: 600, letterSpacing: 2.5, color: "#d9b46a" }}>
|
||||||
|
SZÜLETÉSI KÉPLET · RÖVIDEN
|
||||||
|
</div>
|
||||||
|
<div style={{ display: "flex", fontFamily: "Cormorant Garamond", fontSize: 56, lineHeight: 1.05 }}>{title}</div>
|
||||||
|
{text && <div style={{ display: "flex", fontSize: 23, lineHeight: 1.45, color: "#c9cfdc" }}>{text}</div>}
|
||||||
|
<div style={{ display: "flex", marginTop: "auto", gap: 22, fontSize: 21, color: "#c9cfdc" }}>
|
||||||
|
{trio.map((t) => (
|
||||||
|
<div key={t.label} style={{ display: "flex", alignItems: "center", gap: 8 }}>
|
||||||
|
<span style={{ fontFamily: "DejaVu Sans", color: "#d9b46a" }}>
|
||||||
|
{(SIGNS[t.sign]?.glyph ?? "").replace(/︎/g, "")}
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
{t.label === "Aszcendens" ? "Asc" : t.label} {signName(t.sign)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div style={{ display: "flex", fontFamily: "Cormorant Garamond", fontSize: 30, color: "#ece6d8" }}>
|
||||||
|
sors<span style={{ color: "#d9b46a" }}>fonalak</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
{
|
||||||
|
width: W,
|
||||||
|
height: H,
|
||||||
|
fonts: await loadFonts(),
|
||||||
|
// A day at the edge: a revoked link's image goes away from there too.
|
||||||
|
headers: { "Cache-Control": "public, max-age=3600, s-maxage=86400" },
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return image;
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
import type { Metadata } from "next";
|
||||||
|
import Link from "next/link";
|
||||||
|
import { notFound } from "next/navigation";
|
||||||
|
|
||||||
|
import { ChartWheel, WheelLegend } from "@/components/ChartWheel";
|
||||||
|
import { Rich } from "@/components/Rich";
|
||||||
|
import { Logo } from "@/components/SiteHeader";
|
||||||
|
import { SIGNS, signName } from "@/lib/astro";
|
||||||
|
import { getMe } from "@/lib/server";
|
||||||
|
import { bigThree, imageVersion, loadShare, plain, shorten, siteUrl } from "@/lib/share";
|
||||||
|
|
||||||
|
type Props = { params: Promise<{ slug: string }> };
|
||||||
|
|
||||||
|
/** Title, description and preview image for Facebook, Messenger, WhatsApp and co. */
|
||||||
|
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||||
|
const { slug } = await params;
|
||||||
|
const share = await loadShare(slug);
|
||||||
|
if (!share?.chart) return { title: "A link nem érhető el", robots: { index: false } };
|
||||||
|
const base = await siteUrl();
|
||||||
|
const title = share.summary?.title ?? "Születési képlet";
|
||||||
|
const description = share.summary?.summary
|
||||||
|
? shorten(plain(share.summary.summary), 200)
|
||||||
|
: "Egy születési képlet a Sorsfonalakon.";
|
||||||
|
const url = `${base}/s/${slug}`;
|
||||||
|
const image = { url: `${base}/s/${slug}/kep/${imageVersion(share)}.png`, width: 1200, height: 630, alt: title };
|
||||||
|
return {
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
// Personal content: shown when shared, not listed in search engines.
|
||||||
|
robots: { index: false, follow: false },
|
||||||
|
alternates: { canonical: url },
|
||||||
|
openGraph: { type: "website", siteName: "Sorsfonalak", locale: "hu_HU", url, title, description, images: [image] },
|
||||||
|
twitter: { card: "summary_large_image", title, description, images: [image.url] },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A shared chart: the wheel and its short summary, open to anyone with the link. */
|
||||||
|
export default async function SharedChartPage({ params }: Props) {
|
||||||
|
const { slug } = await params;
|
||||||
|
const [share, me] = await Promise.all([loadShare(slug), getMe()]);
|
||||||
|
const chart = share?.chart?.chart;
|
||||||
|
if (!share || !chart) notFound();
|
||||||
|
const summary = share.summary;
|
||||||
|
const trio = bigThree(chart);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{!me && (
|
||||||
|
<header className="site-header">
|
||||||
|
<Logo />
|
||||||
|
<span style={{ flex: 1 }} />
|
||||||
|
<Link href="/belepes" className="btn btn-sm">
|
||||||
|
Belépés
|
||||||
|
</Link>
|
||||||
|
</header>
|
||||||
|
)}
|
||||||
|
<main className="page" style={{ maxWidth: 1180 }}>
|
||||||
|
<div className="page-head">
|
||||||
|
<span className="eyebrow">Megosztott születési képlet</span>
|
||||||
|
<h1>{summary?.title ?? "Születési képlet"}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<section className="chart-layout" aria-label="A megosztott képlet">
|
||||||
|
<div className="card chart-wheel-card">
|
||||||
|
<ChartWheel chart={chart} timeKnown={chart.time_known} />
|
||||||
|
<WheelLegend />
|
||||||
|
</div>
|
||||||
|
<div className="field chart-side">
|
||||||
|
<section className="card summary-card" aria-label="Röviden">
|
||||||
|
<span className="eyebrow">Röviden</span>
|
||||||
|
{summary?.summary ? (
|
||||||
|
<p className="summary-text" lang={summary.language}>
|
||||||
|
<Rich text={summary.summary} />
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
<p className="muted">Ehhez a képlethez még nincs rövid összefoglaló.</p>
|
||||||
|
)}
|
||||||
|
{trio.length > 0 && (
|
||||||
|
<p className="share-trio">
|
||||||
|
{trio.map((t) => (
|
||||||
|
<span key={t.label}>
|
||||||
|
<span className="sym" aria-hidden="true">
|
||||||
|
{SIGNS[t.sign]?.glyph}
|
||||||
|
</span>{" "}
|
||||||
|
{t.label} {signName(t.sign)}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
{!chart.time_known && (
|
||||||
|
<p className="hint">A születési idő nem ismert, ezért a képleten nincsenek házak és Aszcendens.</p>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
<section className="card share-cta">
|
||||||
|
<h2>És a te képleted mit mutat?</h2>
|
||||||
|
<p className="muted">
|
||||||
|
Add meg a születési adataidat, és megkapod a saját képletedet a rövid összefoglalóval együtt, ingyen.
|
||||||
|
</p>
|
||||||
|
<Link href={me ? "/keplet" : "/belepes"} className="btn btn-primary">
|
||||||
|
{me ? "A saját képletem" : "Elkészítem a sajátomat"}
|
||||||
|
</Link>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<p className="hint">
|
||||||
|
Ezt a képletet a tulajdonosa osztotta meg, név és születési adatok nélkül. A szöveget mesterséges intelligencia
|
||||||
|
írta a képlet alapján.
|
||||||
|
</p>
|
||||||
|
</main>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,187 @@
|
|||||||
|
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
|
||||||
|
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
|
||||||
|
|
||||||
|
|
||||||
|
Bitstream Vera Fonts Copyright
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
|
||||||
|
a trademark of Bitstream, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of the fonts accompanying this license ("Fonts") and associated
|
||||||
|
documentation files (the "Font Software"), to reproduce and distribute the
|
||||||
|
Font Software, including without limitation the rights to use, copy, merge,
|
||||||
|
publish, distribute, and/or sell copies of the Font Software, and to permit
|
||||||
|
persons to whom the Font Software is furnished to do so, subject to the
|
||||||
|
following conditions:
|
||||||
|
|
||||||
|
The above copyright and trademark notices and this permission notice shall
|
||||||
|
be included in all copies of one or more of the Font Software typefaces.
|
||||||
|
|
||||||
|
The Font Software may be modified, altered, or added to, and in particular
|
||||||
|
the designs of glyphs or characters in the Fonts may be modified and
|
||||||
|
additional glyphs or characters may be added to the Fonts, only if the fonts
|
||||||
|
are renamed to names not containing either the words "Bitstream" or the word
|
||||||
|
"Vera".
|
||||||
|
|
||||||
|
This License becomes null and void to the extent applicable to Fonts or Font
|
||||||
|
Software that has been modified and is distributed under the "Bitstream
|
||||||
|
Vera" names.
|
||||||
|
|
||||||
|
The Font Software may be sold as part of a larger software package but no
|
||||||
|
copy of one or more of the Font Software typefaces may be sold by itself.
|
||||||
|
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
|
||||||
|
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
|
||||||
|
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
|
||||||
|
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||||
|
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
|
||||||
|
FONT SOFTWARE.
|
||||||
|
|
||||||
|
Except as contained in this notice, the names of Gnome, the Gnome
|
||||||
|
Foundation, and Bitstream Inc., shall not be used in advertising or
|
||||||
|
otherwise to promote the sale, use or other dealings in this Font Software
|
||||||
|
without prior written authorization from the Gnome Foundation or Bitstream
|
||||||
|
Inc., respectively. For further information, contact: fonts at gnome dot
|
||||||
|
org.
|
||||||
|
|
||||||
|
Arev Fonts Copyright
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the fonts accompanying this license ("Fonts") and
|
||||||
|
associated documentation files (the "Font Software"), to reproduce
|
||||||
|
and distribute the modifications to the Bitstream Vera Font Software,
|
||||||
|
including without limitation the rights to use, copy, merge, publish,
|
||||||
|
distribute, and/or sell copies of the Font Software, and to permit
|
||||||
|
persons to whom the Font Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright and trademark notices and this permission notice
|
||||||
|
shall be included in all copies of one or more of the Font Software
|
||||||
|
typefaces.
|
||||||
|
|
||||||
|
The Font Software may be modified, altered, or added to, and in
|
||||||
|
particular the designs of glyphs or characters in the Fonts may be
|
||||||
|
modified and additional glyphs or characters may be added to the
|
||||||
|
Fonts, only if the fonts are renamed to names not containing either
|
||||||
|
the words "Tavmjong Bah" or the word "Arev".
|
||||||
|
|
||||||
|
This License becomes null and void to the extent applicable to Fonts
|
||||||
|
or Font Software that has been modified and is distributed under the
|
||||||
|
"Tavmjong Bah Arev" names.
|
||||||
|
|
||||||
|
The Font Software may be sold as part of a larger software package but
|
||||||
|
no copy of one or more of the Font Software typefaces may be sold by
|
||||||
|
itself.
|
||||||
|
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
|
||||||
|
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
|
|
||||||
|
Except as contained in this notice, the name of Tavmjong Bah shall not
|
||||||
|
be used in advertising or otherwise to promote the sale, use or other
|
||||||
|
dealings in this Font Software without prior written authorization
|
||||||
|
from Tavmjong Bah. For further information, contact: tavmjong @ free
|
||||||
|
. fr.
|
||||||
|
|
||||||
|
TeX Gyre DJV Math
|
||||||
|
-----------------
|
||||||
|
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
|
||||||
|
|
||||||
|
Math extensions done by B. Jackowski, P. Strzelczyk and P. Pianowski
|
||||||
|
(on behalf of TeX users groups) are in public domain.
|
||||||
|
|
||||||
|
Letters imported from Euler Fraktur from AMSfonts are (c) American
|
||||||
|
Mathematical Society (see below).
|
||||||
|
Bitstream Vera Fonts Copyright
|
||||||
|
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera
|
||||||
|
is a trademark of Bitstream, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of the fonts accompanying this license (“Fonts”) and associated
|
||||||
|
documentation
|
||||||
|
files (the “Font Software”), to reproduce and distribute the Font Software,
|
||||||
|
including without limitation the rights to use, copy, merge, publish,
|
||||||
|
distribute,
|
||||||
|
and/or sell copies of the Font Software, and to permit persons to whom
|
||||||
|
the Font Software is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright and trademark notices and this permission notice
|
||||||
|
shall be
|
||||||
|
included in all copies of one or more of the Font Software typefaces.
|
||||||
|
|
||||||
|
The Font Software may be modified, altered, or added to, and in particular
|
||||||
|
the designs of glyphs or characters in the Fonts may be modified and
|
||||||
|
additional
|
||||||
|
glyphs or characters may be added to the Fonts, only if the fonts are
|
||||||
|
renamed
|
||||||
|
to names not containing either the words “Bitstream” or the word “Vera”.
|
||||||
|
|
||||||
|
This License becomes null and void to the extent applicable to Fonts or
|
||||||
|
Font Software
|
||||||
|
that has been modified and is distributed under the “Bitstream Vera”
|
||||||
|
names.
|
||||||
|
|
||||||
|
The Font Software may be sold as part of a larger software package but
|
||||||
|
no copy
|
||||||
|
of one or more of the Font Software typefaces may be sold by itself.
|
||||||
|
|
||||||
|
THE FONT SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
|
||||||
|
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
|
||||||
|
FOUNDATION
|
||||||
|
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
|
||||||
|
SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN
|
||||||
|
ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
|
||||||
|
INABILITY TO USE
|
||||||
|
THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
|
Except as contained in this notice, the names of GNOME, the GNOME
|
||||||
|
Foundation,
|
||||||
|
and Bitstream Inc., shall not be used in advertising or otherwise to promote
|
||||||
|
the sale, use or other dealings in this Font Software without prior written
|
||||||
|
authorization from the GNOME Foundation or Bitstream Inc., respectively.
|
||||||
|
For further information, contact: fonts at gnome dot org.
|
||||||
|
|
||||||
|
AMSFonts (v. 2.2) copyright
|
||||||
|
|
||||||
|
The PostScript Type 1 implementation of the AMSFonts produced by and
|
||||||
|
previously distributed by Blue Sky Research and Y&Y, Inc. are now freely
|
||||||
|
available for general use. This has been accomplished through the
|
||||||
|
cooperation
|
||||||
|
of a consortium of scientific publishers with Blue Sky Research and Y&Y.
|
||||||
|
Members of this consortium include:
|
||||||
|
|
||||||
|
Elsevier Science IBM Corporation Society for Industrial and Applied
|
||||||
|
Mathematics (SIAM) Springer-Verlag American Mathematical Society (AMS)
|
||||||
|
|
||||||
|
In order to assure the authenticity of these fonts, copyright will be
|
||||||
|
held by
|
||||||
|
the American Mathematical Society. This is not meant to restrict in any way
|
||||||
|
the legitimate use of the fonts, such as (but not limited to) electronic
|
||||||
|
distribution of documents containing these fonts, inclusion of these fonts
|
||||||
|
into other public domain or commercial font collections or computer
|
||||||
|
applications, use of the outline data to create derivative fonts and/or
|
||||||
|
faces, etc. However, the AMS does require that the AMS copyright notice be
|
||||||
|
removed from any derivative versions of the fonts which have been altered in
|
||||||
|
any way. In addition, to ensure the fidelity of TeX documents using Computer
|
||||||
|
Modern fonts, Professor Donald Knuth, creator of the Computer Modern faces,
|
||||||
|
has requested that any alterations which yield different font metrics be
|
||||||
|
given a different name.
|
||||||
|
|
||||||
|
$Id$
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
Copyright 2015 the Cormorant Project Authors (github.com/CatharsisFonts/Cormorant)
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
https://scripts.sil.org/OFL
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
https://scripts.sil.org/OFL
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
Fonts of the share preview images (`src/app/s/[slug]/kep`), read at run time.
|
||||||
|
|
||||||
|
- Cormorant Garamond SemiBold, Inter Regular and SemiBold: static instances from
|
||||||
|
Google Fonts, SIL Open Font License (LICENSE-OFL-*.txt).
|
||||||
|
- DejaVu Sans 2.37: the zodiac and planet glyphs (LICENSE-DejaVu.txt).
|
||||||
@@ -9,6 +9,7 @@ import { AnalysisLoading } from "./AnalysisLoading";
|
|||||||
import { RegenerateButton } from "./RegenerateButton";
|
import { RegenerateButton } from "./RegenerateButton";
|
||||||
import { RetryNotice } from "./RetryNotice";
|
import { RetryNotice } from "./RetryNotice";
|
||||||
import { Rich } from "./Rich";
|
import { Rich } from "./Rich";
|
||||||
|
import { ShareChart } from "./ShareChart";
|
||||||
import { openTab } from "./Tabs";
|
import { openTab } from "./Tabs";
|
||||||
|
|
||||||
const POLL_MS = 3000;
|
const POLL_MS = 3000;
|
||||||
@@ -81,6 +82,7 @@ export function ChartSummary({
|
|||||||
<p className="summary-text" lang={summary?.language}>
|
<p className="summary-text" lang={summary?.language}>
|
||||||
<Rich text={content.summary ?? ""} />
|
<Rich text={content.summary ?? ""} />
|
||||||
</p>
|
</p>
|
||||||
|
<ShareChart chartId={chartId} />
|
||||||
<a
|
<a
|
||||||
href="#elemzes"
|
href="#elemzes"
|
||||||
className="summary-more"
|
className="summary-more"
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
import { api, errorText } from "@/lib/api";
|
||||||
|
|
||||||
|
interface Share {
|
||||||
|
id: string;
|
||||||
|
url: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Share link of a chart with its short summary: copy, Facebook, the phone's share menu, revoke. */
|
||||||
|
export function ShareChart({ chartId }: { chartId: string }) {
|
||||||
|
const [share, setShare] = useState<Share | null>(null);
|
||||||
|
const [busy, setBusy] = useState(false);
|
||||||
|
const [copied, setCopied] = useState(false);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
const [revoked, setRevoked] = useState(false);
|
||||||
|
|
||||||
|
async function open() {
|
||||||
|
setBusy(true);
|
||||||
|
setError(null);
|
||||||
|
try {
|
||||||
|
setShare(await api<Share>("/shares", { body: { kind: "chart", target_id: chartId } }));
|
||||||
|
setRevoked(false);
|
||||||
|
} catch (e) {
|
||||||
|
setError(errorText(e));
|
||||||
|
} finally {
|
||||||
|
setBusy(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copy() {
|
||||||
|
if (!share) return;
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(share.url);
|
||||||
|
setCopied(true);
|
||||||
|
setTimeout(() => setCopied(false), 2000);
|
||||||
|
} catch {
|
||||||
|
setError("Nem sikerült másolni; jelöld ki a linket, és másold kézzel.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function nativeShare() {
|
||||||
|
if (!share) return;
|
||||||
|
try {
|
||||||
|
await navigator.share({ url: share.url });
|
||||||
|
} catch {
|
||||||
|
// closed by the user
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function revoke() {
|
||||||
|
if (!share || !window.confirm("Visszavonod a linket? Aki megkapta, többé nem tudja megnyitni.")) return;
|
||||||
|
setBusy(true);
|
||||||
|
try {
|
||||||
|
await api(`/shares/${share.id}`, { method: "DELETE" });
|
||||||
|
setShare(null);
|
||||||
|
setRevoked(true);
|
||||||
|
} catch (e) {
|
||||||
|
setError(errorText(e));
|
||||||
|
} finally {
|
||||||
|
setBusy(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!share) {
|
||||||
|
return (
|
||||||
|
<div className="share">
|
||||||
|
<button type="button" className="btn btn-sm" onClick={open} disabled={busy}>
|
||||||
|
{busy ? "Link készül…" : "Megosztás"}
|
||||||
|
</button>
|
||||||
|
{revoked && <p className="hint">A linket visszavontad.</p>}
|
||||||
|
{error && (
|
||||||
|
<p className="msg msg-error" role="alert">
|
||||||
|
{error}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const facebook = `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(share.url)}`;
|
||||||
|
return (
|
||||||
|
<div className="share share-open">
|
||||||
|
<p className="hint">
|
||||||
|
A linken a képleted rajza és ez az összefoglaló látszik, név és születési adatok nélkül. Bárki megnyithatja,
|
||||||
|
akinek elküldöd.
|
||||||
|
</p>
|
||||||
|
<div className="share-link">
|
||||||
|
<input
|
||||||
|
className="inp"
|
||||||
|
readOnly
|
||||||
|
value={share.url}
|
||||||
|
aria-label="Megosztási link"
|
||||||
|
onFocus={(e) => e.currentTarget.select()}
|
||||||
|
/>
|
||||||
|
<button type="button" className="btn btn-sm" onClick={copy}>
|
||||||
|
{copied ? "Kimásolva" : "Másolás"}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="form-actions">
|
||||||
|
<a className="btn btn-sm btn-primary" href={facebook} target="_blank" rel="noopener noreferrer">
|
||||||
|
Megosztás Facebookon
|
||||||
|
</a>
|
||||||
|
{typeof navigator !== "undefined" && "share" in navigator && (
|
||||||
|
<button type="button" className="btn btn-sm" onClick={nativeShare}>
|
||||||
|
Küldés…
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
<button type="button" className="btn btn-sm btn-ghost" onClick={revoke} disabled={busy}>
|
||||||
|
Link visszavonása
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{error && (
|
||||||
|
<p className="msg msg-error" role="alert">
|
||||||
|
{error}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
// Public share links (`/s/<slug>`): loading the shared content and the
|
||||||
|
// texts of the page, its link preview and its preview image.
|
||||||
|
import "server-only";
|
||||||
|
|
||||||
|
import { headers } from "next/headers";
|
||||||
|
import { cache } from "react";
|
||||||
|
|
||||||
|
import { BACKEND_URL } from "./server";
|
||||||
|
import type { ChartResult } from "./types";
|
||||||
|
|
||||||
|
export interface PublicSummary {
|
||||||
|
id: string;
|
||||||
|
language: string;
|
||||||
|
title: string | null;
|
||||||
|
summary: string | null;
|
||||||
|
completed_at: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** `GET /v1/public/shares/{slug}` of a shared chart. */
|
||||||
|
export interface PublicShare {
|
||||||
|
kind: "chart" | "synastry" | "analysis";
|
||||||
|
title: string | null;
|
||||||
|
created_at: string;
|
||||||
|
chart?: { label: string; chart: ChartResult & { time_known: boolean } };
|
||||||
|
summary?: PublicSummary | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SLUG = /^[A-Za-z0-9_-]{8,64}$/;
|
||||||
|
|
||||||
|
/** The shared content, or `null` if the link is unknown or revoked (one backend call per request). */
|
||||||
|
export const loadShare = cache(async (slug: string): Promise<PublicShare | null> => {
|
||||||
|
if (!SLUG.test(slug)) return null;
|
||||||
|
const res = await fetch(`${BACKEND_URL}/v1/public/shares/${slug}`, { cache: "no-store" });
|
||||||
|
if (res.status === 404) return null;
|
||||||
|
if (!res.ok) throw new Error(`share ${slug}: HTTP ${res.status}`);
|
||||||
|
return (await res.json()) as PublicShare;
|
||||||
|
});
|
||||||
|
|
||||||
|
/** The site's own address, for absolute links in the preview tags. */
|
||||||
|
export async function siteUrl(): Promise<string> {
|
||||||
|
const fixed = process.env.PUBLIC_BASE_URL;
|
||||||
|
if (fixed) return fixed.replace(/\/$/, "");
|
||||||
|
const h = await headers();
|
||||||
|
const host = h.get("x-forwarded-host") ?? h.get("host") ?? "localhost:3001";
|
||||||
|
const proto = h.get("x-forwarded-proto") ?? (host.startsWith("localhost") ? "http" : "https");
|
||||||
|
return `${proto}://${host}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Model text without the `**bold**` marks. */
|
||||||
|
export function plain(text: string): string {
|
||||||
|
return text.replace(/\*\*/g, "").replace(/\s+/g, " ").trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** At most `max` characters, cut at a word, with an ellipsis. */
|
||||||
|
export function shorten(text: string, max: number): string {
|
||||||
|
if (text.length <= max) return text;
|
||||||
|
const cut = text.slice(0, max - 1);
|
||||||
|
const space = cut.lastIndexOf(" ");
|
||||||
|
return `${(space > max * 0.6 ? cut.slice(0, space) : cut).replace(/[\s,;:–-]+$/, "")}…`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Changes whenever the summary is rewritten, so link previews fetch the new image. */
|
||||||
|
export function imageVersion(share: PublicShare): string {
|
||||||
|
const s = share.summary;
|
||||||
|
if (!s) return "kep";
|
||||||
|
const time = s.completed_at ? Date.parse(s.completed_at).toString(36) : "0";
|
||||||
|
return `${s.id.replace(/-/g, "").slice(-8)}${time}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** "Nap Nyilas · Hold Bika · Aszcendens Mérleg" (the ascendant only with a known time). */
|
||||||
|
export function bigThree(chart: ChartResult & { time_known: boolean }): { label: string; sign: string }[] {
|
||||||
|
const sign = (id: string) => chart.points.find((p) => p.id === id)?.sign;
|
||||||
|
const asc = chart.angles?.ascendant;
|
||||||
|
const out: { label: string; sign: string }[] = [];
|
||||||
|
const sun = sign("sun");
|
||||||
|
const moon = sign("moon");
|
||||||
|
if (sun) out.push({ label: "Nap", sign: sun });
|
||||||
|
if (moon) out.push({ label: "Hold", sign: moon });
|
||||||
|
if (chart.time_known && typeof asc === "object" && asc) out.push({ label: "Aszcendens", sign: asc.sign });
|
||||||
|
return out;
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
// The chart wheel as a standalone SVG document, for the share preview image.
|
||||||
|
// It reuses the page's <ChartWheel> and turns its element tree into markup
|
||||||
|
// with the colours inlined (no page CSS there).
|
||||||
|
import { Fragment, isValidElement, type ReactElement, type ReactNode } from "react";
|
||||||
|
|
||||||
|
import { ChartWheel, SIZE } from "@/components/ChartWheel";
|
||||||
|
import type { ChartResult } from "@/lib/types";
|
||||||
|
|
||||||
|
// The page's wheel rules (globals.css) with the colour tokens resolved.
|
||||||
|
const STYLE = `
|
||||||
|
.w-ring{fill:none;stroke:#2c3654;stroke-width:1.2}
|
||||||
|
.w-faint{stroke:#1f2740}
|
||||||
|
.w-inner{fill:#0f1426}
|
||||||
|
.w-sign{stroke:#2c3654;stroke-width:1}
|
||||||
|
.w-fire{fill:rgba(227,139,106,.09)}
|
||||||
|
.w-earth{fill:rgba(159,216,176,.07)}
|
||||||
|
.w-air{fill:rgba(217,180,106,.08)}
|
||||||
|
.w-water{fill:rgba(127,176,224,.09)}
|
||||||
|
.w-sign-glyph{fill:#d9b46a;font-family:'DejaVu Sans';font-size:22px}
|
||||||
|
.w-tick,.w-cusp{stroke:#2c3654;stroke-width:1}
|
||||||
|
.w-axis{stroke:#d9b46a;stroke-width:1.8}
|
||||||
|
.w-axis-label{fill:#d9b46a;font-family:Inter;font-weight:600;font-size:14px}
|
||||||
|
.w-house-num{fill:#a3abc0;font-family:Inter;font-size:12px}
|
||||||
|
.w-aspect{stroke-linecap:round}
|
||||||
|
.w-asp-trine{stroke:#7fb0e0}
|
||||||
|
.w-asp-sextile{stroke:#7fb0e0;stroke-dasharray:5 4}
|
||||||
|
.w-asp-square{stroke:#f0a35e}
|
||||||
|
.w-asp-opposition{stroke:#e38b8b}
|
||||||
|
.w-point-tick{stroke:#ece6d8;stroke-width:1.6}
|
||||||
|
.w-leader{stroke:#a3abc0;stroke-width:.7;stroke-opacity:.6}
|
||||||
|
.w-point-glyph{fill:#ece6d8;font-family:'DejaVu Sans';font-size:22px}
|
||||||
|
.w-point-deg{fill:#a3abc0;font-family:Inter;font-size:10.5px}
|
||||||
|
.w-end{fill:#c9cfdc}
|
||||||
|
.w-point-glyph,.w-point-deg,.w-house-num,.w-axis-label{paint-order:stroke;stroke:#111729;stroke-width:4px;stroke-linejoin:round}
|
||||||
|
`;
|
||||||
|
|
||||||
|
// React prop names that are not SVG attributes (or not wanted in the image).
|
||||||
|
const SKIP = new Set(["children", "key", "role", "id"]);
|
||||||
|
|
||||||
|
const escape = (s: string) =>
|
||||||
|
s.replace(/︎/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
||||||
|
|
||||||
|
function attribute(name: string): string {
|
||||||
|
if (name === "className") return "class";
|
||||||
|
if (name === "viewBox") return name;
|
||||||
|
return name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function markup(node: ReactNode): string {
|
||||||
|
if (node === null || node === undefined || typeof node === "boolean") return "";
|
||||||
|
if (typeof node === "string" || typeof node === "number") return escape(String(node));
|
||||||
|
if (Array.isArray(node)) return node.map(markup).join("");
|
||||||
|
if (!isValidElement(node)) return "";
|
||||||
|
const { type, props } = node as ReactElement<Record<string, unknown>>;
|
||||||
|
if (type === Fragment) return markup(props.children as ReactNode);
|
||||||
|
if (typeof type === "function") return markup((type as (p: unknown) => ReactNode)(props));
|
||||||
|
if (typeof type !== "string" || type === "title" || type === "desc") return "";
|
||||||
|
const attrs = Object.entries(props)
|
||||||
|
.filter(([k, v]) => !SKIP.has(k) && !k.startsWith("aria-") && v !== undefined && v !== null && v !== false)
|
||||||
|
.map(([k, v]) => ` ${attribute(k)}="${escape(String(v))}"`)
|
||||||
|
.join("");
|
||||||
|
return `<${type}${attrs}>${markup(props.children as ReactNode)}</${type}>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The wheel as an SVG document of `size` pixels. */
|
||||||
|
export function wheelSvg(chart: ChartResult, timeKnown: boolean, size = SIZE): string {
|
||||||
|
const body = markup(ChartWheel({ chart, timeKnown }))
|
||||||
|
.replace(/^<svg[^>]*>/, "")
|
||||||
|
.replace(/<\/svg>$/, "");
|
||||||
|
return (
|
||||||
|
`<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${SIZE} ${SIZE}">` +
|
||||||
|
`<style>${STYLE}</style>${body}</svg>`
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user