@jant/core 0.3.26 → 0.3.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/app.js CHANGED
@@ -89,9 +89,11 @@ import { base64ToUint8Array } from "./lib/favicon.js";
89
89
  }
90
90
  if (c.env.AUTH_SECRET) {
91
91
  const baseURL = c.env.SITE_URL || new URL(c.req.url).origin;
92
+ const requestUrl = new URL(c.req.url);
92
93
  const auth = createAuth(session, {
93
94
  secret: c.env.AUTH_SECRET,
94
- baseURL
95
+ baseURL,
96
+ useSecureCookies: requestUrl.protocol === "https:"
95
97
  });
96
98
  c.set("auth", auth);
97
99
  }
package/dist/auth.js CHANGED
@@ -20,6 +20,9 @@ export function createAuth(d1, options) {
20
20
  }),
21
21
  secret: options.secret,
22
22
  baseURL: options.baseURL,
23
+ advanced: {
24
+ useSecureCookies: options.useSecureCookies
25
+ },
23
26
  emailAndPassword: {
24
27
  enabled: true,
25
28
  autoSignIn: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jant/core",
3
- "version": "0.3.26",
3
+ "version": "0.3.27",
4
4
  "description": "A modern, open-source microblogging platform built on Cloudflare Workers",
5
5
  "type": "module",
6
6
  "exports": {
package/src/app.tsx CHANGED
@@ -121,9 +121,11 @@ export function createApp(config: JantConfig = {}): App {
121
121
 
122
122
  if (c.env.AUTH_SECRET) {
123
123
  const baseURL = c.env.SITE_URL || new URL(c.req.url).origin;
124
+ const requestUrl = new URL(c.req.url);
124
125
  const auth = createAuth(session as unknown as D1Database, {
125
126
  secret: c.env.AUTH_SECRET,
126
127
  baseURL,
128
+ useSecureCookies: requestUrl.protocol === "https:",
127
129
  });
128
130
  c.set("auth", auth);
129
131
  }
package/src/auth.ts CHANGED
@@ -9,7 +9,7 @@ import * as schema from "./db/schema.js";
9
9
 
10
10
  export function createAuth(
11
11
  d1: D1Database,
12
- options: { secret: string; baseURL: string },
12
+ options: { secret: string; baseURL: string; useSecureCookies: boolean },
13
13
  ) {
14
14
  const db = drizzle(d1, { schema });
15
15
 
@@ -25,6 +25,9 @@ export function createAuth(
25
25
  }),
26
26
  secret: options.secret,
27
27
  baseURL: options.baseURL,
28
+ advanced: {
29
+ useSecureCookies: options.useSecureCookies,
30
+ },
28
31
  emailAndPassword: {
29
32
  enabled: true,
30
33
  autoSignIn: true,