Cotton code
31 lines · 1.2 KB · TypeScriptRaw
/** * The Mac app's update feed. * * Sparkle 2 asks this URL. The Worker forwards it to the serving Mac * (`MAC_FEED_ORIGIN`), which answers off its release records; every entry * names a zip under `/mac/download/` (`macDownloads.ts`) and carries an EdDSA * signature the app checks with the public key in its own `Info.plist`. * Anything but an XML 200 is a plain-text refusal, never a page, because an * updater handed HTML reports "could not check for updates". *//** The one path Sparkle asks. `SUFeedURL` in the app's plist is this, absolute. */export const MAC_APPCAST_PATH = "/mac/appcast.xml";/** Whether a request is for the feed. Exact — a feed has no aliases. */export function isMacAppcastPath(pathname: string): boolean {  return pathname === MAC_APPCAST_PATH;}/** * What the feed is served as. * * `application/xml` because that is what it is, and a short cache because an * update people are waiting for should not sit behind an hour of edge cache — * five minutes is long enough to absorb a release day and short enough that * nobody has to think about it. */export const MAC_APPCAST_HEADERS: Readonly<Record<string, string>> = {  "Content-Type": "application/xml; charset=utf-8",  "Cache-Control": "public, max-age=300",};