-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
53 lines (42 loc) · 1.27 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const express = require("express");
const path = require("path");
const bodyParser = require("body-parser");
const settings = require("./backend/settings");
const search = require("./backend/search");
const process = require("./backend/process");
const bookmarks = require("./backend/bookmarks");
const folderSync = require("./backend/folderSync");
const fileCleaner = require("./backend/fileCleaner");
const { ipcMain, dialog } = require("electron");
ipcMain.handle("open-directory-dialog", async (event, defaultPath) => {
const result = await dialog.showOpenDialog({
properties: ["openDirectory"],
defaultPath,
});
return result.filePaths[0];
});
ipcMain.handle("open-file-dialog", async (event, defaultPath) => {
const result = await dialog.showOpenDialog({
properties: ["openFile"],
defaultPath,
});
return result.filePaths[0];
}
);
const app = express();
const fs = require("fs");
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.static(path.join(__dirname, "public")));
const port = 5000;
settings(app);
search(app);
process(app);
bookmarks(app);
folderSync(app);
fileCleaner(app);
app.listen(port, () => {
console.log(
`The app is listening on http://localhost:${port}/find/{searchParam}`
);
});