Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
72993ac
feat(server): implement secure, scalable API server with analytics an…
Jackson57279 Aug 23, 2025
c009629
Potential fix for code scanning alert no. 621: Bad HTML filtering regexp
Jackson57279 Aug 23, 2025
1ecde6c
🔒 Fix critical security vulnerabilities in API server
Jackson57279 Aug 23, 2025
35f888f
Enhance security of HTML parsing with improved regex patterns and ite…
Jackson57279 Aug 23, 2025
4f352c4
Resolve merge conflicts between dev-branch and main
Jackson57279 Aug 23, 2025
1ddddf3
🔒 Fix critical security vulnerabilities
Jackson57279 Aug 23, 2025
d9c9ac4
Thing
Jackson57279 Aug 23, 2025
f0d128e
different model please
Jackson57279 Aug 23, 2025
dab568a
fix: resolve JavaScript errors in chat interface and tRPC integration
Jackson57279 Aug 23, 2025
bfc239b
resolve: merge conflict in api-dev-server.ts
Jackson57279 Aug 23, 2025
c87a874
refactor(api): enhance file validation and error handling in API server
Jackson57279 Aug 24, 2025
a4d5911
refactor(api): enhance analytics, error handling, and security measures
Jackson57279 Aug 24, 2025
2df27bd
refactor(security): enhance PII scrubbing and validation logic
Jackson57279 Aug 24, 2025
a3f199d
Potential fix for code scanning alert no. 624: CORS misconfiguration …
Jackson57279 Aug 24, 2025
c07b38b
resolve: merge conflicts in api-dev-server.ts and src/lib/firecrawl.ts
Jackson57279 Aug 24, 2025
847ddce
resolve: merge conflicts in PR #78, keeping security improvements fro…
Jackson57279 Aug 24, 2025
ba0f990
Add current changes before merge
Jackson57279 Aug 24, 2025
99a167f
Resolve merge conflicts prioritizing security improvements from dev-b…
Jackson57279 Aug 24, 2025
776e924
idk
Jackson57279 Aug 24, 2025
557c799
Refactor deployment configuration to separate sensitive data
Jackson57279 Aug 25, 2025
8cd83ed
Refactor ResourcePreloader component to optimize resource hints and u…
Jackson57279 Aug 25, 2025
03f8136
resolve: merge conflicts between qoder branch and main
Jackson57279 Aug 25, 2025
81d1110
Fix Vercel deployment build errors
Jackson57279 Aug 26, 2025
12e5230
Merge branch 'main' into qoder
Jackson57279 Aug 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/create-checkout-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {

if (req.method === 'OPTIONS') {
if (isOriginAllowed(requestOrigin)) {
res.setHeader('Access-Control-Allow-Origin', requestOrigin);
res.setHeader('Access-Control-Allow-Origin', requestOrigin as string);
res.setHeader('Access-Control-Allow-Credentials', 'true');
res.setHeader('Access-Control-Allow-Methods', 'POST, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
Expand All @@ -33,7 +33,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {

// Main CORS logic
if (isOriginAllowed(requestOrigin)) {
res.setHeader('Access-Control-Allow-Origin', requestOrigin);
res.setHeader('Access-Control-Allow-Origin', requestOrigin as string);
res.setHeader('Access-Control-Allow-Credentials', 'true');
} else if (requestOrigin) {
res.setHeader('Access-Control-Allow-Origin', 'null');
Expand Down
20 changes: 16 additions & 4 deletions api/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,20 @@ let deploymentManager: ZapdevDeploymentManager | null = null;
// Helper function to get or initialize deployment manager
function getDeploymentManager(): ZapdevDeploymentManager {
if (!deploymentManager) {
const secrets = {
netlify: {
accessToken: validatedEnv.netlifyAccessToken,
teamId: process.env.NETLIFY_TEAM_ID,
},
vercel: {
accessToken: validatedEnv.vercelAccessToken,
teamId: process.env.VERCEL_TEAM_ID,
},
};

deploymentManager = new ZapdevDeploymentManager({
config: deploymentConfig,
secrets,
analytics: { track: analytics.track.bind(analytics) },
logger,
});
Expand Down Expand Up @@ -378,7 +390,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
}
}

async function handleDeploy(req: VercelRequest, res: VercelResponse, body: DeployRequest) {
async function handleDeploy(_req: VercelRequest, res: VercelResponse, body: DeployRequest) {
const { platform, projectName, subdomain, files, gitRepo, environment } = body;

if (!platform || !projectName) {
Expand Down Expand Up @@ -446,7 +458,7 @@ async function handleStatus(req: VercelRequest, res: VercelResponse, body: Deplo
});
}

async function handleSetupDomain(req: VercelRequest, res: VercelResponse, body: DeployRequest) {
async function handleSetupDomain(_req: VercelRequest, res: VercelResponse, body: DeployRequest) {
const { subdomain, platform, projectId } = body;

if (!subdomain || !platform) {
Expand All @@ -465,7 +477,7 @@ async function handleSetupDomain(req: VercelRequest, res: VercelResponse, body:
});
}

async function handleVerifyDomain(req: VercelRequest, res: VercelResponse, body: DeployRequest) {
async function handleVerifyDomain(_req: VercelRequest, res: VercelResponse, body: DeployRequest) {
const { subdomain, platform, projectId } = body;

if (!subdomain || !platform) {
Expand All @@ -485,7 +497,7 @@ async function handleVerifyDomain(req: VercelRequest, res: VercelResponse, body:
});
}

async function handleDelete(req: VercelRequest, res: VercelResponse, body: DeployRequest) {
async function handleDelete(_req: VercelRequest, res: VercelResponse, body: DeployRequest) {
const { platform, deploymentId } = body;

if (!platform || !deploymentId) {
Expand Down
4 changes: 2 additions & 2 deletions api/domains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ async function handleCheckSubdomain(req: VercelRequest, res: VercelResponse, bod
});
}

async function handleSetupDomain(req: VercelRequest, res: VercelResponse, body: DomainRequest) {
async function handleSetupDomain(_req: VercelRequest, res: VercelResponse, body: DomainRequest) {
const { subdomain, platform, projectId, siteId } = body;

if (!subdomain || !platform) {
Expand Down Expand Up @@ -353,7 +353,7 @@ async function handleSetupDomain(req: VercelRequest, res: VercelResponse, body:
});
}

async function handleVerifyDomain(req: VercelRequest, res: VercelResponse, body: DomainRequest) {
async function handleVerifyDomain(_req: VercelRequest, res: VercelResponse, body: DomainRequest) {
const { subdomain, platform, projectId, siteId } = body;

if (!subdomain || !platform) {
Expand Down
5 changes: 3 additions & 2 deletions api/hono-trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
'/trpc/*',
trpcServer({
router: appRouter,
createContext: async (opts: FetchCreateContextFnOptions) => {
return await createContext({ req: opts.req });
createContext: async (opts: FetchCreateContextFnOptions, c) => {

Check failure

Code scanning / ESLint

Disallow unused variables Error

'c' is defined but never used.
const context = await createContext({ req: opts.req });
return context as Record<string, unknown>;
},
onError: ({ error, path, type }) => {
console.error(`Hono tRPC Error on ${path} (${type}):`, {
Expand Down
8 changes: 3 additions & 5 deletions api/secret-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
}

// Configure the Google provider with the user's API key
const gemini = google({
apiKey: apiKey,
});
const gemini = google({ apiKey });

// Check if this is a streaming request
const isStreaming = req.headers['accept']?.includes('text/stream') ||
Expand All @@ -62,7 +60,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
content: msg.content,
})),
temperature: 0.7,
maxTokens: 4000,
maxCompletionTokens: 4000,
});

return result.toTextStreamResponse();
Expand All @@ -75,7 +73,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
content: msg.content,
})),
temperature: 0.7,
maxTokens: 4000,
maxCompletionTokens: 4000,
});

return res.status(200).json({
Expand Down
8 changes: 8 additions & 0 deletions api/success.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
return res.status(405).json({ error: 'Method not allowed' });
}

// Require authentication
const rawAuthHeader = Array.isArray(req.headers['authorization'])
? req.headers['authorization'][0]
: req.headers['authorization'];
const authorization = typeof rawAuthHeader === 'string' ? rawAuthHeader : undefined;

try {

// Require authentication
const rawAuthHeader = Array.isArray(req.headers['authorization'])
? req.headers['authorization'][0]
: req.headers['authorization'];
const authorization = typeof rawAuthHeader === 'string' ? rawAuthHeader : undefined;

if (!authorization) {
return res.status(401).json({ error: 'Unauthorized' });
}
Expand Down
4 changes: 4 additions & 0 deletions lib/deployment/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ export class ZapdevDeploymentManager {
event: 'domain_configured',
properties: {
platform,
project_name: projectId || 'unknown',
subdomain,
custom_domain: fullDomain,
project_id: projectId,
Expand All @@ -278,6 +279,7 @@ export class ZapdevDeploymentManager {
event: 'domain_configured',
properties: {
platform,
project_name: projectId || 'unknown',
subdomain,
custom_domain: fullDomain,
project_id: projectId,
Expand Down Expand Up @@ -330,6 +332,8 @@ export class ZapdevDeploymentManager {
event: 'domain_verified',
properties: {
platform,
project_name: projectId || 'unknown',
subdomain: domain.replace('.zapdev.link', ''),
custom_domain: domain,
project_id: projectId,
success: result.success,
Expand Down
2 changes: 2 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ export default defineConfig(({ mode }) => {
},
cacheableResponse: {
statuses: [0, 200],

headers: {
'Cache-Control': /^(?!.*no-store).*/,
},

},
plugins: [
{
Expand Down