pr_01m47d24b0e6n91zwymwxg0vpx/apps/web/app/lib/legal.ts
| 1 | /** |
| 2 | * Who makes g1t, how to reach them, and the policies that govern it: the |
| 3 | * one place the footer, the policy pages, /security, /support and |
| 4 | * security.txt read these from. |
| 5 | */ |
| 6 | |
| 7 | /** The company behind g1t. */ |
| 8 | export const COMPANY = { |
| 9 | name: "Flagon, Inc.", |
| 10 | url: "https://www.flagon.io", |
| 11 | /** How the footer describes it. */ |
| 12 | about: "a small, independent software company", |
| 13 | }; |
| 14 | |
| 15 | /** |
| 16 | * Flagon's other launched products, which the footer's maker line names |
| 17 | * ("…, the people behind X and Y"). None yet: add each here when it ships. |
| 18 | */ |
| 19 | export const MAKER_PRODUCTS: { name: string; url: string }[] = []; |
| 20 | |
| 21 | /** "X", "X and Y", "X, Y and Z". */ |
| 22 | export function listed(names: string[]): string { |
| 23 | if (names.length <= 1) return names.join(""); |
| 24 | return `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`; |
| 25 | } |
| 26 | |
| 27 | /** The year in UTC, so a page rendered near midnight on 31 December agrees everywhere. */ |
| 28 | export function copyrightYear(now: Date = new Date()): number { |
| 29 | return now.getUTCFullYear(); |
| 30 | } |
| 31 | |
| 32 | /** The footer's legal line. */ |
| 33 | export function copyright(now: Date = new Date()): string { |
| 34 | return `© ${copyrightYear(now)} ${COMPANY.name} All rights reserved.`; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Where people reach g1t. Each must be a real, watched mailbox. For now |
| 39 | * every topic goes to Flagon's one address; give a topic its own address |
| 40 | * here once the g1t.sh aliases exist. |
| 41 | */ |
| 42 | export const CONTACT = { |
| 43 | support: "hey@flagon.io", |
| 44 | security: "hey@flagon.io", |
| 45 | privacy: "hey@flagon.io", |
| 46 | billing: "hey@flagon.io", |
| 47 | abuse: "hey@flagon.io", |
| 48 | legal: "hey@flagon.io", |
| 49 | }; |
| 50 | |
| 51 | export type Policy = { |
| 52 | slug: string; |
| 53 | title: string; |
| 54 | summary: string; |
| 55 | }; |
| 56 | |
| 57 | /** The policies, in the order the index lists them. Each is `/policies/<slug>`. */ |
| 58 | export const POLICIES: Policy[] = [ |
| 59 | { |
| 60 | slug: "terms", |
| 61 | title: "Terms of Service", |
| 62 | summary: "The agreement between you and Flagon, Inc. when you use g1t: accounts, your content, agents, paying, and ending.", |
| 63 | }, |
| 64 | { |
| 65 | slug: "privacy", |
| 66 | title: "Privacy Policy", |
| 67 | summary: "What g1t collects, why, where it goes, how long it is kept, and how to see, export or delete it.", |
| 68 | }, |
| 69 | { |
| 70 | slug: "acceptable-use", |
| 71 | title: "Acceptable Use Policy", |
| 72 | summary: "What g1t may not be used for, from mining cryptocurrency to abuse, and what happens when it is.", |
| 73 | }, |
| 74 | { |
| 75 | slug: "refunds", |
| 76 | title: "Refunds and Cancellation", |
| 77 | summary: "Ending the plan, accidental overages and goodwill credits, and when money goes back to your card.", |
| 78 | }, |
| 79 | { |
| 80 | slug: "subprocessors", |
| 81 | title: "Subprocessors", |
| 82 | summary: "The companies that process data for g1t, what each does, and the services you choose to connect.", |
| 83 | }, |
| 84 | ]; |
| 85 | |
| 86 | /** When any policy last changed, `YYYY-MM-DD`. */ |
| 87 | export const POLICIES_UPDATED = "2026-10-05"; |
| 88 | |
| 89 | /** Every change to the policies, newest first. */ |
| 90 | export const POLICY_HISTORY: { date: string; change: string }[] = [ |
| 91 | { |
| 92 | date: "2026-10-05", |
| 93 | change: |
| 94 | "First published: Terms of Service, Privacy Policy, Acceptable Use Policy, Refunds and Cancellation, and Subprocessors.", |
| 95 | }, |
| 96 | ]; |
| 97 | |
| 98 | /** `2026-10-05` as "October 5, 2026". */ |
| 99 | export function longDate(day: string): string { |
| 100 | const [year, month, date] = day.split("-").map(Number); |
| 101 | const months = [ |
| 102 | "January", "February", "March", "April", "May", "June", |
| 103 | "July", "August", "September", "October", "November", "December", |
| 104 | ]; |
| 105 | return `${months[month - 1]} ${date}, ${year}`; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * security.txt (RFC 9116). `Expires` is required and should be less than a |
| 110 | * year away, so it is always computed: 180 days from now. |
| 111 | */ |
| 112 | export function securityTxt(now: Date = new Date(), site = "https://g1t.sh"): string { |
| 113 | const expires = new Date(now.getTime() + 180 * 24 * 60 * 60 * 1000); |
| 114 | expires.setUTCHours(0, 0, 0, 0); |
| 115 | return [ |
| 116 | `Contact: mailto:${CONTACT.security}`, |
| 117 | `Expires: ${expires.toISOString().replace(".000Z", "Z")}`, |
| 118 | "Preferred-Languages: en", |
| 119 | `Policy: ${site}/security#responsible-disclosure`, |
| 120 | `Canonical: ${site}/.well-known/security.txt`, |
| 121 | "", |
| 122 | ].join("\n"); |
| 123 | } |