diff --git a/server.ts b/server.ts index 01cac64..0f3b5e3 100644 --- a/server.ts +++ b/server.ts @@ -689,12 +689,18 @@ app.post("/api/workspace/docs/create", async (req, res) => { }); } - const mockId = `doc_${Date.now()}_${Math.random().toString(36).substring(2, 6)}`; + // Local downloadable Document package generator when running without live Google OAuth access token + const docTitle = title || `Tailored ${docType === 'coverLetter' ? 'Cover Letter' : 'Resume'}`; + const htmlContent = `
${content || ''}`;
+ const base64Doc = Buffer.from(htmlContent).toString('base64');
+ const downloadUrl = `data:text/html;charset=utf-8;base64,${base64Doc}`;
+
res.json({
success: true,
- documentId: mockId,
- documentUrl: `https://docs.google.com/document/d/${mockId}/edit`,
- message: `Google Doc prepared for ${title}`
+ documentId: `local_doc_${Date.now()}`,
+ documentUrl: downloadUrl,
+ isLocalDoc: true,
+ message: `Created downloadable Document package for ${docTitle}!`
});
} catch (error: any) {
console.error("Google Docs Creation Error:", error);
@@ -734,12 +740,17 @@ app.post("/api/workspace/drive/upload", async (req, res) => {
});
}
- const mockId = `drive_${Date.now()}_${Math.random().toString(36).substring(2, 6)}`;
+ // Local downloadable artifact file generator when running without live Google OAuth access token
+ const safeFileName = fileName || `Job_Artifact_${Date.now()}.txt`;
+ const base64File = Buffer.from(fileContent || '').toString('base64');
+ const downloadUrl = `data:${mimeType || 'text/plain'};base64,${base64File}`;
+
res.json({
success: true,
- fileId: mockId,
- driveUrl: `https://drive.google.com/file/d/${mockId}/view`,
- message: `File saved to Google Drive workspace folder.`
+ fileId: `local_file_${Date.now()}`,
+ driveUrl: downloadUrl,
+ isLocalFile: true,
+ message: `Saved ${safeFileName} to local workspace storage!`
});
} catch (error: any) {
console.error("Google Drive Upload Error:", error);
diff --git a/src/components/GoogleWorkspaceHub.tsx b/src/components/GoogleWorkspaceHub.tsx
index fa0bf53..328a7f8 100644
--- a/src/components/GoogleWorkspaceHub.tsx
+++ b/src/components/GoogleWorkspaceHub.tsx
@@ -211,6 +211,18 @@ export const GoogleWorkspaceHub: React.FC