Skip to content

Commit

Permalink
linkedin connections added + updating daily + scheduling improved
Browse files Browse the repository at this point in the history
  • Loading branch information
sahil-lalani committed Nov 13, 2024
1 parent 851c223 commit 6d996bb
Show file tree
Hide file tree
Showing 12 changed files with 248 additions and 562 deletions.
40 changes: 38 additions & 2 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
nativeImage,
Tray,
dialog,
session,
} from 'electron';
import { autoUpdater } from 'electron-updater';
import log from 'electron-log';
Expand Down Expand Up @@ -259,6 +260,42 @@ ipcMain.on('get-notion-credentials', async (event, company, name) => {
return await getNotionCredentials(company, name);
});

ipcMain.on('get-linkedin-credentials', async (event, company, name) => {
const userData = app.getPath('userData');
const linkedinCredentialsPath = path.join(
userData,
'surfer_data',
company,
name,
'linkedinCredentials.json',
);
fs.mkdirSync(path.dirname(linkedinCredentialsPath), {
recursive: true,
});
return new Promise((resolve) => {
session.defaultSession.webRequest.onBeforeSendHeaders(
{ urls: ['*://*.linkedin.com/*'] },
(details: any, callback) => {
let result: any = {
cookie: null as string | null,
csrfToken: null as string | null,
};
if (details.requestHeaders['csrf-token'] && details.requestHeaders['Cookie']) {
result.csrfToken = details.requestHeaders['csrf-token'];
result.cookie = details.requestHeaders['Cookie'];
fs.writeFileSync(
linkedinCredentialsPath,
JSON.stringify(result, null, 2),
);
resolve(result);
}

callback({ requestHeaders: details.requestHeaders });
},
);
});
});

ipcMain.handle('check-connected-platforms', async (event, platforms) => {
const userDataPath = app.getPath('userData');
const connectedPlatforms = {};
Expand Down Expand Up @@ -290,7 +327,6 @@ const getPlatforms = async () => {
'feed.js',
'github.js',
'twitter.js',
'linkedin.js',
'youtube.js',
];

Expand Down Expand Up @@ -742,7 +778,7 @@ const initializeExports = async () => {
if (platform.exportFrequency) {
console.log(`Checking exports for ${platform.name}`);
await runInitialExports(platform, runsResponse);
scheduleNextExport(platform);
scheduleNextExport(platform, runsResponse);

}
}
Expand Down
126 changes: 0 additions & 126 deletions src/main/platforms/Google/calendar.js

This file was deleted.

7 changes: 0 additions & 7 deletions src/main/platforms/Google/calendar.json

This file was deleted.

44 changes: 0 additions & 44 deletions src/main/platforms/Google/calendar.md

This file was deleted.

Loading

0 comments on commit 6d996bb

Please sign in to comment.