Skip to content

Commit 1d25d81

Browse files
committed
build
1 parent a57c09c commit 1d25d81

File tree

1 file changed

+50
-9
lines changed
  • resources/js/electron-plugin/dist/server/api

1 file changed

+50
-9
lines changed

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

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ router.post('/resize', (req, res) => {
2323
(_a = state.windows[id]) === null || _a === void 0 ? void 0 : _a.setSize(parseInt(width), parseInt(height));
2424
res.sendStatus(200);
2525
});
26+
router.post('/title', (req, res) => {
27+
var _a;
28+
const { id, title } = req.body;
29+
(_a = state.windows[id]) === null || _a === void 0 ? void 0 : _a.setTitle(title);
30+
res.sendStatus(200);
31+
});
32+
router.post('/url', (req, res) => {
33+
var _a;
34+
const { id, url } = req.body;
35+
(_a = state.windows[id]) === null || _a === void 0 ? void 0 : _a.loadURL(url);
36+
res.sendStatus(200);
37+
});
2638
router.post('/position', (req, res) => {
2739
var _a;
2840
const { id, x, y, animate } = req.body;
@@ -50,25 +62,54 @@ router.post('/hide', (req, res) => {
5062
}
5163
return res.sendStatus(200);
5264
});
65+
router.post('/always-on-top', (req, res) => {
66+
var _a;
67+
const { id, alwaysOnTop } = req.body;
68+
(_a = state.windows[id]) === null || _a === void 0 ? void 0 : _a.setAlwaysOnTop(alwaysOnTop);
69+
res.sendStatus(200);
70+
});
5371
router.get('/current', (req, res) => {
5472
const currentWindow = Object.values(state.windows).find(window => window.id === BrowserWindow.getFocusedWindow().id);
5573
const id = Object.keys(state.windows).find(key => state.windows[key] === currentWindow);
56-
res.json({
74+
res.json(getWindowData(id));
75+
});
76+
router.get('/get/:id', (req, res) => {
77+
const { id } = req.params;
78+
if (state.windows[id] === undefined) {
79+
res.sendStatus(404);
80+
return;
81+
}
82+
res.json(getWindowData(id));
83+
});
84+
function getWindowData(id) {
85+
const currentWindow = state.windows[id];
86+
if (state.windows[id] === undefined) {
87+
throw `Window [${id}] not found`;
88+
}
89+
return {
5790
id: id,
5891
x: currentWindow.getPosition()[0],
5992
y: currentWindow.getPosition()[1],
6093
width: currentWindow.getSize()[0],
6194
height: currentWindow.getSize()[1],
6295
title: currentWindow.getTitle(),
6396
alwaysOnTop: currentWindow.isAlwaysOnTop(),
64-
});
65-
});
66-
router.post('/always-on-top', (req, res) => {
67-
var _a;
68-
const { id, alwaysOnTop } = req.body;
69-
(_a = state.windows[id]) === null || _a === void 0 ? void 0 : _a.setAlwaysOnTop(alwaysOnTop);
70-
res.sendStatus(200);
71-
});
97+
url: currentWindow.webContents.getURL(),
98+
autoHideMenuBar: currentWindow.isMenuBarAutoHide(),
99+
fullscreen: currentWindow.isFullScreen(),
100+
fullscreenable: currentWindow.isFullScreenable(),
101+
kiosk: currentWindow.isKiosk(),
102+
showDevTools: currentWindow.webContents.isDevToolsOpened(),
103+
resizable: currentWindow.isResizable(),
104+
movable: currentWindow.isMovable(),
105+
minimizable: currentWindow.isMinimizable(),
106+
maximizable: currentWindow.isMaximizable(),
107+
closable: currentWindow.isClosable(),
108+
focusable: currentWindow.isFocusable(),
109+
focused: currentWindow.isFocused(),
110+
hasShadow: currentWindow.hasShadow(),
111+
};
112+
}
72113
router.post('/open', (req, res) => {
73114
let { id, x, y, frame, width, height, minWidth, minHeight, maxWidth, maxHeight, focusable, hasShadow, url, resizable, movable, minimizable, maximizable, closable, title, alwaysOnTop, titleBarStyle, trafficLightPosition, vibrancy, backgroundColor, transparency, showDevTools, fullscreen, fullscreenable, kiosk, autoHideMenuBar, } = req.body;
74115
if (state.windows[id]) {

0 commit comments

Comments
 (0)