astro-tractstack 2.2.3 → 2.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-tractstack",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "Astro integration for TractStack - the free web press by At Risk Media",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,28 +1,17 @@
1
1
  import type { APIRoute } from '@/types/astro';
2
2
 
3
- export const POST: APIRoute = async ({ cookies }) => {
3
+ export const POST: APIRoute = async ({ cookies, url }) => {
4
4
  try {
5
- const goBackend =
6
- import.meta.env.PUBLIC_GO_BACKEND || 'http://localhost:8080';
7
- let rootDomain: string | undefined;
5
+ const isLocalhost =
6
+ url.hostname === 'localhost' || url.hostname === '127.0.0.1';
8
7
 
9
- try {
10
- const url = new URL(goBackend);
11
- // Only set domain for non-localhost to preserve local dev behavior
12
- if (url.hostname !== 'localhost' && url.hostname !== '127.0.0.1') {
13
- rootDomain = url.hostname;
14
- }
15
- } catch (e) {
16
- console.warn('Logout: Failed to parse backend URL for cookie domain', e);
17
- }
18
-
19
- // Determine the options ONCE to prevent overwriting
20
- const cookieOptions: any = { path: '/' };
21
- if (rootDomain) {
22
- cookieOptions.domain = rootDomain;
23
- }
8
+ const cookieOptions: any = {
9
+ path: '/',
10
+ secure: !isLocalhost,
11
+ httpOnly: true,
12
+ sameSite: 'lax',
13
+ };
24
14
 
25
- // Execute deletion with the single, correct configuration
26
15
  cookies.delete('admin_auth', cookieOptions);
27
16
  cookies.delete('editor_auth', cookieOptions);
28
17