Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions public/.well-known/security.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Security contact for Swim Events Calendar (RFC 9116). The policy explains what to include and the rules for testing.
Contact: mailto:swim-events@proton.me
Expires: 2027-11-30T23:00:00.000Z
Preferred-Languages: en, de, fr
Canonical: https://swim-events.com/.well-known/security.txt
Policy: https://swim-events.com/security
29 changes: 29 additions & 0 deletions src/components/AuthState.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
/**
* Marks `<html data-signed-in>` before the first paint when this browser holds a Supabase session,
* so the header can show "Account" instead of "Submit an event" without loading the Supabase
* client on every page. It only looks for the stored session: whether it is still valid is
* checked on the account and submit pages, as before.
*/
import { PUBLIC_SUPABASE_URL } from 'astro:env/client'

// supabase-js stores the session under sb-<project ref>-auth-token
const sessionKey = `sb-${new URL(PUBLIC_SUPABASE_URL).hostname.split('.')[0]}-auth-token`
---

<script is:inline define:vars={{ sessionKey }}>
const markSignedIn = () => {
let signedIn = false
try {
signedIn = !!localStorage.getItem(sessionKey)
} catch {
// storage blocked: treat as signed out
}
document.documentElement.toggleAttribute('data-signed-in', signedIn)
}
markSignedIn()
// page changes swap the <html> attributes; other tabs and sign-in or sign-out on this page change the session
document.addEventListener('astro:after-swap', markSignedIn)
window.addEventListener('storage', markSignedIn)
window.addEventListener('swim-events:auth', markSignedIn)
</script>
6 changes: 3 additions & 3 deletions src/components/Footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ const currentYear = new Date().getFullYear()
</p>
<nav aria-label="About and legal">
<ul class="footer__links">
<li>
<a href="/about">About</a>
</li>
<li>
<a href="/privacy">Privacy policy</a>
</li>
<li>
<a href="/terms">Terms of service</a>
</li>
<li>
<a href="/security">Security</a>
</li>
</ul>
</nav>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/components/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import { SkipLink } from 'accessible-astro-components'
<style lang="scss" is:global>
@use '../assets/scss/base/breakpoint' as *;

// Items for signed-in or signed-out visitors only (AuthState.astro sets data-signed-in)
html[data-signed-in] [data-auth='signed-out'],
html:not([data-signed-in]) [data-auth='signed-in'] {
display: none;
}

header {
li.type-icon {
display: block;
Expand Down
19 changes: 17 additions & 2 deletions src/components/Navigation.astro
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,22 @@ const hasMenu = themeConfig.navigation.items.length > 0
gap: var(--space-m);
}

a,
a:not(.nav-button),
button {
color: var(--foreground-color);
}

// "Submit an event": the site's primary button, without the menu's wavy underline
.nav-button {
color: var(--on-pool-color);

&:hover,
&:focus-visible,
&[aria-current='page'] {
text-decoration: none;
}
}

nav {
> ul {
display: flex;
Expand Down Expand Up @@ -323,12 +334,16 @@ const hasMenu = themeConfig.navigation.items.length > 0
}
}

a,
a:not(.nav-button),
button {
display: block;
padding: var(--space-2xs) 0;
inline-size: 100%;
}

.nav-button {
margin-block: var(--space-2xs);
}
}

.has-dropdown {
Expand Down
13 changes: 12 additions & 1 deletion src/components/NavigationItems.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,23 @@ const isCurrentPage = (href: string): boolean => {
<ul class="menu">
{
themeConfig.navigation.items.map((item) => (
<li class={`menu-item ${item.type === 'dropdown' ? 'has-dropdown' : ''}`}>
<li
class={`menu-item ${item.type === 'dropdown' ? 'has-dropdown' : ''}`}
data-auth={item.type !== 'dropdown' ? item.show : undefined}
>
{item.type === 'dropdown' ? (
<button aria-haspopup="true" aria-expanded="false">
{item.label}
<Icon aria-hidden="true" name="lucide:chevron-down" size="24" />
</button>
) : (!item.type || item.type === 'link') && item.button ? (
<a
href={item.href}
class="button button--small nav-button"
aria-current={isCurrentPage(item.href) ? 'page' : undefined}
>
{item.label}
</a>
) : !item.type || item.type === 'link' ? (
<Link
href={item.href}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SignIn.astro
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const { heading } = Astro.props
<Icon aria-hidden="true" name="lucide:info" size="1.25rem" />
<p>
Didn't get the code? Check your spam folder and wait a minute before sending a new one. Still nothing? Write to
<a href="mailto:info@proswimworkouts.com">info@proswimworkouts.com</a>.
<a href="mailto:swim-events@proton.me">swim-events@proton.me</a>.
</p>
</div>
</form>
Expand Down
2 changes: 2 additions & 0 deletions src/layouts/DefaultLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import '../styles/tailwind.css'
import '../assets/scss/index.scss'
import themeConfig from '@theme-config'
import { SEO } from 'astro-seo'
import AuthState from '@components/AuthState.astro'
import Header from '@components/Header.astro'
import Footer from '@components/Footer.astro'
import SimpleAnalyticsEvents from '@components/SimpleAnalyticsEvents.astro'
Expand Down Expand Up @@ -69,6 +70,7 @@ const siteJsonLd = jsonLd(siteData((themeConfig.socials ?? []).map((social) => s
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<AuthState />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />

Expand Down
4 changes: 4 additions & 0 deletions src/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export const auth = createClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_KEY, {
},
})

// Lets the header (AuthState.astro) switch between "Submit an event" and "Account" right after
// signing in or out; after the session is stored, so the header reads the new state
auth.auth.onAuthStateChange(() => setTimeout(() => window.dispatchEvent(new Event('swim-events:auth'))))

/**
* Turnstile site key. The production key only works on swim-events.com; everywhere else
* Cloudflare's always-passing test key is used, which local Supabase (captcha off) accepts.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/submission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { daysBetween, isoDate, parseCalendarDate, type CalendarDate } from './co
import { parseLocation } from './locations'
import type { SwimEvent } from './supabase'

export const CONTACT_EMAIL = 'info@proswimworkouts.com'
export const CONTACT_EMAIL = 'swim-events@proton.me'

/** The first day must be at least this many days after today, in the visitor's own date. */
export const MIN_DAYS_AHEAD = 3
Expand Down
2 changes: 1 addition & 1 deletion src/pages/about.astro
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const refreshedLabel = new Intl.DateTimeFormat('en-GB', {
<h2 id="contact-heading">Contact</h2>
<p>
Questions, a missing event or a correction? Write to
<a href="mailto:info@proswimworkouts.com">info@proswimworkouts.com</a>.
<a href="mailto:swim-events@proton.me">swim-events@proton.me</a>.
</p>
</section>
</LegalLayout>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/account.astro
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { Icon } from 'astro-icon/components'
<div class="notice">
<p>
This page needs JavaScript to sign you in. You can also write to
<a href="mailto:info@proswimworkouts.com">info@proswimworkouts.com</a>.
<a href="mailto:swim-events@proton.me">swim-events@proton.me</a>.
</p>
</div>
</noscript>
Expand Down Expand Up @@ -62,8 +62,8 @@ import { Icon } from 'astro-icon/components'
<p class="sr-only" role="status" data-field="list-status"></p>
<div class="notice notice--error" data-field="list-notice" role="alert" hidden></div>
<p class="muted">
Need to change a published event? Write to <a href="mailto:info@proswimworkouts.com"
>info@proswimworkouts.com</a
Need to change a published event? Write to <a href="mailto:swim-events@proton.me"
>swim-events@proton.me</a
>. Editing your own events comes later.
</p>
</div>
Expand Down
9 changes: 6 additions & 3 deletions src/pages/privacy.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import LegalLayout from '@layouts/LegalLayout.astro'
<LegalLayout
title="Privacy policy"
description="How Swim Events Calendar handles your personal data, which services it uses and what your rights are."
updated="2026-11-14"
updated="2026-11-27"
>
<p>
This page explains which personal data swim-events.com processes, why, who helps us with it and what your rights
Expand All @@ -26,7 +26,7 @@ import LegalLayout from '@layouts/LegalLayout.astro'
<br />
Switzerland
<br />
<a href="mailto:info@proswimworkouts.com">info@proswimworkouts.com</a>
<a href="mailto:swim-events@proton.me">swim-events@proton.me</a>
</address>
<p>
Write to this address for any question about your data or to use the rights described below. We process personal
Expand Down Expand Up @@ -133,6 +133,9 @@ import LegalLayout from '@layouts/LegalLayout.astro'
<li>
<strong>Cloudflare</strong> (Cloudflare, Inc., USA): the spam check on the sign-in step.
</li>
<li>
<strong>Proton</strong> (Proton AG, Switzerland): our email inbox, for the messages you send us.
</li>
</ul>
<p>
Some of these companies are based in the USA or may process data there. Where that happens, the transfer relies on
Expand Down Expand Up @@ -165,7 +168,7 @@ import LegalLayout from '@layouts/LegalLayout.astro'
<li>give you your data in a common electronic format.</li>
</ul>
<p>
Write to <a href="mailto:info@proswimworkouts.com">info@proswimworkouts.com</a>. We may ask you to confirm that the
Write to <a href="mailto:swim-events@proton.me">swim-events@proton.me</a>. We may ask you to confirm that the
request comes from you. If you think we handle your data unlawfully, you can complain to the Swiss Federal Data
Protection and Information Commissioner (FDPIC) or, if you live in the EU, to the data protection authority in your
country.
Expand Down
81 changes: 81 additions & 0 deletions src/pages/security.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
import LegalLayout from '@layouts/LegalLayout.astro'

const CONTACT = 'swim-events@proton.me'
---

<LegalLayout
title="Security"
description="How to report a security problem on Swim Events Calendar, and what you can expect from us."
updated="2026-11-27"
>
<p>
We take the security of Swim Events Calendar and the data of its organisers seriously. If you think you've found a
security problem, please tell us privately, so we can fix it before anyone else uses it.
</p>

<h2>What this covers</h2>
<ul>
<li>The website swim-events.com, including the account and submit pages.</li>
<li>The events widget for other websites (swim-events.com/embed).</li>
<li>The services behind the site that it talks to, such as the sign-in and the event list.</li>
</ul>
<p>
Problems in a service we use, such as Netlify, Supabase or Cloudflare, are best reported to that company directly.
If it affects Swim Events, we're glad to hear about it too.
</p>

<h2>How to report a problem</h2>
<p>
Write to <a href={`mailto:${CONTACT}`}>{CONTACT}</a>, in English, German or French. Please don't report security
problems in public, for example on social media or in a public code repository.
</p>
<p>Helpful to include:</p>
<ul>
<li>the page or address where the problem is;</li>
<li>the steps to see it happen;</li>
<li>what someone could do with it, for example see other people's data;</li>
<li>whether, and how, you'd like to be credited.</li>
</ul>

<h2>What you can expect from us</h2>
<p>
Swim Events is run by one person, so we keep our promises realistic. We reply within 5 working days, keep you
informed while we work on it, and fix confirmed problems as quickly as their seriousness requires. Once a problem is
fixed, we're happy to credit you here if you'd like that.
</p>
<p>
We don't run a bug bounty and don't pay for reports. Reports that only ask for payment, or that only pass on the
output of an automated scanner, may not get a reply.
</p>

<h2>Rules for testing</h2>
<p>
If you test in good faith and within these rules, we consider your research authorised and won't take legal action
against you for it:
</p>
<ul>
<li>Use only your own account. Never look at, change or delete other people's data or submissions.</li>
<li>If you come across someone else's data by accident, stop, don't keep a copy, and tell us.</li>
<li>Don't slow the site down or overload it, and don't send spam or many submissions.</li>
<li>Don't try to trick people, such as organisers or us, into giving you access.</li>
<li>Give us a reasonable time to fix the problem before you talk about it publicly.</li>
</ul>

<h2>What isn't a security problem for us</h2>
<ul>
<li>Results of automated scanners without a way to show a real impact.</li>
<li>
Missing or differently set technical headers, or email settings such as SPF and DMARC, without a real impact.
</li>
<li>The public list of events being readable: it is meant to be public.</li>
<li>Attacks that need someone's unlocked device, or that only work against yourself.</li>
<li>Overloading the site (denial of service).</li>
</ul>

<h2>For automated tools</h2>
<p>
The same contact details are available in machine-readable form at
<a href="/.well-known/security.txt">/.well-known/security.txt</a>.
</p>
</LegalLayout>
10 changes: 5 additions & 5 deletions src/pages/submit.astro
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const countries = Object.entries(COUNTRIES).sort(([, a], [, b]) => a.name.locale
<ul class="muted">
<li>
Only organisers can submit events. Participants and fans can tell us at <a
href="mailto:info@proswimworkouts.com">info@proswimworkouts.com</a
href="mailto:swim-events@proton.me">swim-events@proton.me</a
>.
</li>
<li>Competitions only, in the pool or open water.</li>
Expand All @@ -48,7 +48,7 @@ const countries = Object.entries(COUNTRIES).sort(([, a], [, b]) => a.name.locale
<div class="notice">
<p>
This page needs JavaScript to sign you in and send the event. You can also write to
<a href="mailto:info@proswimworkouts.com">info@proswimworkouts.com</a>.
<a href="mailto:swim-events@proton.me">swim-events@proton.me</a>.
</p>
</div>
</noscript>
Expand All @@ -63,7 +63,7 @@ const countries = Object.entries(COUNTRIES).sort(([, a], [, b]) => a.name.locale
<h2 id="closed-heading" tabindex="-1">Submissions are paused</h2>
<p>
We're not taking new events at the moment. Please try again in a few days, or write to
<a href="mailto:info@proswimworkouts.com">info@proswimworkouts.com</a>.
<a href="mailto:swim-events@proton.me">swim-events@proton.me</a>.
</p>
</div>
</section>
Expand All @@ -72,8 +72,8 @@ const countries = Object.entries(COUNTRIES).sort(([, a], [, b]) => a.name.locale
<div class="panel__body">
<h2 id="blocked-heading" tabindex="-1">Your account can't submit events</h2>
<p>
If you think this is a mistake, write to <a href="mailto:info@proswimworkouts.com"
>info@proswimworkouts.com</a
If you think this is a mistake, write to <a href="mailto:swim-events@proton.me"
>swim-events@proton.me</a
>. You can still see your submissions on your <a href="/account">account page</a>.
</p>
</div>
Expand Down
Loading