diff options
author | Minteck <contact@minteck.org> | 2023-02-06 22:53:16 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2023-02-06 22:53:16 +0100 |
commit | 8ecde1d333997b8e5ce8d9c9cf22927db6f40559 (patch) | |
tree | c2b923064a74c2a765b779539f52ed5689b4428e /app.js | |
parent | 10cc2bbcc2c8a97d8008ce8cd836637d2545004b (diff) | |
download | luna-8ecde1d333997b8e5ce8d9c9cf22927db6f40559.tar.gz luna-8ecde1d333997b8e5ce8d9c9cf22927db6f40559.tar.bz2 luna-8ecde1d333997b8e5ce8d9c9cf22927db6f40559.zip |
Updated 4 files (automated)
Diffstat (limited to 'app.js')
-rw-r--r-- | app.js | 63 |
1 files changed, 33 insertions, 30 deletions
@@ -4,7 +4,7 @@ const { writeFileSync, existsSync, readFileSync } = require('node:fs'); const axios = require('axios'); const si = require('systeminformation'); -global.luna_version = "1.0.0"; +global.luna_version = "1.1.0"; process.on('uncaughtException', (e) => { console.error(e); @@ -17,7 +17,7 @@ process.on('uncaughtException', (e) => { global.token = ""; -async function refresh() { +async function systemProfile() { let osInfo = await si.osInfo(); let baseboard = await si.baseboard(); let processes = (await si.processes()).list; @@ -63,7 +63,7 @@ async function refresh() { }) } - let sources = await desktopCapturer.getSources({ types: ['screen'], thumbnailSize: { width: 1920, height: 1080 } }); + let sources = await desktopCapturer.getSources({ types: ['screen'], thumbnailSize: { width: 445, height: 256 } }); for (let source of sources) { console.log(`Screen ${source.id} (${source.name})`); @@ -73,45 +73,33 @@ async function refresh() { gid: source.id, name: source.name, }); - console.log((await axios("https://ponies.equestria.horse/api/computer?type=screenshot", { - method: "post", - data: { - host: hostname(), - id: source.display_id, - data: source.thumbnail.toJPEG(80).toString("base64") - }, - headers: {'Cookie': 'PEH2_SESSION_TOKEN=' + token} - })).data); } - let windows = await desktopCapturer.getSources({ types: ['window'], thumbnailSize: { width: 1920, height: 1080 } }); + await axios("https://ponies.equestria.horse/api/computer?type=data", { + method: "post", + data, + headers: {'Cookie': 'PEH2_SESSION_TOKEN=' + token} + }); - for (let source of windows) { - console.log(`Window ${source.id} (${source.name})`); + writeFileSync("./data.json", JSON.stringify(data)); +} - data.windows.push({ - display: source.display_id, - gid: source.id, - name: source.name, - }); - console.log((await axios("https://ponies.equestria.horse/api/computer?type=window", { +async function refresh() { + let sources = await desktopCapturer.getSources({ types: ['screen'], thumbnailSize: { width: 445, height: 256 } }); + + for (let source of sources) { + console.log(`Screen ${source.id} (${source.name})`); + + console.log((await axios("https://ponies.equestria.horse/api/computer?type=screenshot", { method: "post", data: { host: hostname(), - id: source.id, + id: source.display_id, data: source.thumbnail.toJPEG(80).toString("base64") }, headers: {'Cookie': 'PEH2_SESSION_TOKEN=' + token} })).data); } - - await axios("https://ponies.equestria.horse/api/computer?type=data", { - method: "post", - data, - headers: {'Cookie': 'PEH2_SESSION_TOKEN=' + token} - }); - - writeFileSync("./data.json", JSON.stringify(data)); } app.whenReady().then(async () => { @@ -132,8 +120,23 @@ app.whenReady().then(async () => { if (platform() === "darwin") app.dock.hide(); refresh(); + systemProfile(); + + setInterval(async () => { + await axios("https://ponies.equestria.horse/api/computer?type=heartbeat", { + method: "POST", + data: { + host: hostname() + }, + headers: {'Cookie': 'PEH2_SESSION_TOKEN=' + token} + }); + }, 1000); setInterval(() => { refresh(); }, 60000); + + setInterval(() => { + systemProfile(); + }, 600000); })
\ No newline at end of file |