Skip to content

Commit 7dad315

Browse files
authored
Manual Plugin Build (#187)
* Npm Install - Deps Update * Manual Plugin Build
1 parent 84443aa commit 7dad315

File tree

6 files changed

+1108
-1038
lines changed

6 files changed

+1108
-1038
lines changed

resources/js/electron-plugin/dist/server/api.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import bodyParser from "body-parser";
1212
import getPort, { portNumbers } from "get-port";
1313
import middleware from "./api/middleware.js";
1414
import clipboardRoutes from "./api/clipboard.js";
15+
import alertRoutes from "./api/alert.js";
1516
import appRoutes from "./api/app.js";
1617
import screenRoutes from "./api/screen.js";
1718
import dialogRoutes from "./api/dialog.js";
@@ -41,6 +42,7 @@ function startAPIServer(randomSecret) {
4142
httpServer.use(middleware(randomSecret));
4243
httpServer.use(bodyParser.json());
4344
httpServer.use("/api/clipboard", clipboardRoutes);
45+
httpServer.use("/api/alert", alertRoutes);
4446
httpServer.use("/api/app", appRoutes);
4547
httpServer.use("/api/screen", screenRoutes);
4648
httpServer.use("/api/dialog", dialogRoutes);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import express from 'express';
2+
import { dialog } from 'electron';
3+
const router = express.Router();
4+
router.post('/message', (req, res) => {
5+
const { message, type, title, detail, buttons, defaultId, cancelId } = req.body;
6+
const result = dialog.showMessageBoxSync({
7+
message,
8+
type,
9+
title,
10+
detail,
11+
buttons,
12+
defaultId,
13+
cancelId
14+
});
15+
res.json({
16+
result
17+
});
18+
});
19+
router.post('/error', (req, res) => {
20+
const { title, message } = req.body;
21+
dialog.showErrorBox(title, message);
22+
res.json({
23+
result: true
24+
});
25+
});
26+
export default router;

resources/js/electron-plugin/dist/server/api/app.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import express from 'express';
22
import { app } from 'electron';
33
const router = express.Router();
4+
router.post('/quit', (req, res) => {
5+
app.quit();
6+
res.sendStatus(200);
7+
});
48
router.post('/show', (req, res) => {
59
app.show();
610
res.sendStatus(200);
@@ -46,4 +50,15 @@ router.delete('/recent-documents', (req, res) => {
4650
app.clearRecentDocuments();
4751
res.sendStatus(200);
4852
});
53+
router.post('/open-at-login', (req, res) => {
54+
app.setLoginItemSettings({
55+
openAtLogin: req.body.open,
56+
});
57+
res.sendStatus(200);
58+
});
59+
router.get('/open-at-login', (req, res) => {
60+
res.json({
61+
open: app.getLoginItemSettings().openAtLogin,
62+
});
63+
});
4964
export default router;

resources/js/electron-plugin/dist/server/api/dialog.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,4 @@ router.post('/save', (req, res) => {
4949
result
5050
});
5151
});
52-
router.post('/message', (req, res) => {
53-
const { title, message, type, buttons } = req.body;
54-
const result = dialog.showMessageBoxSync({
55-
title,
56-
message,
57-
type,
58-
buttons
59-
});
60-
res.json({
61-
result
62-
});
63-
});
64-
router.post('/error', (req, res) => {
65-
const { title, message } = req.body;
66-
dialog.showErrorBox(title, message);
67-
res.json({
68-
result: true
69-
});
70-
});
7152
export default router;

0 commit comments

Comments
 (0)