Skip to content

Commit

Permalink
The defult value works as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
haithamAbuElnasr committed Feb 27, 2024
1 parent bda4d21 commit f89c2ea
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 12 deletions.
13 changes: 2 additions & 11 deletions src/main/api/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import fs from 'fs';
import path from 'path';
import { connectJson } from '../db/connect';
import { defaultJobDetails } from '../types';
import { defaultJobDetails } from '../../renderer/types';

export const PROJECT_DIR = path.join(__dirname, '../../../projects');

Expand Down Expand Up @@ -37,16 +37,7 @@ export function createProjectDir(name: string) {
}

export function createJsonFile(name: string, domain: string) {
const obj = {
name,
domain,
subFinder: defaultJobDetails,
liveDomains: defaultJobDetails,
screenWin: defaultJobDetails,
archive: defaultJobDetails,
waybackurls_js: defaultJobDetails,
waybackurls_parameter: defaultJobDetails,
};
const obj = defaultJobDetails(name, domain);
const stringifyObj = JSON.stringify(obj);
try {
fs.writeFileSync(
Expand Down
38 changes: 37 additions & 1 deletion src/renderer/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ReactNode } from 'react';


export type DashboardMenu = {
href: string;
title: string;
Expand Down Expand Up @@ -29,3 +28,40 @@ export type ProjectDetails = {
liveDomains?: JobDetails;
};
};
export function defaultJobDetails(
name: string,
domain: string,
): ProjectDetails {
const ret: ProjectDetails = {
name,
domain,
recon: {
subfinder: {
result: 0,
run: false,
filePath: '',
date: '',
},
screens: {
result: 0,
run: false,
filePath: '',
date: '',
},
params: {
result: 0,
run: false,
filePath: '',
date: '',
},
liveDomains: {
result: 0,
run: false,
filePath: '',
date: '',
},
},
};

return ret;
}

0 comments on commit f89c2ea

Please sign in to comment.