export type Platform = "macOS" | "Linux" | "Windows";

export function detectPlatform(ctx: Context<*>): Platform {
  if (ctx.req && ctx.req.headers) {
    const ua = ctx.req.headers["user-agent"];
    if (/Windows/.test(ua)) {
      return "Windows";
    } else if (/Linux/.test(ua)) {
      return "Linux";
    }
    return "macOS";
  } else if (navigator.platform) {
    if (/Win/.test(navigator.platform)) {
      platform = "Windows";
    } else if (/Linux/.test(navigator.platform)) {
      platform = "Linux";
    }
    // Else keep macOS default
  }
}

@@ -140,24 +140,43 @@
 .headers) %7B%0A
+    // Server side%0A
     const ua
@@ -345,16 +345,36 @@
 %22macOS%22;
+%0A%0A    // Client side
 %0A  %7D els

include comment for server vs. client side