Compare commits

..
Author SHA1 Message Date
fecoandClaude Opus 5.5 9331573890 Merge main into prod: password login, free birth chart, sign pages, legal pages, Telegram notices
CI / test (push) Successful in 1m43s
CI / build (push) Successful in 25s
CI / deploy (push) Successful in 37s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-22 09:53:45 +00:00
feco 85aa3fc5b1 Merge main: optional Beszel monitoring agent
CI / test (push) Successful in 1m31s
CI / build (push) Successful in 33s
CI / deploy (push) Successful in 34s
2026-11-21 10:16:21 +00:00
feco cf4d419e52 Merge main into prod: Hungarian birth date and time fields
CI / test (push) Successful in 1m36s
CI / build (push) Successful in 21s
CI / deploy (push) Successful in 37s
2026-11-20 21:34:50 +00:00
feco 810de0cb24 Merge main into prod: review fixes
CI / test (push) Successful in 1m38s
CI / build (push) Successful in 2m6s
CI / deploy (push) Successful in 52s
2026-11-20 20:43:51 +00:00
feco e68f7407f3 Merge main into prod: Sign in with Apple
CI / build (push) Successful in 24s
CI / deploy (push) Successful in 43s
CI / test (push) Successful in 1m34s
2026-11-20 19:42:27 +00:00
feco ad436f786c Merge main into prod: log review fixes, graceful worker stop
CI / deploy (push) Successful in 42s
CI / test (push) Successful in 1m32s
CI / build (push) Successful in 24s
2026-11-20 19:09:37 +00:00
feco a2649fddeb Merge main into prod: account menu, persistent logs, softer copy
CI / test (push) Successful in 1m33s
CI / build (push) Successful in 25s
CI / deploy (push) Successful in 1m20s
2026-11-20 17:51:25 +00:00
feco f69f76a05a Merge main into prod: tarot on the home page, footer and description
CI / build (push) Successful in 23s
CI / deploy (push) Successful in 1m0s
CI / test (push) Successful in 1m31s
2026-11-20 17:11:18 +00:00
feco 1a75dec59a Merge main into prod: tarot topics, Párkapcsolat example tab
CI / test (push) Successful in 1m29s
CI / build (push) Successful in 22s
CI / deploy (push) Successful in 40s
2026-11-20 16:25:13 +00:00
sagifer 663ceaca16 Merge pull request 'Tarot example: the draw played as an animation, and a love reading' (#31) from main into prod
CI / build (push) Successful in 1m35s
CI / deploy (push) Successful in 52s
CI / test (push) Successful in 1m29s
Reviewed-on: #31
2026-11-20 16:54:03 +01:00
feco 22d2484cab Merge main into prod: tarot readings, ÁSZF consent off until the opening
CI / test (push) Successful in 1m34s
CI / build (push) Successful in 23s
CI / deploy (push) Successful in 39s
2026-11-20 14:54:53 +00:00
sagifer 1af7415add Merge pull request 'ÁSZF: terms page, consent on every purchase, confirmation e-mail' (#30) from main into prod
CI / test (push) Successful in 1m30s
CI / build (push) Successful in 2m8s
CI / deploy (push) Successful in 48s
Reviewed-on: #30
2026-11-20 13:17:15 +01:00
fecoandClaude Opus 5.5 71177f749c Merge main into prod: invoice test payments, admins use units
CI / test (push) Successful in 1m26s
CI / build (push) Successful in 22s
CI / deploy (push) Successful in 52s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-20 10:59:17 +00:00
sagifer bbfa5b28c3 Merge pull request 'Invoice every payment again, test payments included' (#29) from main into prod
CI / test (push) Successful in 1m29s
CI / build (push) Successful in 1m50s
CI / deploy (push) Successful in 55s
Reviewed-on: #29
2026-11-20 11:09:30 +01:00
fecoandClaude Opus 5.5 ba11eda64c Merge main into prod: invoice fixes
CI / test (push) Successful in 1m28s
CI / build (push) Successful in 19s
CI / deploy (push) Successful in 34s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-20 08:56:08 +00:00
fecoandClaude Opus 5.5 174ec31351 Merge main into prod: migration fix (site down)
CI / test (push) Successful in 1m28s
CI / build (push) Successful in 21s
CI / deploy (push) Successful in 33s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-20 08:18:56 +00:00
fecoandClaude Opus 5.5 27ecdf386e Merge main into prod
CI / test (push) Successful in 1m29s
CI / build (push) Successful in 2m2s
CI / deploy (push) Failing after 34s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-20 08:05:38 +00:00
sagifer 5e633b959d Merge pull request 'Main' (#28) from main into prod
CI / test (push) Successful in 1m29s
CI / build (push) Successful in 2m29s
CI / deploy (push) Successful in 50s
Reviewed-on: #28
2026-11-20 08:01:11 +01:00
sagifer a4df094191 Merge pull request 'Sitemap for the public pages, linked from robots.txt' (#27) from main into prod
CI / test (push) Successful in 1m18s
CI / build (push) Successful in 21s
CI / deploy (push) Successful in 37s
Reviewed-on: #27
2026-11-20 03:15:22 +01:00
sagifer 15c88fc6be Merge pull request 'Form fields: room in text areas, our own select chevron' (#26) from main into prod
CI / test (push) Successful in 1m21s
CI / build (push) Successful in 22s
CI / deploy (push) Successful in 36s
Reviewed-on: #26
2026-11-19 21:38:23 +01:00
sagifer ddca7acbd4 Merge pull request 'Chart page: a balanced layout around the wheel' (#25) from main into prod
CI / test (push) Successful in 1m18s
CI / build (push) Successful in 20s
CI / deploy (push) Successful in 38s
Reviewed-on: #25
2026-11-19 19:36:31 +01:00
sagifer fd655952b6 Merge pull request 'The logo mark next to the wordmark' (#24) from main into prod
CI / test (push) Successful in 1m19s
CI / build (push) Successful in 22s
CI / deploy (push) Successful in 37s
Reviewed-on: #24
2026-11-19 18:41:57 +01:00
feco b672b1cefa Merge main into prod: favicon and footer logos
CI / test (push) Successful in 1m19s
CI / build (push) Successful in 20s
CI / deploy (push) Successful in 38s
2026-11-19 15:37:37 +00:00
sagifer f2953dd18f Merge pull request 'Main' (#23) from main into prod
CI / test (push) Successful in 1m15s
CI / build (push) Successful in 24s
CI / deploy (push) Successful in 37s
Reviewed-on: #23
2026-11-19 14:31:47 +01:00
feco 0c4274d87b Merge main into prod: home page AI note
CI / test (push) Successful in 1m22s
CI / build (push) Successful in 20s
CI / deploy (push) Successful in 37s
2026-11-19 12:09:01 +00:00
sagifer 4a2a84b36f Merge pull request 'Logging out (and deleting the account) leads to the home page' (#22) from main into prod
CI / test (push) Successful in 1m19s
CI / build (push) Successful in 1m36s
CI / deploy (push) Successful in 37s
Reviewed-on: #22
2026-11-19 13:05:05 +01:00
sagifer 3944c6a4b0 Merge pull request 'Main' (#21) from main into prod
CI / test (push) Successful in 1m15s
CI / build (push) Successful in 22s
CI / deploy (push) Successful in 37s
Reviewed-on: #21
2026-11-19 12:54:15 +01:00
sagifer a352e359c4 Merge pull request 'Main' (#20) from main into prod
CI / test (push) Successful in 1m23s
CI / build (push) Successful in 22s
CI / deploy (push) Successful in 36s
Reviewed-on: #20
2026-11-19 12:29:51 +01:00
sagifer d9ca806d50 Merge pull request 'a' (#19) from main into prod
CI / test (push) Successful in 1m11s
CI / build (push) Successful in 20s
CI / deploy (push) Successful in 38s
Reviewed-on: #19
2026-11-19 10:35:29 +01:00
sagifer f037522052 Merge pull request 'Sharing a chart with its short summary, with link previews' (#18) from main into prod
CI / test (push) Successful in 1m9s
CI / build (push) Successful in 21s
CI / deploy (push) Successful in 41s
Reviewed-on: #18
2026-11-19 09:11:59 +01:00
sagifer e476117c77 Merge pull request 'Main' (#17) from main into prod
CI / test (push) Successful in 1m9s
CI / build (push) Successful in 56s
CI / deploy (push) Successful in 34s
Reviewed-on: #17
2026-11-19 08:13:18 +01:00
sagifer d758f5bf12 Merge pull request 'Frontend: justified generated text, mobile layout without sideways scrolling' (#16) from main into prod
CI / test (push) Successful in 1m7s
CI / build (push) Successful in 21s
CI / deploy (push) Successful in 51s
Reviewed-on: #16
2026-11-19 07:15:09 +01:00
fecoandClaude Opus 5.5 8b2c4310ba Merge main into prod: restart running generations, error log, retry notice, questions on relationship analyses
CI / test (push) Successful in 1m7s
CI / build (push) Successful in 19s
CI / deploy (push) Successful in 52s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-18 21:51:39 +00:00
fecoandClaude Opus 5.5 1c24b9a23f Merge main into prod: model functions (analyses, answers, summary), Opus 5.5 default and fallback
CI / test (push) Successful in 1m0s
CI / build (push) Successful in 19s
CI / deploy (push) Successful in 53s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-18 21:14:13 +00:00
fecoandClaude Opus 5.5 86758cf848 Merge main into prod: worker room and time for reasoning models
CI / test (push) Successful in 1m0s
CI / build (push) Successful in 20s
CI / deploy (push) Successful in 35s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-18 19:52:02 +00:00
sagifer 39d75eddbd Merge pull request 'Main' (#15) from main into prod
CI / test (push) Successful in 1m3s
CI / build (push) Successful in 21s
CI / deploy (push) Successful in 44s
Reviewed-on: #15
2026-11-18 20:02:23 +01:00
sagifer f4ee40f45d Merge pull request 'Hungarian prompts in Hungarian, model choice per analysis kind, admin regenerate' (#14) from main into prod
CI / test (push) Successful in 58s
CI / build (push) Successful in 15s
CI / deploy (push) Successful in 39s
Reviewed-on: #14
2026-11-18 18:48:09 +01:00
sagifer 422078545e Merge pull request 'Quincunx in the default aspects, sign-based moon phases, backend recalculate command' (#13) from main into prod
CI / test (push) Successful in 57s
CI / build (push) Successful in 23s
CI / deploy (push) Successful in 39s
Reviewed-on: #13
2026-11-18 13:20:31 +01:00
sagifer 2a7cb467cf Merge pull request 'Main' (#12) from main into prod
CI / test (push) Successful in 55s
CI / build (push) Successful in 13s
CI / deploy (push) Successful in 36s
Reviewed-on: #12
2026-11-18 12:41:13 +01:00
sagifer c20ab45c9d Merge pull request 'Yearly forecast: solar return, transits, progressions, profection, eclipses' (#11) from main into prod
CI / test (push) Successful in 58s
CI / build (push) Successful in 43s
CI / deploy (push) Successful in 50s
Reviewed-on: #11
2026-11-18 09:45:53 +01:00
sagifer cf625abff2 Merge pull request 'Main' (#10) from main into prod
CI / test (push) Successful in 51s
CI / build (push) Successful in 12s
CI / deploy (push) Successful in 40s
Reviewed-on: #10
2026-11-18 07:35:17 +01:00
sagifer 85977cb7af Merge pull request 'Header shows the user's package and what is left of it' (#9) from main into prod
CI / test (push) Successful in 50s
CI / build (push) Successful in 13s
CI / deploy (push) Successful in 38s
Reviewed-on: #9
2026-11-17 21:05:49 +01:00
sagifer 2032837aad Merge pull request 'Main' (#7) from main into prod
CI / test (push) Successful in 57s
CI / build (push) Successful in 1m20s
CI / deploy (push) Successful in 42s
Reviewed-on: #7
2026-11-17 19:58:35 +01:00
sagifer a097cf4311 Merge pull request 'Main' (#6) from main into prod
CI / test (push) Successful in 45s
CI / build (push) Successful in 13s
CI / deploy (push) Successful in 41s
Reviewed-on: #6
2026-11-17 17:45:40 +01:00
sagifer bf7fb937d2 Merge pull request 'Worker tests: set the chart kind (charts_primary_is_own)' (#5) from main into prod
CI / test (push) Successful in 44s
CI / build (push) Successful in 13s
CI / deploy (push) Successful in 38s
Reviewed-on: #5
2026-11-17 13:25:02 +01:00
sagifer a8ce5490c8 Merge pull request 'Main' (#4) from main into prod
CI / test (push) Failing after 43s
CI / build (push) Skipped
CI / deploy (push) Skipped
Reviewed-on: #4
2026-11-17 13:15:24 +01:00
sagifer b0b0347b04 Merge pull request 'Main' (#3) from main into prod
CI / test (push) Successful in 39s
CI / build (push) Successful in 39s
CI / deploy (push) Successful in 42s
Reviewed-on: #3
2026-11-17 11:24:13 +01:00
sagifer a75712a60a Merge pull request 'Aspect grid: the usual triangular matrix, values in collapsible details' (#2) from main into prod
CI / test (push) Successful in 40s
CI / build (push) Successful in 13s
CI / deploy (push) Successful in 44s
Reviewed-on: #2
2026-11-17 10:51:21 +01:00
sagifer e08b6121a2 Merge pull request 'Main' (#1) from main into prod
CI / test (push) Successful in 39s
CI / build (push) Successful in 13s
CI / deploy (push) Successful in 38s
Reviewed-on: #1
2026-11-17 08:04:09 +01:00
15 changed files with 31 additions and 139 deletions
+2 -2
View File
@@ -147,10 +147,10 @@ pub fn removal_cookie(config: &Config) -> Cookie<'static> {
pub fn validate_password(password: &str) -> Result<(), ApiError> {
let len = password.chars().count();
if len < MIN_PASSWORD_LEN {
return Err(ApiError::BadRequest(format!("A jelszó legalább {MIN_PASSWORD_LEN} karakter legyen.")));
return Err(ApiError::BadRequest(format!("the password must be at least {MIN_PASSWORD_LEN} characters long")));
}
if len > MAX_PASSWORD_LEN {
return Err(ApiError::BadRequest(format!("A jelszó legfeljebb {MAX_PASSWORD_LEN} karakter lehet.")));
return Err(ApiError::BadRequest(format!("the password must be at most {MAX_PASSWORD_LEN} characters long")));
}
Ok(())
}
+2 -2
View File
@@ -25,11 +25,11 @@ pub enum ApiError {
Conflict { code: &'static str, message: String },
#[error("{0}")]
Gone(String),
#[error("Ez a link érvénytelen vagy lejárt.")]
#[error("the link is invalid or has expired")]
InvalidToken,
#[error("no {unit} analysis left (balance {balance})")]
InsufficientCredits { unit: &'static str, balance: i64 },
#[error("Túl sok próbálkozás. Próbáld újra később.")]
#[error("too many attempts; try again later")]
TooManyRequests,
/// A usage limit; the message is shown to the user as is.
#[error("{message}")]
+6 -17
View File
@@ -18,11 +18,6 @@ const GOOGLE_ISSUERS: &[&str] = &["accounts.google.com", "https://accounts.googl
const APPLE_ISSUERS: &[&str] = &["https://appleid.apple.com"];
const JWKS_MAX_AGE: Duration = Duration::from_secs(3600);
/// What the user sees when a token is rejected; the reason goes to the log.
fn failed(provider: &str) -> ApiError {
ApiError::InvalidCredentials(format!("Nem sikerült a belépés {provider}-fiókkal. Próbáld újra."))
}
#[derive(Debug, Deserialize)]
pub struct IdClaims {
/// Stable account id at the provider.
@@ -116,8 +111,7 @@ impl IdTokenVerifier {
let found = keys.iter().find(|k| k.kid == kid).cloned();
*self.cache.write().await = Some((Instant::now(), keys));
found.ok_or_else(|| {
tracing::warn!(provider = self.provider, "id token signed with an unknown key");
failed(self.provider)
ApiError::InvalidCredentials(format!("the {} token is signed with an unknown key", self.provider))
})
}
@@ -126,19 +120,14 @@ impl IdTokenVerifier {
if !self.enabled() {
return Err(ApiError::Forbidden(format!("{provider} login is not configured")));
}
let invalid = |e: jsonwebtoken::errors::Error| {
tracing::warn!(provider, error = %e, "invalid id token");
failed(provider)
};
let invalid =
|e: jsonwebtoken::errors::Error| ApiError::InvalidCredentials(format!("invalid {provider} token: {e}"));
let header = decode_header(id_token).map_err(invalid)?;
if header.alg != Algorithm::RS256 {
tracing::warn!(provider, alg = ?header.alg, "id token with an unexpected algorithm");
return Err(failed(provider));
return Err(ApiError::InvalidCredentials(format!("invalid {provider} token: unexpected algorithm")));
}
let kid = header.kid.ok_or_else(|| {
tracing::warn!(provider, "id token without a key id");
failed(provider)
})?;
let kid =
header.kid.ok_or_else(|| ApiError::InvalidCredentials(format!("invalid {provider} token: no key id")))?;
let jwk = self.key(&kid).await?;
let key = DecodingKey::from_rsa_components(&jwk.n, &jwk.e).map_err(invalid)?;
let mut validation = Validation::new(Algorithm::RS256);
+2 -2
View File
@@ -113,9 +113,9 @@ pub async fn change_password(
.await?;
if let Some((hash,)) = existing {
let current =
req.current_password.ok_or_else(|| ApiError::BadRequest("Add meg a jelenlegi jelszavadat.".into()))?;
req.current_password.ok_or_else(|| ApiError::BadRequest("current_password is required".into()))?;
if !verify_password(current, hash).await? {
return Err(ApiError::InvalidCredentials("A jelenlegi jelszó hibás.".into()));
return Err(ApiError::InvalidCredentials("the current password is wrong".into()));
}
}
let hash = hash_password(req.new_password).await?;
+3 -5
View File
@@ -45,7 +45,7 @@ pub fn normalize_email(email: &str) -> Result<String, ApiError> {
!local.is_empty() && domain.contains('.') && !domain.starts_with('.') && !domain.ends_with('.')
})
&& !email.chars().any(char::is_whitespace);
if valid { Ok(email) } else { Err(ApiError::BadRequest("Érvénytelen e-mail-cím.".into())) }
if valid { Ok(email) } else { Err(ApiError::BadRequest("invalid e-mail address".into())) }
}
pub fn validate_locale(state: &AppState, locale: Option<&str>) -> Result<String, ApiError> {
@@ -288,7 +288,7 @@ pub async fn login(
WithRejection(Json(req), _): Body<LoginRequest>,
) -> ApiResult<impl IntoResponse> {
password_login_enabled(&state)?;
let invalid = || ApiError::InvalidCredentials("Hibás e-mail-cím vagy jelszó.".into());
let invalid = || ApiError::InvalidCredentials("wrong e-mail address or password".into());
let email = normalize_email(&req.email).map_err(|_| invalid())?;
state.login_limiter.check(&email)?;
@@ -405,9 +405,7 @@ async fn social_login(
let email = match (claims.email.as_deref(), claims.email_verified) {
(Some(e), true) => normalize_email(e)?,
_ => {
return Err(ApiError::InvalidCredentials(format!(
"A {provider}-fiókodhoz nem tartozik megerősített e-mail-cím."
)));
return Err(ApiError::InvalidCredentials(format!("the {provider} account has no verified e-mail address")));
}
};
+1 -1
View File
@@ -42,7 +42,7 @@ pub async fn places(
) -> ApiResult<Json<Value>> {
let q = query.q.trim();
if !valid_country(&query.country) || q.chars().count() < 2 || q.chars().count() > 80 {
return Err(ApiError::BadRequest("Válassz országot, és írj be 2–80 karaktert a település nevéből.".into()));
return Err(ApiError::BadRequest("a country code and 2 to 80 characters of a place name are needed".into()));
}
state.places_limiter.hit(&visitor(&headers))?;
Ok(Json(state.horoscope.places(&query.country, q, query.limit.unwrap_or(8).min(10)).await?))
+2 -2
View File
@@ -97,7 +97,7 @@ pub async fn primary_chart(db: &PgPool, owner: Uuid) -> Result<Option<ChartRow>,
fn clean_label(label: &str) -> Result<String, ApiError> {
let label: String = label.trim().chars().take(100).collect();
if label.is_empty() { Err(ApiError::BadRequest("A név nem lehet üres.".into())) } else { Ok(label) }
if label.is_empty() { Err(ApiError::BadRequest("label must not be empty".into())) } else { Ok(label) }
}
pub async fn list(State(state): St, auth: AuthUser) -> ApiResult<Json<Value>> {
@@ -195,7 +195,7 @@ pub async fn create(
if count >= state.config.max_charts_per_user {
return Err(ApiError::conflict(
"chart_limit_reached",
format!("Legfeljebb {} képletet lehet menteni.", state.config.max_charts_per_user),
format!("at most {} charts can be saved", state.config.max_charts_per_user),
));
}
let free = state.config.free_person_slots;
+1 -1
View File
@@ -221,7 +221,7 @@ pub async fn create(
if count >= MAX_PER_CHART && !is_admin(&auth) {
return Err(ApiError::conflict(
"forecast_limit_reached",
format!("Egy képlethez legfeljebb {MAX_PER_CHART} előrejelzés menthető."),
format!("at most {MAX_PER_CHART} forecasts can be saved for a chart"),
));
}
+2 -2
View File
@@ -115,7 +115,7 @@ pub async fn ask(
return Err(ApiError::NotFound("analysis"));
}
if !ASKABLE.contains(&analysis.kind.as_str()) {
return Err(ApiError::BadRequest("Kérdést részletes elemzésről vagy előrejelzésről lehet feltenni.".into()));
return Err(ApiError::BadRequest("questions can be asked about a detailed analysis or a forecast".into()));
}
if analysis.status != "done" {
return Err(ApiError::conflict("analysis_not_ready", "Az elemzés még nem készült el."));
@@ -123,7 +123,7 @@ pub async fn ask(
let question = req.question.trim().replace("\r\n", "\n");
let length = question.chars().count();
if !(3..=QUESTION_MAX_CHARS).contains(&length) {
return Err(ApiError::BadRequest(format!("A kérdés 3–{QUESTION_MAX_CHARS} karakter hosszú lehet.")));
return Err(ApiError::BadRequest(format!("the question must be 3 to {QUESTION_MAX_CHARS} characters long")));
}
let (open, total): (i64, i64) = sqlx::query_as(
"SELECT count(*) FILTER (WHERE status IN ('pending', 'running')), count(*) FROM questions WHERE analysis_id = $1",
+1 -1
View File
@@ -155,7 +155,7 @@ pub async fn create(
return Err(ApiError::NotFound("analysis"));
}
if analysis.status != "done" {
return Err(ApiError::conflict("analysis_not_ready", "Csak elkészült elemzést lehet megosztani."));
return Err(ApiError::conflict("analysis_not_ready", "only finished analyses can be shared"));
}
(None, None, Some(req.target_id), "analysis")
}
+8 -8
View File
@@ -210,7 +210,7 @@ pub async fn create(
WithRejection(Json(req), _): Body<CreateSynastry>,
) -> ApiResult<(StatusCode, Json<Value>)> {
if req.chart1_id == req.chart2_id {
return Err(ApiError::BadRequest("Egy képletet önmagával nem lehet összevetni.".into()));
return Err(ApiError::BadRequest("a chart cannot be compared with itself".into()));
}
let chart1 = owned_chart(&state.db, req.chart1_id, auth.id()).await?;
let chart2 = owned_chart(&state.db, req.chart2_id, auth.id()).await?;
@@ -249,9 +249,9 @@ pub struct CreateInvite {
async fn chart_or_primary(db: &PgPool, chart_id: Option<Uuid>, user: Uuid) -> Result<ChartRow, ApiError> {
match chart_id {
Some(id) => owned_chart(db, id, user).await,
None => primary_chart(db, user)
.await?
.ok_or_else(|| ApiError::conflict("primary_chart_required", "Előbb add meg a saját születési adataidat.")),
None => primary_chart(db, user).await?.ok_or_else(|| {
ApiError::conflict("primary_chart_required", "create your own chart first (is_primary: true)")
}),
}
}
@@ -459,12 +459,12 @@ pub async fn accept_invite(
) -> ApiResult<(StatusCode, Json<Value>)> {
let invite = invite_by_token(&state.db, &req.token).await?;
match invite_status(invite.accepted_at, invite.expires_at) {
"accepted" => return Err(ApiError::Gone("Ezt a meghívót már elfogadták.".into())),
"expired" => return Err(ApiError::Gone("Ez a meghívó lejárt.".into())),
"accepted" => return Err(ApiError::Gone("this invitation has already been accepted".into())),
"expired" => return Err(ApiError::Gone("this invitation has expired".into())),
_ => {}
}
if invite.inviter_id == auth.id() {
return Err(ApiError::conflict("own_invitation", "A saját meghívódat nem fogadhatod el."));
return Err(ApiError::conflict("own_invitation", "you cannot accept your own invitation"));
}
let my_chart = chart_or_primary(&state.db, req.chart_id, auth.id()).await?;
let inviter_chart =
@@ -489,7 +489,7 @@ pub async fn accept_invite(
if created {
sqlx::query("DELETE FROM synastries WHERE id = $1").bind(row.id).execute(&state.db).await?;
}
return Err(ApiError::Gone("Ezt a meghívót már elfogadták.".into()));
return Err(ApiError::Gone("this invitation has already been accepted".into()));
}
let inviter: Option<db::User> = sqlx::query_as(&format!("SELECT {USER_COLUMNS} FROM users WHERE id = $1"))
.bind(invite.inviter_id)
+1 -4
View File
@@ -132,10 +132,7 @@ textarea.inp { padding: 12px 14px; line-height: 1.55; min-height: 96px; resize:
/* A button beside input fields is as tall as they are */
.row > .btn:not(.btn-sm), .redeem-row > .btn { min-height: 48px; }
.inp::placeholder { color: #8a93ab; }
.inp:focus { outline: none; border-color: var(--gold); background-color: #182037; box-shadow: 0 0 0 3px rgba(217, 180, 106, 0.25); }
/* Clicking in must visibly change the field: the example text steps aside for the caret */
.inp:focus::placeholder { color: transparent; }
.inp { caret-color: var(--gold); }
.inp:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217, 180, 106, 0.25); }
.inp:disabled { opacity: 0.55; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); min-height: 32px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); margin: 0; }
-2
View File
@@ -5,7 +5,6 @@ import { Suspense } from "react";
import { NightSky } from "@/components/NightSky";
import { PaymentReturn } from "@/components/PaymentReturn";
import { SiteHeader } from "@/components/SiteHeader";
import { ValidationMessages } from "@/components/ValidationMessages";
import { getMe } from "@/lib/server";
import { siteUrl } from "@/lib/share";
@@ -33,7 +32,6 @@ export default async function RootLayout({ children }: { children: React.ReactNo
<html lang="hu" className={`${cormorant.variable} ${inter.variable}`}>
<body>
<NightSky />
<ValidationMessages />
{me && <SiteHeader me={me} />}
{children}
{me && (
@@ -1,83 +0,0 @@
"use client";
import { useEffect } from "react";
type Field = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
/** Hungarian text for a field the browser found invalid. */
function message(el: Field): string {
const v = el.validity;
if (v.valueMissing) {
if (el instanceof HTMLSelectElement) return "Válassz a listából.";
if (el instanceof HTMLInputElement && el.type === "checkbox") return "Jelöld be a folytatáshoz.";
if (el instanceof HTMLInputElement && el.type === "radio") return "Válassz egyet.";
return "Töltsd ki ezt a mezőt.";
}
if (v.typeMismatch) {
if (el.type === "email") return "Adj meg egy érvényes e-mail-címet.";
if (el.type === "url") return "Adj meg egy érvényes webcímet.";
}
if (v.tooShort && !(el instanceof HTMLSelectElement)) {
return `Legalább ${el.minLength} karakter legyen (most ${el.value.length}).`;
}
if (v.tooLong && !(el instanceof HTMLSelectElement)) return `Legfeljebb ${el.maxLength} karakter lehet.`;
if (el instanceof HTMLInputElement) {
if (v.rangeUnderflow) return `A legkisebb megengedett érték: ${el.min}.`;
if (v.rangeOverflow) return `A legnagyobb megengedett érték: ${el.max}.`;
if (v.patternMismatch) return el.title || "A formátum nem megfelelő.";
if (v.badInput && el.type === "number") return "Számot adj meg.";
}
return "Az érték nem megfelelő.";
}
function isField(t: EventTarget | null): t is Field {
return t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement;
}
/**
* The browser's own form checks (required, minLength, type="email"…) speak
* the browser's language. This puts Hungarian text into those bubbles on
* every page; the checks themselves stay the browser's.
*/
export function ValidationMessages() {
useEffect(() => {
// Fields whose message was set here, so it can be cleared again.
const marked = new WeakSet<Field>();
const clear = (el: Field) => {
if (marked.has(el)) {
el.setCustomValidity("");
marked.delete(el);
}
};
const onInvalid = (e: Event) => {
const el = e.target;
if (!isField(el)) return;
clear(el);
// A message the page set itself (setCustomValidity) is kept.
if (el.validity.customError || el.validity.valid) return;
el.setCustomValidity(message(el));
marked.add(el);
};
const onEdit = (e: Event) => {
if (isField(e.target)) clear(e.target);
};
// A submit attempt checks the fields afresh: a value set by code (no input event) is not stuck.
const onClick = (e: Event) => {
const button = (e.target as Element | null)?.closest?.("button, input[type=submit]");
const form = (button as HTMLButtonElement | HTMLInputElement | null)?.form;
if (!form || (button as HTMLButtonElement).type !== "submit") return;
for (const el of Array.from(form.elements)) if (isField(el)) clear(el);
};
document.addEventListener("invalid", onInvalid, true);
document.addEventListener("input", onEdit, true);
document.addEventListener("change", onEdit, true);
document.addEventListener("click", onClick, true);
return () => {
document.removeEventListener("invalid", onInvalid, true);
document.removeEventListener("input", onEdit, true);
document.removeEventListener("change", onEdit, true);
document.removeEventListener("click", onClick, true);
};
}, []);
return null;
}
-7
View File
@@ -37,13 +37,6 @@ export function errorText(e: unknown): string {
return "Ehhez nincs jogosultságod.";
case "insufficient_credits":
return "Nincs több részletes elemzésed ebből a fajtából.";
case "not_found":
return "Nem található. Lehet, hogy közben törölték.";
case "horoscope_unavailable":
return "A számítás most nem érhető el. Próbáld újra pár perc múlva.";
case "internal_error":
case "error":
return "Váratlan hiba történt. Próbáld újra később.";
default:
return e.message;
}