Review fixes: no duplicate invoices, safer logins and redirects, one charge per click
Invoicing: the invoice request is marked before it goes to Billingo; a retry after a lost answer looks the invoice up under the invoice's own partner instead of issuing a second one. An invoice issued but never e-mailed counts as issued (downloadable). A Hungarian company with only an EU VAT number is invoiced without a domestic tax number, the EU number in the comment. Security: the login redirect takes only plain local paths (no backslash); the waitlist rate limit and share visits use X-Real-IP, which Caddy sets from Cloudflare's address, not the spoofable first X-Forwarded-For entry; a Google/Apple sign-in to an unconfirmed password account removes its password and sessions; a person's birth data can no longer be published through a share. Credits and jobs: analysis requests are serialized per user, so a double click queues and pays once; a forecast analysis also fixes a person's birth data; admins can restart stuck tarot readings; a worker forgets an attempt an admin restarted, so a stop does not requeue it; two people accepting one comparison invite at once get one comparison. Expired invitations are no longer accepted by e-mail, and unsubscribing revokes the invitation's promo codes too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -61,12 +61,7 @@ struct ShareRow {
|
||||
const SHARE_COLUMNS: &str = "id, owner_id, slug, kind, chart_id, synastry_id, analysis_id, title, show_birth_data, \
|
||||
view_count, created_at, revoked_at, owner_ip_hash";
|
||||
|
||||
/// The visitor's address: the first `X-Forwarded-For` entry (Caddy writes it
|
||||
/// from Cloudflare's, the frontend passes it on).
|
||||
fn client_ip(headers: &HeaderMap) -> Option<String> {
|
||||
let first = headers.get("x-forwarded-for")?.to_str().ok()?.split(',').next()?.trim();
|
||||
(!first.is_empty()).then(|| first.to_string())
|
||||
}
|
||||
use super::client_ip;
|
||||
|
||||
/// An address salted with the slug, so the stored value says nothing by itself.
|
||||
fn ip_hash(slug: &str, ip: &str) -> Vec<u8> {
|
||||
@@ -231,8 +226,9 @@ pub async fn revoke(State(state): St, auth: AuthUser, WithRejection(Path(id), _)
|
||||
// --- public view -------------------------------------------------------------------------------
|
||||
|
||||
fn public_chart_block(chart: &ChartRow, share: &ShareRow) -> Value {
|
||||
// Birth data only of the sharer's own chart, never of a partner's.
|
||||
let show = share.show_birth_data && chart.owner_id == share.owner_id;
|
||||
// Birth data only of the sharer's own chart, never of a partner's or of a
|
||||
// person they added (that is someone else's data).
|
||||
let show = share.show_birth_data && chart.owner_id == share.owner_id && chart.kind == "own";
|
||||
json!({ "label": chart.label, "chart": public_chart(&chart.result, show) })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user