@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 +3 -1
- package/dist/auth.js +3 -0
- package/package.json +1 -1
- package/src/app.tsx +2 -0
- package/src/auth.ts +4 -1
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
package/package.json
CHANGED
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,
|