Skip to content

Commit 05c843b

Browse files
ismoilovdevmlclaude
andcommitted
Fix: HTTP authentication and missing static files
- Fix cookie security for HTTP connections (only use secure flag on HTTPS) - Add missing favicon.ico and icon files (192x192, 512x512, SVG) - Create icon generation script for future updates - Resolve 404 errors for static assets 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ed3d75a commit 05c843b

File tree

6 files changed

+90
-1
lines changed

6 files changed

+90
-1
lines changed

public/favicon.ico

70 Bytes
Binary file not shown.

public/icon-192x192.png

70 Bytes
Loading

public/icon-512x512.png

70 Bytes
Loading

public/icon.svg

Lines changed: 25 additions & 0 deletions
Loading

scripts/generate-icons.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env node
2+
3+
// eslint-disable-next-line @typescript-eslint/no-require-imports
4+
const fs = require('fs');
5+
// eslint-disable-next-line @typescript-eslint/no-require-imports
6+
const path = require('path');
7+
8+
// Simple PNG creation (1x1 orange pixel, will be scaled by browser)
9+
// This is a minimal valid PNG file in GitLab orange (#FC6D26)
10+
const createSimplePNG = () => {
11+
// This is a valid 1x1 orange PNG in base64
12+
const base64PNG = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8DwHwAFBQIAX8jx0gAAAABJRU5ErkJggg==';
13+
return Buffer.from(base64PNG, 'base64');
14+
};
15+
16+
// GitLab orange color SVG icon
17+
const createSVGIcon = () => `<?xml version="1.0" encoding="UTF-8"?>
18+
<svg width="512" height="512" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
19+
<!-- Background -->
20+
<rect width="512" height="512" rx="80" fill="#FC6D26"/>
21+
22+
<!-- CI/CD Icon -->
23+
<g fill="white">
24+
<!-- Top pipeline stage -->
25+
<circle cx="256" cy="150" r="30" opacity="1"/>
26+
<rect x="246" y="180" width="20" height="40" opacity="0.9"/>
27+
28+
<!-- Middle pipeline stage -->
29+
<circle cx="256" cy="256" r="30" opacity="0.9"/>
30+
<rect x="246" y="286" width="20" height="40" opacity="0.8"/>
31+
32+
<!-- Bottom pipeline stage -->
33+
<circle cx="256" cy="362" r="30" opacity="0.8"/>
34+
35+
<!-- Side branches -->
36+
<circle cx="180" cy="256" r="20" opacity="0.7"/>
37+
<circle cx="332" cy="256" r="20" opacity="0.7"/>
38+
<line x1="210" y1="256" x2="236" y2="256" stroke="white" stroke-width="4" opacity="0.7"/>
39+
<line x1="276" y1="256" x2="302" y2="256" stroke="white" stroke-width="4" opacity="0.7"/>
40+
</g>
41+
</svg>`;
42+
43+
const publicDir = path.join(__dirname, '..', 'public');
44+
45+
// Create favicon.ico (using PNG format, browsers accept it)
46+
fs.writeFileSync(path.join(publicDir, 'favicon.ico'), createSimplePNG());
47+
console.log('✅ Created favicon.ico');
48+
49+
// Create icon PNGs (minimal size, browser will scale)
50+
fs.writeFileSync(path.join(publicDir, 'icon-192x192.png'), createSimplePNG());
51+
console.log('✅ Created icon-192x192.png');
52+
53+
fs.writeFileSync(path.join(publicDir, 'icon-512x512.png'), createSimplePNG());
54+
console.log('✅ Created icon-512x512.png');
55+
56+
// Create proper SVG icon
57+
fs.writeFileSync(path.join(publicDir, 'icon.svg'), createSVGIcon());
58+
console.log('✅ Created icon.svg');
59+
60+
console.log('\n🎉 All icons generated successfully!');

src/app/api/auth/login/route.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ export async function POST(request: NextRequest) {
5151
const session = await createSession(user.id);
5252

5353
// Set session cookie
54+
// Only use secure cookies when explicitly using HTTPS
55+
const isHttps = request.headers.get('x-forwarded-proto') === 'https' ||
56+
request.url.startsWith('https://');
57+
5458
const cookie = serialize(SESSION_COOKIE_NAME, session.token, {
5559
httpOnly: true,
56-
secure: process.env.NODE_ENV === 'production',
60+
secure: isHttps,
5761
sameSite: 'lax',
5862
maxAge: 7 * 24 * 60 * 60, // 7 days
5963
path: '/',

0 commit comments

Comments
 (0)