Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19348b4b60 | ||
|
|
ce1eed391d | ||
|
|
fe6fe92656 | ||
|
|
3aea938cfb | ||
|
|
c39428fa42 | ||
|
|
7caa5bfc8a | ||
|
|
5f69961a9f | ||
|
|
f44d998016 | ||
|
|
3ea65a4af8 | ||
|
|
2ad49c3167 | ||
|
|
ef2093a25e | ||
|
|
2737eabd8a |
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
docs/
|
docs/
|
||||||
out/
|
out/
|
||||||
|
build.json
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ For a comprehensive guide on setting up MQTT with Home Assistant, please refer t
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
On the first run of the application, you may encounter a **setup procedure** and the Home Assistant **login screen**.
|
On the first run of the application, you may encounter a **setup procedure** and the Home Assistant **login screen**.
|
||||||
It's recommended to create a **dedicated user** (local access only) for your kiosk device.
|
It's recommended to create a dedicated Home Assistant user (local access only) for your kiosk device.
|
||||||
|
|
||||||
You might also need a physical keyboard or remote VNC access to input these credentials once.
|
You might also need a physical keyboard or remote VNC access to input these credentials once.
|
||||||
If your hardware is [supported](https://github.com/leukipp/touchkio/blob/main/HARDWARE.md) you may be able to activate the on-screen keyboard using the side [widget](https://github.com/leukipp/touchkio/issues/16).
|
If your hardware is [supported](https://github.com/leukipp/touchkio/blob/main/HARDWARE.md) you may be able to activate the on-screen keyboard using the side [widget](https://github.com/leukipp/touchkio/issues/16).
|
||||||
@@ -56,7 +56,6 @@ bash <(wget -qO- https://raw.githubusercontent.com/leukipp/touchkio/main/install
|
|||||||
```
|
```
|
||||||
Make sure that you run this with your **standard user** and not with root (sudo).
|
Make sure that you run this with your **standard user** and not with root (sudo).
|
||||||
If you are paranoid, or smart, or both, have a look into the [install.sh](https://github.com/leukipp/touchkio/blob/main/install.sh) script before executing external code on your machine.
|
If you are paranoid, or smart, or both, have a look into the [install.sh](https://github.com/leukipp/touchkio/blob/main/install.sh) script before executing external code on your machine.
|
||||||
This command can also be re-run to **update** an existing installation to the latest version.
|
|
||||||
|
|
||||||
The systemd **user service** is enabled by default and the kiosk application should start automatically the next time you boot.
|
The systemd **user service** is enabled by default and the kiosk application should start automatically the next time you boot.
|
||||||
If you need manual control use:
|
If you need manual control use:
|
||||||
@@ -89,6 +88,14 @@ yarn build
|
|||||||
|
|
||||||
</div></details>
|
</div></details>
|
||||||
|
|
||||||
|
#### Update
|
||||||
|
If you have already installed TouchKio and want to upgrade to the latest version, simply install the newer version over the existing one.
|
||||||
|
|
||||||
|
The [install.sh](https://github.com/leukipp/touchkio/blob/main/install.sh) script can also be run to update an existing installation to the **latest version**. The setup procedure can be skipped to use the existing default arguments from the configuration file:
|
||||||
|
```bash
|
||||||
|
bash <(wget -qO- https://raw.githubusercontent.com/leukipp/touchkio/main/install.sh) update
|
||||||
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
Running `touchkio --setup` will prompt you to enter arguments that will be used when the application starts without any specified arguments.
|
Running `touchkio --setup` will prompt you to enter arguments that will be used when the application starts without any specified arguments.
|
||||||
These default arguments are stored in `~/.config/touchkio/Arguments.json`, where they can also be modified.
|
These default arguments are stored in `~/.config/touchkio/Arguments.json`, where they can also be modified.
|
||||||
@@ -143,7 +150,7 @@ touchkio --web-url=http://192.168.1.42:8123 --mqtt-url=mqtt://192.168.1.42:1883
|
|||||||
## User Interface
|
## User Interface
|
||||||
TouchKio provides a simple webview window designed specifically for Touch Displays. Electron apps are known to be resource intensive due to their architecture and the inclusion of a full web browser environment. If you just run the kiosk application without other heavy loads, everything should run smoothly.
|
TouchKio provides a simple webview window designed specifically for Touch Displays. Electron apps are known to be resource intensive due to their architecture and the inclusion of a full web browser environment. If you just run the kiosk application without other heavy loads, everything should run smoothly.
|
||||||
|
|
||||||
### Controls
|
### Touch Controls
|
||||||
Additional controls can be found along the right edge of the kiosk application. For more details, you may want to have a closer look here:
|
Additional controls can be found along the right edge of the kiosk application. For more details, you may want to have a closer look here:
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
| ------------ | -------------------------------------------------------- |
|
| ------------ | -------------------------------------------------------- |
|
||||||
@@ -154,14 +161,14 @@ Additional controls can be found along the right edge of the kiosk application.
|
|||||||
|
|
||||||
### Keyboard Shortcuts
|
### Keyboard Shortcuts
|
||||||
The application also supports basic shortcuts to enhance navigation and usability for users who prefer or require non-touch input methods:
|
The application also supports basic shortcuts to enhance navigation and usability for users who prefer or require non-touch input methods:
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
| --------------------------- | --------------------------- |
|
| --------------------------- | ---------------------------- |
|
||||||
| `Control+Left` | Navigate to previous page |
|
| `Control+Left` | Navigate to previous page |
|
||||||
| `Control+Right` | Navigate to next page |
|
| `Control+Right` | Navigate to next page |
|
||||||
| `Control+Num_Subtract` | Decrease the page zoom |
|
| `Control+Num_Subtract` | Decrease the page zoom |
|
||||||
| `Control+Num_Add` | Increase the page zoom |
|
| `Control+Num_Add` | Increase the page zoom |
|
||||||
| `Alt+Left`/`Mouse+Back` | Navigate back in history |
|
| `Alt+Left`/`Mouse+Back` | Navigate backward in history |
|
||||||
| `Alt+Right`/`Mouse+Forward` | Navigate forward in history |
|
| `Alt+Right`/`Mouse+Forward` | Navigate forward in history |
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
To create your own local build, you first need to install [Node.js](https://pimylifeup.com/raspberry-pi-nodejs) and [Yarn](https://classic.yarnpkg.com/lang/en/docs/install).
|
To create your own local build, you first need to install [Node.js](https://pimylifeup.com/raspberry-pi-nodejs) and [Yarn](https://classic.yarnpkg.com/lang/en/docs/install).
|
||||||
@@ -268,13 +275,16 @@ Please have a look into the [hardware](https://github.com/leukipp/touchkio/blob/
|
|||||||
**Known Issues** that are by-design or for which there isn't a solution so far:
|
**Known Issues** that are by-design or for which there isn't a solution so far:
|
||||||
- You can use Raspberry Pi's build-in [screen blanking](https://www.raspberrypi.com/documentation/computers/configuration.html#screen-blanking-3) functionality, however, if the screen is turned on through Home Assistant after being automatically turned off, it will remain on indefinitely.
|
- You can use Raspberry Pi's build-in [screen blanking](https://www.raspberrypi.com/documentation/computers/configuration.html#screen-blanking-3) functionality, however, if the screen is turned on through Home Assistant after being automatically turned off, it will remain on indefinitely.
|
||||||
- It's recommended to either use the built-in screen blanking feature or implement a Home Assistant automation (e.g. presence detection) to manage the screen status.
|
- It's recommended to either use the built-in screen blanking feature or implement a Home Assistant automation (e.g. presence detection) to manage the screen status.
|
||||||
- When using a Raspberry Pi, the on-screen keyboard doesn't automatically pop-out when entering a text field inside the webview.
|
- When using a Raspberry Pi, the on-screen keyboard doesn't [automatically pop-out](https://github.com/leukipp/touchkio/issues/4) when entering a text field inside the webview.
|
||||||
- As a current [workaround](https://github.com/leukipp/touchkio/issues/4) you can use the side [widget](https://github.com/leukipp/touchkio/issues/16) to toggle the keyboard visibility.
|
- As a current workaround you can use the side [widget](https://github.com/leukipp/touchkio/issues/16) to toggle the keyboard visibility.
|
||||||
- Certain commands from the MQTT integration may require elevated privileges to work correctly.
|
- Certain commands from the MQTT integration may require elevated privileges to work correctly.
|
||||||
- Ensure that your local user has the [necessary permissions](https://github.com/leukipp/touchkio/issues/39) to run `sudo` without being prompted for a password.
|
- Ensure that your local user has the [necessary permissions](https://github.com/leukipp/touchkio/issues/39) to run `sudo` without being prompted for a password.
|
||||||
- On the terminal you may see some *ERROR:gbm_wrapper.cc* messages.
|
- On the terminal you may see some *ERROR:gbm_wrapper.cc* messages.
|
||||||
- This appears to be a [known issue](https://github.com/electron/electron/issues/42322) that currently lacks a fix, but the webview still works.
|
- This appears to be a [known issue](https://github.com/electron/electron/issues/42322) that currently lacks a fix, but the webview still works.
|
||||||
|
|
||||||
|
For debugging, stop the service and run `touchkio` directly on the terminal to view the log outputs.
|
||||||
|
If you encounter any problems, please [create an issue](https://github.com/leukipp/touchkio/issues) and include the output of `touchkio --version` along with your system setup and any additional terminal logs.
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
Thanks to Sebastian ([@pdsccode](https://github.com/pdsccode)) for his contributions on issues and [community](https://community.home-assistant.io/t/kiosk-mode-for-raspberry-pi-with-touch-display/821196) discussions.
|
Thanks to Sebastian ([@pdsccode](https://github.com/pdsccode)) for his contributions on issues and [community](https://community.home-assistant.io/t/kiosk-mode-for-raspberry-pi-with-touch-display/821196) discussions.
|
||||||
|
|
||||||
|
|||||||
+35
-2
@@ -1,4 +1,22 @@
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
const jszip = require("jszip");
|
||||||
|
const crypto = require("crypto");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
const date = new Date().toISOString();
|
||||||
|
|
||||||
|
const generateBuildFile = (platform, arch, maker) => {
|
||||||
|
const package = fs.readFileSync(path.join(__dirname, "package.json"), "utf8");
|
||||||
|
const hash = crypto.createHash("sha256").update(package);
|
||||||
|
const data = {
|
||||||
|
id: hash.digest("hex").slice(-6),
|
||||||
|
platform: platform,
|
||||||
|
arch: arch,
|
||||||
|
maker: maker,
|
||||||
|
date: date,
|
||||||
|
};
|
||||||
|
return JSON.stringify(data, null, 2);
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
packagerConfig: {
|
packagerConfig: {
|
||||||
@@ -33,10 +51,25 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
hooks: {
|
hooks: {
|
||||||
|
postPackage: async (config, results) => {
|
||||||
|
for (const outputPath of results.outputPaths) {
|
||||||
|
const [name, platform, arch] = path.basename(outputPath).split("-");
|
||||||
|
const buildFile = path.join(outputPath, "resources", "app", "build.json");
|
||||||
|
fs.writeFileSync(buildFile, generateBuildFile(platform, arch, "deb"), { encoding: "utf8" });
|
||||||
|
}
|
||||||
|
},
|
||||||
postMake: async (config, results) => {
|
postMake: async (config, results) => {
|
||||||
for (const result of results) {
|
for (const result of results) {
|
||||||
const artifacts = [];
|
const artifacts = [];
|
||||||
result.artifacts.forEach((artifact) => {
|
for (const artifact of result.artifacts) {
|
||||||
|
// Currently disabled for zip files as it seems to corrupt them
|
||||||
|
if (artifact.includes(".zip") && false) {
|
||||||
|
const [name, platform, arch] = path.basename(artifact).split("-");
|
||||||
|
const buildFile = path.join(`${name}-${platform}-${arch}`, "resources", "app", "build.json");
|
||||||
|
const zip = await jszip.loadAsync(fs.readFileSync(artifact, "utf8"));
|
||||||
|
zip.file(buildFile, generateBuildFile(platform, arch, "zip"));
|
||||||
|
fs.writeFileSync(artifact, await zip.generateAsync({ type: "nodebuffer" }));
|
||||||
|
}
|
||||||
if (artifact.includes("amd64")) {
|
if (artifact.includes("amd64")) {
|
||||||
const renamed = artifact.replace("amd64", "x64");
|
const renamed = artifact.replace("amd64", "x64");
|
||||||
fs.renameSync(artifact, renamed);
|
fs.renameSync(artifact, renamed);
|
||||||
@@ -44,7 +77,7 @@ module.exports = {
|
|||||||
} else {
|
} else {
|
||||||
artifacts.push(artifact);
|
artifacts.push(artifact);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
result.artifacts = artifacts;
|
result.artifacts = artifacts;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 78 KiB |
@@ -7,6 +7,7 @@ const hardware = require("./js/hardware");
|
|||||||
const webview = require("./js/webview");
|
const webview = require("./js/webview");
|
||||||
const { app } = require("electron");
|
const { app } = require("electron");
|
||||||
|
|
||||||
|
global.APP = global.APP || {};
|
||||||
global.ARGS = global.ARGS || {};
|
global.ARGS = global.ARGS || {};
|
||||||
|
|
||||||
if (!process.env.DISPLAY) {
|
if (!process.env.DISPLAY) {
|
||||||
@@ -23,20 +24,85 @@ if (!process.env.DISPLAY) {
|
|||||||
* initialization tasks.
|
* initialization tasks.
|
||||||
*/
|
*/
|
||||||
app.whenReady().then(async () => {
|
app.whenReady().then(async () => {
|
||||||
const lock = app.requestSingleInstanceLock();
|
if (!(await initApp()) || !(await initArgs())) {
|
||||||
if (!lock) {
|
return;
|
||||||
console.error("TouchKio is already running");
|
}
|
||||||
|
|
||||||
|
// Show used arguments
|
||||||
|
console.log(`Arguments: ${JSON.stringify(ARGS, null, 2)}`);
|
||||||
|
|
||||||
|
// Chained init functions
|
||||||
|
const chained = [webview.init, hardware.init, integration.init];
|
||||||
|
for (const init of chained) {
|
||||||
|
if (!(await init())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the global app object.
|
||||||
|
*
|
||||||
|
* @returns {bool} Returns true if the initialization was successful.
|
||||||
|
*/
|
||||||
|
const initApp = async () => {
|
||||||
|
const packageJsonPath = path.join(app.getAppPath(), "package.json");
|
||||||
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
||||||
|
|
||||||
|
const buildJsonPath = path.join(app.getAppPath(), "build.json");
|
||||||
|
const buildFileExists = fs.existsSync(buildJsonPath);
|
||||||
|
|
||||||
|
// Set required app infos
|
||||||
|
APP.name = app.getName();
|
||||||
|
APP.title = packageJson.title;
|
||||||
|
APP.version = app.getVersion();
|
||||||
|
APP.path = app.getAppPath();
|
||||||
|
APP.config = app.getPath("userData");
|
||||||
|
|
||||||
|
// Set additional update infos
|
||||||
|
APP.homepage = `https://github.com/${packageJson.author}/${packageJson.name}`;
|
||||||
|
APP.releases = {
|
||||||
|
url: `https://api.github.com/repos/${packageJson.author}/${packageJson.name}/releases`,
|
||||||
|
latest: null,
|
||||||
|
};
|
||||||
|
APP.scripts = {
|
||||||
|
install: `https://raw.githubusercontent.com/${packageJson.author}/${packageJson.name}/main/install.sh`,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set additional build infos
|
||||||
|
APP.build = {};
|
||||||
|
if (buildFileExists) {
|
||||||
|
APP.build = JSON.parse(fs.readFileSync(buildJsonPath, "utf8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Request single app instance lock
|
||||||
|
if (!app.requestSingleInstanceLock()) {
|
||||||
|
console.error(`${APP.title} is already running`);
|
||||||
return app.quit();
|
return app.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the global args object.
|
||||||
|
*
|
||||||
|
* @returns {bool} Returns true if the initialization was successful.
|
||||||
|
*/
|
||||||
|
const initArgs = async () => {
|
||||||
let args = parseArgs(process);
|
let args = parseArgs(process);
|
||||||
let argsProvided = !!Object.keys(args).length;
|
let argsProvided = !!Object.keys(args).length;
|
||||||
|
|
||||||
let argsFilePath = path.join(app.getPath("userData"), "Arguments.json");
|
let argsFilePath = path.join(APP.config, "Arguments.json");
|
||||||
let argsFileExists = fs.existsSync(argsFilePath);
|
let argsFileExists = fs.existsSync(argsFilePath);
|
||||||
|
|
||||||
// Show version and release info
|
// Show version and release info
|
||||||
if ("help" in args || "version" in args) {
|
if ("help" in args || "version" in args) {
|
||||||
console.log(`${app.getName()}-v${app.getVersion()}, https://github.com/leukipp/touchkio`);
|
let build = "";
|
||||||
|
if (APP.build.id) {
|
||||||
|
build = ` (${APP.build.id}), built on ${APP.build.date} (${APP.build.platform}-${APP.build.arch}-${APP.build.maker})`;
|
||||||
|
}
|
||||||
|
console.log(`${APP.name}-v${APP.version}${build}\n${APP.homepage}`);
|
||||||
return app.quit();
|
return app.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,24 +117,21 @@ app.whenReady().then(async () => {
|
|||||||
args = readArgs(argsFilePath);
|
args = readArgs(argsFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check arguments object
|
||||||
|
if (!Object.keys(args).length) {
|
||||||
|
console.error(`No arguments provided`);
|
||||||
|
return app.quit();
|
||||||
|
}
|
||||||
|
|
||||||
// Split url arguments
|
// Split url arguments
|
||||||
args.web_url = args.web_url || [];
|
args.web_url = args.web_url || [];
|
||||||
if (!Array.isArray(args.web_url)) {
|
if (!Array.isArray(args.web_url)) {
|
||||||
args.web_url = args.web_url.split(",").map((url) => url.trim());
|
args.web_url = args.web_url.split(",").map((url) => url.trim());
|
||||||
}
|
}
|
||||||
global.ARGS = args;
|
ARGS = args;
|
||||||
|
|
||||||
// Show used arguments
|
return true;
|
||||||
console.log(`Arguments: ${JSON.stringify(global.ARGS, null, 2)}\n`);
|
};
|
||||||
|
|
||||||
// Chained init functions
|
|
||||||
const chained = [webview.init, hardware.init, integration.init];
|
|
||||||
for (const init of chained) {
|
|
||||||
if (!(await init())) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses command-line arguments from the given process object.
|
* Parses command-line arguments from the given process object.
|
||||||
@@ -155,34 +218,41 @@ const promptArgs = async (proc) => {
|
|||||||
// Prompt questions and wait for the answers
|
// Prompt questions and wait for the answers
|
||||||
let args = {};
|
let args = {};
|
||||||
let ignore = [];
|
let ignore = [];
|
||||||
for (const { key, question, fallback } of prompts) {
|
try {
|
||||||
if (key === "mqtt") {
|
for (const { key, question, fallback } of prompts) {
|
||||||
const prompt = `${question} (${fallback}): `;
|
if (key === "mqtt") {
|
||||||
const answer = await read.question(prompt);
|
const prompt = `${question} (${fallback}): `;
|
||||||
const value = (answer.trim() || fallback.match(/[YN]/)[0]).toLowerCase();
|
const answer = await read.question(prompt);
|
||||||
if (!["y", "yes"].includes(value)) {
|
const value = (answer.trim() || fallback.match(/[YN]/)[0]).toLowerCase();
|
||||||
ignore = ignore.concat(["mqtt_url", "mqtt_user", "mqtt_password", "mqtt_discovery"]);
|
if (!["y", "yes"].includes(value)) {
|
||||||
}
|
ignore = ignore.concat(["mqtt_url", "mqtt_user", "mqtt_password", "mqtt_discovery"]);
|
||||||
} else if (key === "check") {
|
}
|
||||||
const json = JSON.stringify(args, null, 2);
|
} else if (key === "check") {
|
||||||
const prompt = `${question}\n${json}\n(${fallback}): `;
|
const json = JSON.stringify(args, null, 2);
|
||||||
const answer = await read.question(prompt);
|
const prompt = `${question}\n${json}\n(${fallback}): `;
|
||||||
const value = (answer.trim() || fallback.match(/[YN]/)[0]).toLowerCase();
|
const answer = await read.question(prompt);
|
||||||
if (!["y", "yes"].includes(value)) {
|
const value = (answer.trim() || fallback.match(/[YN]/)[0]).toLowerCase();
|
||||||
args = {};
|
if (!["y", "yes"].includes(value)) {
|
||||||
}
|
args = {};
|
||||||
} else if (!ignore.includes(key)) {
|
}
|
||||||
const prompt = `${question} (${fallback}): `;
|
} else if (!ignore.includes(key)) {
|
||||||
const answer = await read.question(prompt);
|
const prompt = `${question} (${fallback}): `;
|
||||||
const value = answer.trim() || fallback;
|
const answer = await read.question(prompt);
|
||||||
if (key === "web_url") {
|
const value = answer.trim() || fallback;
|
||||||
args[key] = value.split(",").map((v) => v.trim());
|
if (key === "web_url") {
|
||||||
} else {
|
args[key] = value.split(",").map((v) => v.trim());
|
||||||
args[key] = value;
|
} else {
|
||||||
|
args[key] = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`\n${error.message}`);
|
||||||
|
args = {};
|
||||||
|
app.quit();
|
||||||
|
} finally {
|
||||||
|
read.close();
|
||||||
}
|
}
|
||||||
read.close();
|
|
||||||
|
|
||||||
return args;
|
return args;
|
||||||
};
|
};
|
||||||
@@ -194,11 +264,15 @@ const promptArgs = async (proc) => {
|
|||||||
* @param {Object} args - The arguments object.
|
* @param {Object} args - The arguments object.
|
||||||
*/
|
*/
|
||||||
const writeArgs = (path, args) => {
|
const writeArgs = (path, args) => {
|
||||||
const argc = Object.assign({}, args);
|
try {
|
||||||
if ("mqtt_password" in argc) {
|
const argc = Object.assign({}, args);
|
||||||
argc.mqtt_password = encrypt(argc.mqtt_password);
|
if ("mqtt_password" in argc) {
|
||||||
|
argc.mqtt_password = encrypt(argc.mqtt_password);
|
||||||
|
}
|
||||||
|
fs.writeFileSync(path, JSON.stringify(argc, null, 2));
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Failed to write ${path}:`, error.message);
|
||||||
}
|
}
|
||||||
fs.writeFileSync(path, JSON.stringify(argc, null, 2));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,11 +282,16 @@ const writeArgs = (path, args) => {
|
|||||||
* @returns {Object} The arguments object.
|
* @returns {Object} The arguments object.
|
||||||
*/
|
*/
|
||||||
const readArgs = (path) => {
|
const readArgs = (path) => {
|
||||||
const args = JSON.parse(fs.readFileSync(path));
|
try {
|
||||||
if ("mqtt_password" in args) {
|
const args = JSON.parse(fs.readFileSync(path, "utf8"));
|
||||||
args.mqtt_password = decrypt(args.mqtt_password);
|
if ("mqtt_password" in args) {
|
||||||
|
args.mqtt_password = decrypt(args.mqtt_password);
|
||||||
|
}
|
||||||
|
return args;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Failed to parse ${path}:`, error.message);
|
||||||
}
|
}
|
||||||
return args;
|
return {};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -223,7 +302,7 @@ const readArgs = (path) => {
|
|||||||
*/
|
*/
|
||||||
const encrypt = (value) => {
|
const encrypt = (value) => {
|
||||||
const iv = crypto.randomBytes(16);
|
const iv = crypto.randomBytes(16);
|
||||||
const key = crypto.scryptSync(hardware.getMachineId(), app.getName(), 32);
|
const key = crypto.scryptSync(hardware.getMachineId(), APP.name, 32);
|
||||||
const cipher = crypto.createCipheriv("aes-256-cbc", key, iv);
|
const cipher = crypto.createCipheriv("aes-256-cbc", key, iv);
|
||||||
let encrypted = cipher.update(value, "utf8", "hex");
|
let encrypted = cipher.update(value, "utf8", "hex");
|
||||||
encrypted += cipher.final("hex");
|
encrypted += cipher.final("hex");
|
||||||
@@ -239,7 +318,7 @@ const encrypt = (value) => {
|
|||||||
const decrypt = (value) => {
|
const decrypt = (value) => {
|
||||||
const p = Buffer.from(value, "base64").toString("utf8").split(":");
|
const p = Buffer.from(value, "base64").toString("utf8").split(":");
|
||||||
const iv = Buffer.from(p.shift(), "hex");
|
const iv = Buffer.from(p.shift(), "hex");
|
||||||
const key = crypto.scryptSync(hardware.getMachineId(), app.getName(), 32);
|
const key = crypto.scryptSync(hardware.getMachineId(), APP.name, 32);
|
||||||
const decipher = crypto.createDecipheriv("aes-256-cbc", key, iv);
|
const decipher = crypto.createDecipheriv("aes-256-cbc", key, iv);
|
||||||
const buffer = Buffer.from(p.join(":"), "hex");
|
const buffer = Buffer.from(p.join(":"), "hex");
|
||||||
let decrypted = decipher.update(buffer, "binary", "utf8");
|
let decrypted = decipher.update(buffer, "binary", "utf8");
|
||||||
|
|||||||
+43
-41
@@ -1,5 +1,13 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Read arguments
|
||||||
|
ARG_UPDATE=false
|
||||||
|
for arg in "$@"; do
|
||||||
|
if [ "$arg" = "update" ]; then
|
||||||
|
ARG_UPDATE=true
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Determine system architecture
|
# Determine system architecture
|
||||||
echo -e "Determining system architecture..."
|
echo -e "Determining system architecture..."
|
||||||
|
|
||||||
@@ -12,57 +20,39 @@ case "$(uname -m)" in
|
|||||||
ARCH="x64"
|
ARCH="x64"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Architecture $(uname -m) running $BITS-bit operating system is not supported."
|
{ echo "Architecture $(uname -m) running $BITS-bit operating system is not supported."; exit 1; }
|
||||||
exit 1
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$BITS" -ne 64 ]; then
|
[ "$BITS" -eq 64 ] || { echo "Architecture $ARCH running $BITS-bit operating system is not supported."; exit 1; }
|
||||||
echo "Architecture $ARCH running $BITS-bit operating system is not supported."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Architecture $ARCH running $BITS-bit operating system is supported."
|
echo "Architecture $ARCH running $BITS-bit operating system is supported."
|
||||||
|
|
||||||
# Download the latest .deb package
|
# Download the latest .deb package
|
||||||
echo -e "\nDownloading the latest release..."
|
echo -e "\nDownloading the latest release..."
|
||||||
|
|
||||||
|
TMP_DIR=$(mktemp -d)
|
||||||
DEB_URL=$(wget -qO- https://api.github.com/repos/leukipp/touchkio/releases/latest | \
|
DEB_URL=$(wget -qO- https://api.github.com/repos/leukipp/touchkio/releases/latest | \
|
||||||
grep -o "\"browser_download_url\": \"[^\"]*_${ARCH}\.deb\"" | \
|
grep -o "\"browser_download_url\": \"[^\"]*_${ARCH}\.deb\"" | \
|
||||||
sed 's/"browser_download_url": "//;s/"//g')
|
sed 's/"browser_download_url": "//;s/"//g')
|
||||||
|
|
||||||
TMP_DIR=$(mktemp -d)
|
|
||||||
DEB_PATH="${TMP_DIR}/$(basename "$DEB_URL")"
|
DEB_PATH="${TMP_DIR}/$(basename "$DEB_URL")"
|
||||||
chmod 755 "$TMP_DIR"
|
chmod 755 "$TMP_DIR"
|
||||||
|
|
||||||
if [ -z "$DEB_URL" ]; then
|
[ -z "$DEB_URL" ] && { echo "Download url for .deb file not found."; exit 1; }
|
||||||
echo "Download url for .deb file not found."
|
wget --show-progress -q -O "$DEB_PATH" "$DEB_URL" || { echo "Failed to download the .deb file."; exit 1; }
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! wget --show-progress -q -O "$DEB_PATH" "$DEB_URL"; then
|
|
||||||
echo "Failed to download the .deb file."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install the latest .deb package
|
# Install the latest .deb package
|
||||||
echo -e "\nInstalling the latest release..."
|
echo -e "\nInstalling the latest release..."
|
||||||
|
|
||||||
if ! command -v apt &> /dev/null; then
|
command -v apt &> /dev/null || { echo "Package manager apt was not found."; exit 1; }
|
||||||
echo "Package manager apt was not found."
|
sudo apt install -y "$DEB_PATH" || { echo "Installation of .deb file failed."; exit 1; }
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! sudo apt install "$DEB_PATH"; then
|
|
||||||
echo "Installation of .deb file failed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create the systemd user service
|
# Create the systemd user service
|
||||||
echo -e "\nCreating systemd user service..."
|
echo -e "\nCreating systemd user service..."
|
||||||
|
|
||||||
SERVICE_FILE="$HOME/.config/systemd/user/touchkio.service"
|
SERVICE_NAME="touchkio.service"
|
||||||
mkdir -p "$(dirname "$SERVICE_FILE")" || { echo "Failed to create directory for $SERVICE_FILE"; exit 1; }
|
SERVICE_FILE="$HOME/.config/systemd/user/$SERVICE_NAME"
|
||||||
|
mkdir -p "$(dirname "$SERVICE_FILE")" || { echo "Failed to create directory for $SERVICE_FILE."; exit 1; }
|
||||||
|
|
||||||
SERVICE_CONTENT="[Unit]
|
SERVICE_CONTENT="[Unit]
|
||||||
Description=TouchKio
|
Description=TouchKio
|
||||||
After=graphical.target
|
After=graphical.target
|
||||||
@@ -76,20 +66,28 @@ RestartSec=5s
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target"
|
WantedBy=default.target"
|
||||||
|
|
||||||
|
if $ARG_UPDATE; then
|
||||||
|
if systemctl --user --quiet is-active "${SERVICE_NAME}"; then
|
||||||
|
systemctl --user restart "${SERVICE_NAME}"
|
||||||
|
echo "Existing $SERVICE_NAME restarted."
|
||||||
|
else
|
||||||
|
echo "Existing $SERVICE_NAME not running, start touchkio manually."
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
SERVICE_CREATE=true
|
SERVICE_CREATE=true
|
||||||
if [ -f "$SERVICE_FILE" ]; then
|
if [ -f "$SERVICE_FILE" ]; then
|
||||||
read -p "Service $SERVICE_FILE exists, overwrite? (y/N) " overwrite
|
read -p "Service $SERVICE_FILE exists, overwrite? (y/N) " overwrite
|
||||||
if [[ ! ${overwrite:-n} == [Yy]* ]]; then
|
[[ ${overwrite:-n} == [Yy]* ]] || SERVICE_CREATE=false
|
||||||
SERVICE_CREATE=false
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$SERVICE_CREATE" = true ]; then
|
if $SERVICE_CREATE; then
|
||||||
echo "$SERVICE_CONTENT" > "$SERVICE_FILE" || { echo "Failed to write to $SERVICE_FILE"; exit 1; }
|
echo "$SERVICE_CONTENT" > "$SERVICE_FILE" || { echo "Failed to write to $SERVICE_FILE."; exit 1; }
|
||||||
systemctl --user enable "$(basename "$SERVICE_FILE")" || { echo "Failed to enable service $SERVICE_FILE"; exit 1; }
|
systemctl --user enable "$(basename "$SERVICE_FILE")" || { echo "Failed to enable service $SERVICE_FILE."; exit 1; }
|
||||||
echo "Service $SERVICE_FILE enabled"
|
echo "Service $SERVICE_FILE enabled."
|
||||||
else
|
else
|
||||||
echo "Service $SERVICE_FILE not created"
|
echo "Service $SERVICE_FILE not created."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Export display variables
|
# Export display variables
|
||||||
@@ -97,20 +95,22 @@ echo -e "\nExporting display variables..."
|
|||||||
|
|
||||||
if [ -z "$DISPLAY" ]; then
|
if [ -z "$DISPLAY" ]; then
|
||||||
export DISPLAY=":0"
|
export DISPLAY=":0"
|
||||||
echo "DISPLAY was not set, defaulting to \"$DISPLAY\""
|
echo "DISPLAY was not set, defaulting to \"$DISPLAY\"."
|
||||||
else
|
else
|
||||||
echo "DISPLAY is set to \"$DISPLAY\""
|
echo "DISPLAY is set to \"$DISPLAY\"."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$WAYLAND_DISPLAY" ]; then
|
if [ -z "$WAYLAND_DISPLAY" ]; then
|
||||||
export WAYLAND_DISPLAY="wayland-0"
|
export WAYLAND_DISPLAY="wayland-0"
|
||||||
echo "WAYLAND_DISPLAY was not set, defaulting to \"$WAYLAND_DISPLAY\""
|
echo "WAYLAND_DISPLAY was not set, defaulting to \"$WAYLAND_DISPLAY\"."
|
||||||
else
|
else
|
||||||
echo "WAYLAND_DISPLAY is set to \"$WAYLAND_DISPLAY\""
|
echo "WAYLAND_DISPLAY is set to \"$WAYLAND_DISPLAY\"."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the setup mode
|
# Start the setup mode
|
||||||
echo ""
|
echo ""
|
||||||
read -p "Start touchkio setup? (Y/n) " setup
|
read -p "Start touchkio setup? (Y/n) " setup
|
||||||
|
|
||||||
if [[ ${setup:-y} == [Yy]* ]]; then
|
if [[ ${setup:-y} == [Yy]* ]]; then
|
||||||
echo "/usr/bin/touchkio --setup"
|
echo "/usr/bin/touchkio --setup"
|
||||||
/usr/bin/touchkio --setup
|
/usr/bin/touchkio --setup
|
||||||
@@ -118,3 +118,5 @@ else
|
|||||||
echo "/usr/bin/touchkio"
|
echo "/usr/bin/touchkio"
|
||||||
/usr/bin/touchkio
|
/usr/bin/touchkio
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|||||||
+145
-53
@@ -42,10 +42,6 @@ const init = async () => {
|
|||||||
console.warn("Operating system is not supported\n");
|
console.warn("Operating system is not supported\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!sessionRights()) {
|
|
||||||
console.warn(`User "${sessionUser()}" is missing password-less sudo rights\n`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init globals
|
// Init globals
|
||||||
HARDWARE.session.user = sessionUser();
|
HARDWARE.session.user = sessionUser();
|
||||||
@@ -60,7 +56,7 @@ const init = async () => {
|
|||||||
HARDWARE.initialized = true;
|
HARDWARE.initialized = true;
|
||||||
|
|
||||||
// Show supported features
|
// Show supported features
|
||||||
console.log(`Supported: ${JSON.stringify(HARDWARE.support, null, 2)}`);
|
console.log(`\nSupported: ${JSON.stringify(HARDWARE.support, null, 2)}`);
|
||||||
|
|
||||||
// Show session infos
|
// Show session infos
|
||||||
console.log("\nUser:", HARDWARE.session.user);
|
console.log("\nUser:", HARDWARE.session.user);
|
||||||
@@ -71,6 +67,7 @@ const init = async () => {
|
|||||||
console.log("\nModel:", getModel());
|
console.log("\nModel:", getModel());
|
||||||
console.log("Vendor:", getVendor());
|
console.log("Vendor:", getVendor());
|
||||||
console.log("Serial Number:", getSerialNumber());
|
console.log("Serial Number:", getSerialNumber());
|
||||||
|
console.log("Network Addresses:", getNetworkAddresses());
|
||||||
console.log("Host Name:", getHostName());
|
console.log("Host Name:", getHostName());
|
||||||
|
|
||||||
// Show system infos
|
// Show system infos
|
||||||
@@ -161,19 +158,6 @@ const compatibleSystem = () => {
|
|||||||
return paths.every((path) => fs.existsSync(path));
|
return paths.every((path) => fs.existsSync(path));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Verifies user rights to run sudo commands without a password.
|
|
||||||
*
|
|
||||||
* @returns {bool} Returns true if password-less sudo rights exists.
|
|
||||||
*/
|
|
||||||
const sessionRights = () => {
|
|
||||||
if (!commandExists("sudo")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const result = execSyncCommand("sudo", ["-n", "true"]);
|
|
||||||
return result !== null && !result.includes("password is required");
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the session user name using `os.userInfo()`.
|
* Gets the session user name using `os.userInfo()`.
|
||||||
*
|
*
|
||||||
@@ -214,7 +198,7 @@ const sessionDesktop = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks supported features based on global properties.
|
* Checks supported features based on hardware and software.
|
||||||
*
|
*
|
||||||
* @returns {Object} Returns support object with boolean values.
|
* @returns {Object} Returns support object with boolean values.
|
||||||
*/
|
*/
|
||||||
@@ -223,11 +207,16 @@ const checkSupport = () => {
|
|||||||
const status = HARDWARE.display.status;
|
const status = HARDWARE.display.status;
|
||||||
const brightness = HARDWARE.display.brightness;
|
const brightness = HARDWARE.display.brightness;
|
||||||
const keyboard = processRuns("squeekboard");
|
const keyboard = processRuns("squeekboard");
|
||||||
|
const service = serviceRuns(APP.name);
|
||||||
|
const sudo = sudoRights();
|
||||||
|
const deb = APP.build.maker === "deb";
|
||||||
return {
|
return {
|
||||||
batteryLevel: battery.path !== null,
|
batteryLevel: !!battery.path,
|
||||||
displayStatus: status.path !== null && status.command !== null,
|
displayStatus: !!status.path && !!status.command,
|
||||||
displayBrightness: brightness.path !== null && brightness.max !== null,
|
displayBrightness: sudo && !!brightness.path && !!brightness.max,
|
||||||
keyboardVisibility: keyboard === true,
|
keyboardVisibility: keyboard,
|
||||||
|
sudoRights: sudo,
|
||||||
|
appUpdate: sudo && service && deb,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -240,7 +229,7 @@ const getModel = () => {
|
|||||||
const paths = ["/sys/firmware/devicetree/base/model", "/sys/class/dmi/id/product_name"];
|
const paths = ["/sys/firmware/devicetree/base/model", "/sys/class/dmi/id/product_name"];
|
||||||
for (const path of paths) {
|
for (const path of paths) {
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
return execSyncCommand("sudo", ["cat", path]) || "Generic";
|
return execSyncCommand("cat", [path]) || "Generic";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "Generic";
|
return "Generic";
|
||||||
@@ -255,7 +244,7 @@ const getVendor = () => {
|
|||||||
const paths = ["/sys/class/dmi/id/board_vendor"];
|
const paths = ["/sys/class/dmi/id/board_vendor"];
|
||||||
for (const path of paths) {
|
for (const path of paths) {
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
return execSyncCommand("sudo", ["cat", path]) || "Generic";
|
return execSyncCommand("cat", [path]) || "Generic";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const model = getModel();
|
const model = getModel();
|
||||||
@@ -266,22 +255,22 @@ const getVendor = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the serial number using `/sys/firmware/devicetree/base/serial-number` or `/sys/class/dmi/id/product_serial`.
|
* Gets the serial number using `/sys/firmware/devicetree/base/serial-number`.
|
||||||
*
|
*
|
||||||
* @returns {string} The serial number of the device or '123456' if not found.
|
* @returns {string} The serial number or machine id parts of the device or '123456' if not found.
|
||||||
*/
|
*/
|
||||||
const getSerialNumber = () => {
|
const getSerialNumber = () => {
|
||||||
const paths = ["/sys/firmware/devicetree/base/serial-number", "/sys/class/dmi/id/product_serial"];
|
const paths = ["/sys/firmware/devicetree/base/serial-number"];
|
||||||
for (const path of paths) {
|
for (const path of paths) {
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
return execSyncCommand("sudo", ["cat", path]) || "123456";
|
return execSyncCommand("cat", [path]) || "123456";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "123456";
|
return getMachineId().slice(-6);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the host machine id using `/etc/machine-id`.
|
* Gets the machine id using `/etc/machine-id`.
|
||||||
*
|
*
|
||||||
* @returns {string} The machine id of the system or '123456' if not found.
|
* @returns {string} The machine id of the system or '123456' if not found.
|
||||||
*/
|
*/
|
||||||
@@ -289,12 +278,38 @@ const getMachineId = () => {
|
|||||||
const paths = ["/etc/machine-id"];
|
const paths = ["/etc/machine-id"];
|
||||||
for (const path of paths) {
|
for (const path of paths) {
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
return execSyncCommand("sudo", ["cat", path]) || "123456";
|
return execSyncCommand("cat", [path]) || "123456";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "123456";
|
return "123456";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the network interfaces addresses using `os.networkInterfaces()`.
|
||||||
|
*
|
||||||
|
* @returns {Object} The network addresses of all interfaces.
|
||||||
|
*/
|
||||||
|
const getNetworkAddresses = () => {
|
||||||
|
const addresses = {};
|
||||||
|
for (const [key, interfaces] of Object.entries(os.networkInterfaces())) {
|
||||||
|
for (const interface of interfaces) {
|
||||||
|
if (interface.internal || !interface.family || !interface.address) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const name = key.charAt(0).toUpperCase() + key.slice(1);
|
||||||
|
if (!addresses[name]) {
|
||||||
|
addresses[name] = {};
|
||||||
|
}
|
||||||
|
const family = interface.family;
|
||||||
|
if (!addresses[name][family]) {
|
||||||
|
addresses[name][family] = [];
|
||||||
|
}
|
||||||
|
addresses[name][family].push(interface.address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return addresses;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the host name of the current system using `os.hostname()`.
|
* Gets the host name of the current system using `os.hostname()`.
|
||||||
*
|
*
|
||||||
@@ -451,22 +466,22 @@ const getDisplayStatus = () => {
|
|||||||
case "wlopm":
|
case "wlopm":
|
||||||
const wlopm = execSyncCommand("wlopm", []);
|
const wlopm = execSyncCommand("wlopm", []);
|
||||||
if (wlopm !== null) {
|
if (wlopm !== null) {
|
||||||
const out = wlopm.split("\n")[0].split(" ");
|
const output = wlopm.split("\n")[0].split(" ");
|
||||||
return out.pop().toUpperCase();
|
return output.pop().toUpperCase();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "kscreen-doctor":
|
case "kscreen-doctor":
|
||||||
const kdoc = execSyncCommand("kscreen-doctor", ["--dpms", "show"]);
|
const kdoc = execSyncCommand("kscreen-doctor", ["--dpms", "show"]);
|
||||||
if (kdoc !== null) {
|
if (kdoc !== null) {
|
||||||
const out = kdoc.split("\n")[0].split(" ");
|
const output = kdoc.split("\n")[0].split(" ");
|
||||||
return out.pop().toUpperCase();
|
return output.pop().toUpperCase();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "xset":
|
case "xset":
|
||||||
const xset = execSyncCommand("xset", ["-q"]);
|
const xset = execSyncCommand("xset", ["-q"]);
|
||||||
if (xset !== null) {
|
if (xset !== null) {
|
||||||
const on = /Monitor is On/.test(xset);
|
const output = /Monitor is On/.test(xset);
|
||||||
return on ? "ON" : "OFF";
|
return output ? "ON" : "OFF";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -641,6 +656,10 @@ const checkPackageUpgrades = () => {
|
|||||||
* @param {Function} callback - A callback function that receives the output or error.
|
* @param {Function} callback - A callback function that receives the output or error.
|
||||||
*/
|
*/
|
||||||
const shutdownSystem = (callback = null) => {
|
const shutdownSystem = (callback = null) => {
|
||||||
|
if (!HARDWARE.support.sudoRights) {
|
||||||
|
if (typeof callback === "function") callback(null, "Not supported");
|
||||||
|
return;
|
||||||
|
}
|
||||||
execAsyncCommand("sudo", ["shutdown", "-h", "now"], callback);
|
execAsyncCommand("sudo", ["shutdown", "-h", "now"], callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -653,9 +672,39 @@ const shutdownSystem = (callback = null) => {
|
|||||||
* @param {Function} callback - A callback function that receives the output or error.
|
* @param {Function} callback - A callback function that receives the output or error.
|
||||||
*/
|
*/
|
||||||
const rebootSystem = (callback = null) => {
|
const rebootSystem = (callback = null) => {
|
||||||
|
if (!HARDWARE.support.sudoRights) {
|
||||||
|
if (typeof callback === "function") callback(null, "Not supported");
|
||||||
|
return;
|
||||||
|
}
|
||||||
execAsyncCommand("sudo", ["reboot"], callback);
|
execAsyncCommand("sudo", ["reboot"], callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if sudo commands can run without a password.
|
||||||
|
*
|
||||||
|
* @returns {bool} Returns true if password-less sudo rights exists.
|
||||||
|
*/
|
||||||
|
const sudoRights = () => {
|
||||||
|
try {
|
||||||
|
const output = cpr.execSync(`sudo -n true`, { encoding: "utf8" });
|
||||||
|
return output !== null && !output.includes("password is required");
|
||||||
|
} catch {}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a service is running using `systemctl`.
|
||||||
|
*
|
||||||
|
* @param {string} name - The service name to check.
|
||||||
|
* @returns {bool} Returns true if the service runs.
|
||||||
|
*/
|
||||||
|
const serviceRuns = (name) => {
|
||||||
|
try {
|
||||||
|
return !!cpr.execSync(`systemctl --user is-active ${name}`, { encoding: "utf8" });
|
||||||
|
} catch {}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a process is running using `pidof`.
|
* Checks if a process is running using `pidof`.
|
||||||
*
|
*
|
||||||
@@ -732,14 +781,61 @@ const execAsyncCommand = (cmd, args = [], callback = null) => {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Execute Async:", error.message);
|
console.error("Execute Async:", error.message);
|
||||||
if (typeof callback === "function") {
|
if (typeof callback === "function") callback(null, error.message);
|
||||||
callback(null, error.message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return proc;
|
return proc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes a script command asynchronously.
|
||||||
|
*
|
||||||
|
* @param {string} cmd - The script to execute.
|
||||||
|
* @param {Array<string>} args - The arguments for the command.
|
||||||
|
* @param {Function} callback - A callback function that receives the progress or error.
|
||||||
|
* @returns {Object} The spawned process object.
|
||||||
|
*/
|
||||||
|
const execScriptCommand = (cmd, args = [], callback = null) => {
|
||||||
|
let progress = 10;
|
||||||
|
let proc = cpr.spawn(cmd, args);
|
||||||
|
if (typeof callback === "function") callback(progress, null);
|
||||||
|
proc.stdout.on("data", (data) => {
|
||||||
|
if (data) {
|
||||||
|
const lines = data.toString().trim();
|
||||||
|
const output = lines.replace(/\n+/g, "\n").replace(/^\n+|\n+$|\0/g, "");
|
||||||
|
if (output) {
|
||||||
|
console.log(output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
proc.stderr.on("data", (data) => {
|
||||||
|
if (data) {
|
||||||
|
const lines = data.toString().trim();
|
||||||
|
const output = lines.replace(/\n+/g, "\n").replace(/^\n+|\n+$|\0/g, "");
|
||||||
|
if (output) {
|
||||||
|
const matches = output.match(/(\d{1,3})%/g);
|
||||||
|
if (matches) {
|
||||||
|
const match = Math.max(...matches.map((p) => parseInt(p)));
|
||||||
|
const percent = Math.floor(match / 10) * 10;
|
||||||
|
if (percent > 10 && percent > progress) {
|
||||||
|
progress = percent;
|
||||||
|
if (typeof callback === "function") callback(progress - 10, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
proc.on("close", (code) => {
|
||||||
|
if (code !== 0) {
|
||||||
|
console.log(`Script exited with error code ${code}.`);
|
||||||
|
if (typeof callback === "function") callback(null, code);
|
||||||
|
} else {
|
||||||
|
console.log("Script exited successfully.");
|
||||||
|
if (typeof callback === "function") callback(100, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a D-Bus method call synchronously using `dbus-send`.
|
* Executes a D-Bus method call synchronously using `dbus-send`.
|
||||||
*
|
*
|
||||||
@@ -755,14 +851,10 @@ const dbusCall = (path, method, values, callback = null) => {
|
|||||||
const args = ["--print-reply", "--type=method_call", `--dest=${dest}`];
|
const args = ["--print-reply", "--type=method_call", `--dest=${dest}`];
|
||||||
try {
|
try {
|
||||||
const output = cpr.execSync([cmd, ...args].join(" ").trim(), { encoding: "utf8" });
|
const output = cpr.execSync([cmd, ...args].join(" ").trim(), { encoding: "utf8" });
|
||||||
if (typeof callback === "function") {
|
if (typeof callback === "function") callback(output.trim().replace(/\0/g, ""), null);
|
||||||
callback(output.trim().replace(/\0/g, "").split("\n").slice(1).join("\n").trim(), null);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Call D-Bus:", error.message);
|
console.error("Call D-Bus:", error.message);
|
||||||
if (typeof callback === "function") {
|
if (typeof callback === "function") callback(null, error.message);
|
||||||
callback(null, error.message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -796,17 +888,13 @@ const dbusMonitor = (path, callback) => {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Monitor D-Bus:", error.message);
|
console.error("Monitor D-Bus:", error.message);
|
||||||
if (typeof callback === "function") {
|
if (typeof callback === "function") callback(null, error.message);
|
||||||
callback(null, error.message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
proc.stderr.on("data", (data) => {
|
proc.stderr.on("data", (data) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
console.error("Monitor D-Bus:", data.toString());
|
console.error("Monitor D-Bus:", data.toString());
|
||||||
if (typeof callback === "function") {
|
if (typeof callback === "function") callback(null, data.toString());
|
||||||
callback(null, data.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return proc;
|
return proc;
|
||||||
@@ -839,6 +927,7 @@ module.exports = {
|
|||||||
getVendor,
|
getVendor,
|
||||||
getSerialNumber,
|
getSerialNumber,
|
||||||
getMachineId,
|
getMachineId,
|
||||||
|
getNetworkAddresses,
|
||||||
getHostName,
|
getHostName,
|
||||||
getUpTime,
|
getUpTime,
|
||||||
getMemorySize,
|
getMemorySize,
|
||||||
@@ -855,4 +944,7 @@ module.exports = {
|
|||||||
checkPackageUpgrades,
|
checkPackageUpgrades,
|
||||||
shutdownSystem,
|
shutdownSystem,
|
||||||
rebootSystem,
|
rebootSystem,
|
||||||
|
execSyncCommand,
|
||||||
|
execAsyncCommand,
|
||||||
|
execScriptCommand,
|
||||||
};
|
};
|
||||||
|
|||||||
+118
-24
@@ -39,14 +39,15 @@ const init = async () => {
|
|||||||
// Init globals
|
// Init globals
|
||||||
INTEGRATION.discovery = discovery;
|
INTEGRATION.discovery = discovery;
|
||||||
INTEGRATION.node = `rpi_${deviceId}`;
|
INTEGRATION.node = `rpi_${deviceId}`;
|
||||||
INTEGRATION.root = `${app.getName()}/${INTEGRATION.node}`;
|
INTEGRATION.root = `${APP.name}/${INTEGRATION.node}`;
|
||||||
INTEGRATION.device = {
|
INTEGRATION.device = {
|
||||||
name: `TouchKio ${deviceName}`,
|
name: `${APP.title} ${deviceName}`,
|
||||||
model: model,
|
model: model,
|
||||||
manufacturer: vendor,
|
manufacturer: vendor,
|
||||||
serial_number: serialNumber,
|
serial_number: serialNumber,
|
||||||
identifiers: [INTEGRATION.node],
|
identifiers: [INTEGRATION.node],
|
||||||
sw_version: `${app.getName()}-v${app.getVersion()}`,
|
sw_version: `${APP.name}-v${APP.version}`,
|
||||||
|
configuration_url: APP.homepage,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Connection settings
|
// Connection settings
|
||||||
@@ -61,6 +62,7 @@ const init = async () => {
|
|||||||
console.log(`MQTT Connected: ${url.toString()}\n`);
|
console.log(`MQTT Connected: ${url.toString()}\n`);
|
||||||
|
|
||||||
// Init client controls
|
// Init client controls
|
||||||
|
initApp();
|
||||||
initShutdown();
|
initShutdown();
|
||||||
initReboot();
|
initReboot();
|
||||||
initRefresh();
|
initRefresh();
|
||||||
@@ -75,6 +77,7 @@ const init = async () => {
|
|||||||
initModel();
|
initModel();
|
||||||
initSerialNumber();
|
initSerialNumber();
|
||||||
initHostName();
|
initHostName();
|
||||||
|
initNetworkAddress();
|
||||||
initUpTime();
|
initUpTime();
|
||||||
initMemorySize();
|
initMemorySize();
|
||||||
initMemoryUsage();
|
initMemoryUsage();
|
||||||
@@ -107,8 +110,9 @@ const init = async () => {
|
|||||||
update();
|
update();
|
||||||
}, 60 * 1000);
|
}, 60 * 1000);
|
||||||
|
|
||||||
// Update package sensors periodically (60min)
|
// Update upgrade sensors periodically (1h)
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
|
updateApp();
|
||||||
updatePackageUpgrades();
|
updatePackageUpgrades();
|
||||||
}, 3600 * 1000);
|
}, 3600 * 1000);
|
||||||
|
|
||||||
@@ -128,6 +132,7 @@ const update = async () => {
|
|||||||
updatePageNumber();
|
updatePageNumber();
|
||||||
updatePageZoom();
|
updatePageZoom();
|
||||||
updatePageUrl();
|
updatePageUrl();
|
||||||
|
updateNetworkAddress();
|
||||||
updateUpTime();
|
updateUpTime();
|
||||||
updateLastActive();
|
updateLastActive();
|
||||||
updateMemoryUsage();
|
updateMemoryUsage();
|
||||||
@@ -182,10 +187,64 @@ const publishState = (path, state) => {
|
|||||||
return INTEGRATION.client.publish(root, `${state}`, { qos: 1, retain: true });
|
return INTEGRATION.client.publish(root, `${state}`, { qos: 1, retain: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the app update entity and handles the execute logic.
|
||||||
|
*/
|
||||||
|
const initApp = () => {
|
||||||
|
if (!HARDWARE.support.appUpdate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const root = `${INTEGRATION.root}/app`;
|
||||||
|
const config = {
|
||||||
|
name: "App",
|
||||||
|
unique_id: `${INTEGRATION.node}_app`,
|
||||||
|
command_topic: `${root}/install`,
|
||||||
|
state_topic: `${root}/version/state`,
|
||||||
|
payload_install: "update",
|
||||||
|
device: INTEGRATION.device,
|
||||||
|
};
|
||||||
|
publishConfig("update", config)
|
||||||
|
.on("message", (topic, message) => {
|
||||||
|
if (topic === config.command_topic) {
|
||||||
|
console.log("Update App...");
|
||||||
|
hardware.setDisplayStatus("ON");
|
||||||
|
const args = ["-c", `bash <(wget -qO- ${APP.scripts.install}) update`];
|
||||||
|
hardware.execScriptCommand("bash", args, (progress, error) => {
|
||||||
|
updateApp(progress);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.subscribe(config.command_topic);
|
||||||
|
updateApp();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the app update entity via the mqtt connection.
|
||||||
|
*/
|
||||||
|
const updateApp = async (progress = 0) => {
|
||||||
|
const latest = APP.releases.latest;
|
||||||
|
if (!latest) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const version = {
|
||||||
|
title: latest.title,
|
||||||
|
latest_version: latest.version,
|
||||||
|
installed_version: APP.version,
|
||||||
|
release_summary: latest.summary.slice(0, 250) + "...",
|
||||||
|
release_url: latest.url,
|
||||||
|
update_percentage: progress || null,
|
||||||
|
in_progress: progress && progress > 0 && progress < 100,
|
||||||
|
};
|
||||||
|
publishState("app/version", JSON.stringify(version));
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the shutdown button and handles the execute logic.
|
* Initializes the shutdown button and handles the execute logic.
|
||||||
*/
|
*/
|
||||||
const initShutdown = () => {
|
const initShutdown = () => {
|
||||||
|
if (!HARDWARE.support.sudoRights) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const root = `${INTEGRATION.root}/shutdown`;
|
const root = `${INTEGRATION.root}/shutdown`;
|
||||||
const config = {
|
const config = {
|
||||||
name: "Shutdown",
|
name: "Shutdown",
|
||||||
@@ -209,6 +268,9 @@ const initShutdown = () => {
|
|||||||
* Initializes the reboot button and handles the execute logic.
|
* Initializes the reboot button and handles the execute logic.
|
||||||
*/
|
*/
|
||||||
const initReboot = () => {
|
const initReboot = () => {
|
||||||
|
if (!HARDWARE.support.sudoRights) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const root = `${INTEGRATION.root}/reboot`;
|
const root = `${INTEGRATION.root}/reboot`;
|
||||||
const config = {
|
const config = {
|
||||||
name: "Reboot",
|
name: "Reboot",
|
||||||
@@ -305,7 +367,7 @@ const initKiosk = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the kiosk status via the mqtt connection.
|
* Updates the kiosk status via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateKiosk = () => {
|
const updateKiosk = async () => {
|
||||||
const kiosk = WEBVIEW.status;
|
const kiosk = WEBVIEW.status;
|
||||||
publishState("kiosk", kiosk);
|
publishState("kiosk", kiosk);
|
||||||
};
|
};
|
||||||
@@ -364,7 +426,7 @@ const initDisplay = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the display status, brightness via the mqtt connection.
|
* Updates the display status, brightness via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateDisplay = () => {
|
const updateDisplay = async () => {
|
||||||
const status = hardware.getDisplayStatus();
|
const status = hardware.getDisplayStatus();
|
||||||
const brightness = hardware.getDisplayBrightness();
|
const brightness = hardware.getDisplayBrightness();
|
||||||
publishState("display/power", status);
|
publishState("display/power", status);
|
||||||
@@ -414,7 +476,7 @@ const initKeyboard = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the keyboard visibility via the mqtt connection.
|
* Updates the keyboard visibility via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateKeyboard = () => {
|
const updateKeyboard = async () => {
|
||||||
const visibility = hardware.getKeyboardVisibility();
|
const visibility = hardware.getKeyboardVisibility();
|
||||||
publishState("keyboard", visibility);
|
publishState("keyboard", visibility);
|
||||||
};
|
};
|
||||||
@@ -423,7 +485,7 @@ const updateKeyboard = () => {
|
|||||||
* Initializes the page number and handles the execute logic.
|
* Initializes the page number and handles the execute logic.
|
||||||
*/
|
*/
|
||||||
const initPageNumber = () => {
|
const initPageNumber = () => {
|
||||||
if (WEBVIEW.viewUrls.length < 3) {
|
if (WEBVIEW.viewUrls.length <= 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const root = `${INTEGRATION.root}/page_number`;
|
const root = `${INTEGRATION.root}/page_number`;
|
||||||
@@ -456,7 +518,7 @@ const initPageNumber = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the page number via the mqtt connection.
|
* Updates the page number via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updatePageNumber = () => {
|
const updatePageNumber = async () => {
|
||||||
const pageNumber = WEBVIEW.viewActive || 1;
|
const pageNumber = WEBVIEW.viewActive || 1;
|
||||||
publishState("page_number", pageNumber);
|
publishState("page_number", pageNumber);
|
||||||
};
|
};
|
||||||
@@ -495,7 +557,7 @@ const initPageZoom = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the page zoom via the mqtt connection.
|
* Updates the page zoom via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updatePageZoom = () => {
|
const updatePageZoom = async () => {
|
||||||
const pageZoom = Math.round(WEBVIEW.views[WEBVIEW.viewActive || 1].webContents.getZoomFactor() * 100.0);
|
const pageZoom = Math.round(WEBVIEW.views[WEBVIEW.viewActive || 1].webContents.getZoomFactor() * 100.0);
|
||||||
publishState("page_zoom", pageZoom);
|
publishState("page_zoom", pageZoom);
|
||||||
};
|
};
|
||||||
@@ -530,7 +592,7 @@ const initPageUrl = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the page url via the mqtt connection.
|
* Updates the page url via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updatePageUrl = () => {
|
const updatePageUrl = async () => {
|
||||||
const defaultUrl = WEBVIEW.viewUrls[WEBVIEW.viewActive || 1];
|
const defaultUrl = WEBVIEW.viewUrls[WEBVIEW.viewActive || 1];
|
||||||
const currentUrl = WEBVIEW.views[WEBVIEW.viewActive || 1].webContents.getURL();
|
const currentUrl = WEBVIEW.views[WEBVIEW.viewActive || 1].webContents.getURL();
|
||||||
const pageUrl = !currentUrl || currentUrl.startsWith("data:") ? defaultUrl : currentUrl;
|
const pageUrl = !currentUrl || currentUrl.startsWith("data:") ? defaultUrl : currentUrl;
|
||||||
@@ -546,6 +608,7 @@ const initModel = () => {
|
|||||||
name: "Model",
|
name: "Model",
|
||||||
unique_id: `${INTEGRATION.node}_model`,
|
unique_id: `${INTEGRATION.node}_model`,
|
||||||
state_topic: `${root}/state`,
|
state_topic: `${root}/state`,
|
||||||
|
json_attributes_topic: `${root}/attributes`,
|
||||||
value_template: "{{ value }}",
|
value_template: "{{ value }}",
|
||||||
icon: "mdi:raspberry-pi",
|
icon: "mdi:raspberry-pi",
|
||||||
device: INTEGRATION.device,
|
device: INTEGRATION.device,
|
||||||
@@ -557,9 +620,10 @@ const initModel = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the model sensor via the mqtt connection.
|
* Updates the model sensor via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateModel = () => {
|
const updateModel = async () => {
|
||||||
const model = hardware.getModel();
|
const model = hardware.getModel();
|
||||||
publishState("model", model);
|
publishState("model", model);
|
||||||
|
publishAttributes("model", HARDWARE.support);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -582,11 +646,41 @@ const initSerialNumber = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the serial number sensor via the mqtt connection.
|
* Updates the serial number sensor via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateSerialNumber = () => {
|
const updateSerialNumber = async () => {
|
||||||
const serialNumber = hardware.getSerialNumber();
|
const serialNumber = hardware.getSerialNumber();
|
||||||
publishState("serial_number", serialNumber);
|
publishState("serial_number", serialNumber);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the network address sensor.
|
||||||
|
*/
|
||||||
|
const initNetworkAddress = () => {
|
||||||
|
const root = `${INTEGRATION.root}/network_address`;
|
||||||
|
const config = {
|
||||||
|
name: "Network Address",
|
||||||
|
unique_id: `${INTEGRATION.node}_network_address`,
|
||||||
|
state_topic: `${root}/state`,
|
||||||
|
json_attributes_topic: `${root}/attributes`,
|
||||||
|
value_template: "{{ value }}",
|
||||||
|
icon: "mdi:ip-network",
|
||||||
|
device: INTEGRATION.device,
|
||||||
|
};
|
||||||
|
publishConfig("sensor", config);
|
||||||
|
updateNetworkAddress();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the network address sensor via the mqtt connection.
|
||||||
|
*/
|
||||||
|
const updateNetworkAddress = async () => {
|
||||||
|
const networkAddresses = hardware.getNetworkAddresses();
|
||||||
|
const [name] = Object.keys(networkAddresses);
|
||||||
|
const [family] = name ? Object.keys(networkAddresses[name]) : [];
|
||||||
|
const networkAddress = networkAddresses[name]?.[family]?.[0] || null;
|
||||||
|
publishState("network_address", networkAddress);
|
||||||
|
publishAttributes("network_address", networkAddresses);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the host name sensor.
|
* Initializes the host name sensor.
|
||||||
*/
|
*/
|
||||||
@@ -607,7 +701,7 @@ const initHostName = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the host name sensor via the mqtt connection.
|
* Updates the host name sensor via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateHostName = () => {
|
const updateHostName = async () => {
|
||||||
const hostName = hardware.getHostName();
|
const hostName = hardware.getHostName();
|
||||||
publishState("host_name", hostName);
|
publishState("host_name", hostName);
|
||||||
};
|
};
|
||||||
@@ -633,7 +727,7 @@ const initUpTime = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the up time sensor via the mqtt connection.
|
* Updates the up time sensor via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateUpTime = () => {
|
const updateUpTime = async () => {
|
||||||
const upTime = hardware.getUpTime();
|
const upTime = hardware.getUpTime();
|
||||||
publishState("up_time", upTime);
|
publishState("up_time", upTime);
|
||||||
};
|
};
|
||||||
@@ -659,7 +753,7 @@ const initMemorySize = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the memory size sensor via the mqtt connection.
|
* Updates the memory size sensor via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateMemorySize = () => {
|
const updateMemorySize = async () => {
|
||||||
const memorySize = hardware.getMemorySize();
|
const memorySize = hardware.getMemorySize();
|
||||||
publishState("memory_size", memorySize);
|
publishState("memory_size", memorySize);
|
||||||
};
|
};
|
||||||
@@ -685,7 +779,7 @@ const initMemoryUsage = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the memory usage sensor via the mqtt connection.
|
* Updates the memory usage sensor via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateMemoryUsage = () => {
|
const updateMemoryUsage = async () => {
|
||||||
const memoryUsage = hardware.getMemoryUsage();
|
const memoryUsage = hardware.getMemoryUsage();
|
||||||
publishState("memory_usage", memoryUsage);
|
publishState("memory_usage", memoryUsage);
|
||||||
};
|
};
|
||||||
@@ -711,7 +805,7 @@ const initProcessorUsage = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the processor usage sensor via the mqtt connection.
|
* Updates the processor usage sensor via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateProcessorUsage = () => {
|
const updateProcessorUsage = async () => {
|
||||||
const processorUsage = hardware.getProcessorUsage();
|
const processorUsage = hardware.getProcessorUsage();
|
||||||
publishState("processor_usage", processorUsage);
|
publishState("processor_usage", processorUsage);
|
||||||
};
|
};
|
||||||
@@ -737,7 +831,7 @@ const initProcessorTemperature = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the processor temperature sensor via the mqtt connection.
|
* Updates the processor temperature sensor via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateProcessorTemperature = () => {
|
const updateProcessorTemperature = async () => {
|
||||||
const processorTemperature = hardware.getProcessorTemperature();
|
const processorTemperature = hardware.getProcessorTemperature();
|
||||||
publishState("processor_temperature", processorTemperature);
|
publishState("processor_temperature", processorTemperature);
|
||||||
};
|
};
|
||||||
@@ -766,7 +860,7 @@ const initBatteryLevel = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the battery level sensor via the mqtt connection.
|
* Updates the battery level sensor via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateBatteryLevel = () => {
|
const updateBatteryLevel = async () => {
|
||||||
const batteryLevel = hardware.getBatteryLevel();
|
const batteryLevel = hardware.getBatteryLevel();
|
||||||
publishState("battery_level", batteryLevel);
|
publishState("battery_level", batteryLevel);
|
||||||
};
|
};
|
||||||
@@ -792,14 +886,14 @@ const initPackageUpgrades = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the package upgrades sensor via the mqtt connection.
|
* Updates the package upgrades sensor via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updatePackageUpgrades = () => {
|
const updatePackageUpgrades = async () => {
|
||||||
const packages = hardware.checkPackageUpgrades();
|
const packages = hardware.checkPackageUpgrades();
|
||||||
const attributes = {
|
const attributes = {
|
||||||
total: packages.length,
|
total: packages.length,
|
||||||
packages: packages.map((pkg) => pkg.replace(/\s*\[.*?\]\s*/g, "").trim()),
|
packages: packages.map((pkg) => pkg.replace(/\s*\[.*?\]\s*/g, "").trim()),
|
||||||
};
|
};
|
||||||
publishAttributes("package_upgrades", attributes);
|
|
||||||
publishState("package_upgrades", attributes.total);
|
publishState("package_upgrades", attributes.total);
|
||||||
|
publishAttributes("package_upgrades", attributes);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -822,7 +916,7 @@ const initHeartbeat = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the heartbeat sensor via the mqtt connection.
|
* Updates the heartbeat sensor via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateHeartbeat = () => {
|
const updateHeartbeat = async () => {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const local = new Date(now.getTime() - now.getTimezoneOffset() * 60 * 1000);
|
const local = new Date(now.getTime() - now.getTimezoneOffset() * 60 * 1000);
|
||||||
const heartbeat = local.toISOString().replace(/\.\d{3}Z$/, "");
|
const heartbeat = local.toISOString().replace(/\.\d{3}Z$/, "");
|
||||||
@@ -850,7 +944,7 @@ const initLastActive = () => {
|
|||||||
/**
|
/**
|
||||||
* Updates the last active sensor via the mqtt connection.
|
* Updates the last active sensor via the mqtt connection.
|
||||||
*/
|
*/
|
||||||
const updateLastActive = () => {
|
const updateLastActive = async () => {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const then = WEBVIEW.pointer.time;
|
const then = WEBVIEW.pointer.time;
|
||||||
const lastActive = Math.abs(now - then) / (1000 * 60);
|
const lastActive = Math.abs(now - then) / (1000 * 60);
|
||||||
|
|||||||
+44
-17
@@ -54,8 +54,8 @@ const init = async () => {
|
|||||||
|
|
||||||
// Init global root window
|
// Init global root window
|
||||||
WEBVIEW.window = new BaseWindow({
|
WEBVIEW.window = new BaseWindow({
|
||||||
title: "TouchKio",
|
title: APP.title,
|
||||||
icon: path.join(__dirname, "..", "img", "icon.png"),
|
icon: path.join(APP.path, "img", "icon.png"),
|
||||||
});
|
});
|
||||||
WEBVIEW.window.setMenuBarVisibility(false);
|
WEBVIEW.window.setMenuBarVisibility(false);
|
||||||
WEBVIEW.window.setFullScreen(fullscreen);
|
WEBVIEW.window.setFullScreen(fullscreen);
|
||||||
@@ -91,7 +91,7 @@ const init = async () => {
|
|||||||
});
|
});
|
||||||
WEBVIEW.pager.setBackgroundColor("#00000000");
|
WEBVIEW.pager.setBackgroundColor("#00000000");
|
||||||
WEBVIEW.window.contentView.addChildView(WEBVIEW.pager);
|
WEBVIEW.window.contentView.addChildView(WEBVIEW.pager);
|
||||||
WEBVIEW.pager.webContents.loadFile(path.join(app.getAppPath(), "html", "pager.html"));
|
WEBVIEW.pager.webContents.loadFile(path.join(APP.path, "html", "pager.html"));
|
||||||
|
|
||||||
// Init global widget
|
// Init global widget
|
||||||
WEBVIEW.widget = new WebContentsView({
|
WEBVIEW.widget = new WebContentsView({
|
||||||
@@ -103,7 +103,7 @@ const init = async () => {
|
|||||||
});
|
});
|
||||||
WEBVIEW.widget.setBackgroundColor("#00000000");
|
WEBVIEW.widget.setBackgroundColor("#00000000");
|
||||||
WEBVIEW.window.contentView.addChildView(WEBVIEW.widget);
|
WEBVIEW.window.contentView.addChildView(WEBVIEW.widget);
|
||||||
WEBVIEW.widget.webContents.loadFile(path.join(app.getAppPath(), "html", "widget.html"));
|
WEBVIEW.widget.webContents.loadFile(path.join(APP.path, "html", "widget.html"));
|
||||||
|
|
||||||
// Init global navigation
|
// Init global navigation
|
||||||
WEBVIEW.navigation = new WebContentsView({
|
WEBVIEW.navigation = new WebContentsView({
|
||||||
@@ -115,14 +115,14 @@ const init = async () => {
|
|||||||
});
|
});
|
||||||
WEBVIEW.navigation.setBackgroundColor("#00000000");
|
WEBVIEW.navigation.setBackgroundColor("#00000000");
|
||||||
WEBVIEW.window.contentView.addChildView(WEBVIEW.navigation);
|
WEBVIEW.window.contentView.addChildView(WEBVIEW.navigation);
|
||||||
WEBVIEW.navigation.webContents.loadFile(path.join(app.getAppPath(), "html", "navigation.html"));
|
WEBVIEW.navigation.webContents.loadFile(path.join(APP.path, "html", "navigation.html"));
|
||||||
|
|
||||||
// Register events
|
// Register events
|
||||||
windowEvents();
|
await windowEvents();
|
||||||
widgetEvents();
|
await widgetEvents();
|
||||||
navigationEvents();
|
await navigationEvents();
|
||||||
viewEvents();
|
await viewEvents();
|
||||||
appEvents();
|
await appEvents();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -166,7 +166,7 @@ const updateView = () => {
|
|||||||
}
|
}
|
||||||
const url = WEBVIEW.views[WEBVIEW.viewActive].webContents.getURL();
|
const url = WEBVIEW.views[WEBVIEW.viewActive].webContents.getURL();
|
||||||
const host = url.startsWith("data:") ? "whoopsie" : new URL(url).host;
|
const host = url.startsWith("data:") ? "whoopsie" : new URL(url).host;
|
||||||
const title = `TouchKio - ${host} (${WEBVIEW.viewActive})`;
|
const title = `${APP.title} - ${host} (${WEBVIEW.viewActive})`;
|
||||||
|
|
||||||
// Update window title
|
// Update window title
|
||||||
console.log(`Update View: ${title}`);
|
console.log(`Update View: ${title}`);
|
||||||
@@ -427,7 +427,7 @@ const resizeView = () => {
|
|||||||
/**
|
/**
|
||||||
* Register window events and handler.
|
* Register window events and handler.
|
||||||
*/
|
*/
|
||||||
const windowEvents = () => {
|
const windowEvents = async () => {
|
||||||
// Handle window resize events
|
// Handle window resize events
|
||||||
WEBVIEW.window.on("ready-to-show", resizeView);
|
WEBVIEW.window.on("ready-to-show", resizeView);
|
||||||
WEBVIEW.window.on("resize", resizeView);
|
WEBVIEW.window.on("resize", resizeView);
|
||||||
@@ -476,7 +476,7 @@ const windowEvents = () => {
|
|||||||
historyForward();
|
historyForward();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle window touch events
|
// Check for window touch events (1s)
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const then = WEBVIEW.pointer.time;
|
const then = WEBVIEW.pointer.time;
|
||||||
@@ -495,7 +495,7 @@ const windowEvents = () => {
|
|||||||
/**
|
/**
|
||||||
* Register widget events and handler.
|
* Register widget events and handler.
|
||||||
*/
|
*/
|
||||||
const widgetEvents = () => {
|
const widgetEvents = async () => {
|
||||||
if (!WEBVIEW.widgetEnabled) {
|
if (!WEBVIEW.widgetEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -581,7 +581,7 @@ const widgetEvents = () => {
|
|||||||
/**
|
/**
|
||||||
* Register navigation events and handler.
|
* Register navigation events and handler.
|
||||||
*/
|
*/
|
||||||
const navigationEvents = () => {
|
const navigationEvents = async () => {
|
||||||
if (!WEBVIEW.navigationEnabled) {
|
if (!WEBVIEW.navigationEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -680,7 +680,7 @@ const navigationEvents = () => {
|
|||||||
/**
|
/**
|
||||||
* Register view events and handler.
|
* Register view events and handler.
|
||||||
*/
|
*/
|
||||||
const viewEvents = () => {
|
const viewEvents = async () => {
|
||||||
const ready = [];
|
const ready = [];
|
||||||
WEBVIEW.views.forEach((view, i) => {
|
WEBVIEW.views.forEach((view, i) => {
|
||||||
// Enable webview touch emulation
|
// Enable webview touch emulation
|
||||||
@@ -768,7 +768,7 @@ const viewEvents = () => {
|
|||||||
/**
|
/**
|
||||||
* Register app events and handler.
|
* Register app events and handler.
|
||||||
*/
|
*/
|
||||||
const appEvents = () => {
|
const appEvents = async () => {
|
||||||
// Handle signal and exit events
|
// Handle signal and exit events
|
||||||
process.on("SIGINT", app.quit);
|
process.on("SIGINT", app.quit);
|
||||||
app.on("before-quit", () => {
|
app.on("before-quit", () => {
|
||||||
@@ -784,10 +784,37 @@ const appEvents = () => {
|
|||||||
WEBVIEW.window.focus();
|
WEBVIEW.window.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Check for latest release infos (2h)
|
||||||
|
setInterval(() => {
|
||||||
|
latestRelease();
|
||||||
|
}, 7200 * 1000);
|
||||||
|
await latestRelease();
|
||||||
|
|
||||||
// Webview initialized
|
// Webview initialized
|
||||||
WEBVIEW.initialized = true;
|
WEBVIEW.initialized = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches the latest app release infos from github.
|
||||||
|
*/
|
||||||
|
const latestRelease = async () => {
|
||||||
|
try {
|
||||||
|
const response = await axios.get(`${APP.releases.url}/latest`);
|
||||||
|
const data = response ? response.data : null;
|
||||||
|
if (!data || data.draft || data.prerelease) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
APP.releases.latest = {
|
||||||
|
title: APP.title,
|
||||||
|
version: (data.tag_name || data.name || "").replace(/^v/i, ""),
|
||||||
|
summary: data.body || "",
|
||||||
|
url: data.html_url || "",
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.warn("Github Error:", error.message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks for network connectivity by requesting a known url.
|
* Checks for network connectivity by requesting a known url.
|
||||||
*
|
*
|
||||||
|
|||||||
+5
-3
@@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "touchkio",
|
"name": "touchkio",
|
||||||
|
"title": "TouchKio",
|
||||||
"description": "Home Assistant Touch Kiosk",
|
"description": "Home Assistant Touch Kiosk",
|
||||||
"homepage": "https://github.com/leukipp/touchkio",
|
"homepage": "https://github.com/leukipp/touchkio",
|
||||||
"author": "leukipp",
|
"author": "leukipp",
|
||||||
"version": "1.2.1",
|
"version": "1.3.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -18,11 +19,12 @@
|
|||||||
"@electron-forge/maker-deb": "^7.8.3",
|
"@electron-forge/maker-deb": "^7.8.3",
|
||||||
"@electron-forge/maker-zip": "^7.8.3",
|
"@electron-forge/maker-zip": "^7.8.3",
|
||||||
"@electron-forge/publisher-github": "^7.8.3",
|
"@electron-forge/publisher-github": "^7.8.3",
|
||||||
"electron": "^37.4.0",
|
"electron": "^38.0.0",
|
||||||
|
"jszip": "^3.10.1",
|
||||||
"prettier": "^3.6.2"
|
"prettier": "^3.6.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.11.0",
|
"axios": "^1.11.0",
|
||||||
"mqtt": "^5.14.0"
|
"mqtt": "^5.14.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
|
|
||||||
"@babel/runtime@^7.28.3":
|
"@babel/runtime@^7.28.3":
|
||||||
version "7.28.3"
|
version "7.28.4"
|
||||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.3.tgz#75c5034b55ba868121668be5d5bb31cc64e6e61a"
|
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.4.tgz#a70226016fabe25c5783b2f22d3e1c9bc5ca3326"
|
||||||
integrity sha512-9uIQ10o0WGdpP6GDhXcdOJPJuDgFtIDtN/9+ArJQ2NAfAmiuhTQdzkaTGR33v43GYS2UrSA0eX2pPPHoFVvpxA==
|
integrity sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==
|
||||||
|
|
||||||
"@electron-forge/cli@^7.8.3":
|
"@electron-forge/cli@^7.8.3":
|
||||||
version "7.8.3"
|
version "7.8.3"
|
||||||
@@ -571,16 +571,16 @@
|
|||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
|
|
||||||
"@types/node@*":
|
"@types/node@*":
|
||||||
version "24.3.0"
|
version "24.3.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-24.3.0.tgz#89b09f45cb9a8ee69466f18ee5864e4c3eb84dec"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-24.3.1.tgz#b0a3fb2afed0ef98e8d7f06d46ef6349047709f3"
|
||||||
integrity sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow==
|
integrity sha512-3vXmQDXy+woz+gnrTvuvNrPzekOi+Ds0ReMxw0LzBiK3a+1k0kQn9f2NWk+lgD4rJehFUmYy2gMhJ2ZI+7YP9g==
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types "~7.10.0"
|
undici-types "~7.10.0"
|
||||||
|
|
||||||
"@types/node@^22.7.7":
|
"@types/node@^22.7.7":
|
||||||
version "22.18.0"
|
version "22.18.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.18.0.tgz#9e4709be4f104e3568f7dd1c71e2949bf147a47b"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.18.1.tgz#cc85ee6999b2a2928739281d2f56ff410a140c52"
|
||||||
integrity sha512-m5ObIqwsUp6BZzyiy4RdZpzWGub9bqLJMvZDD0QMXhxjqMHMENlj+SqF5QxoUwaQNFe+8kz8XM8ZQhqkQPTgMQ==
|
integrity sha512-rzSDyhn4cYznVG+PCzGe1lwuMYJrcBS1fc3JqSa2PvtABwWo+dZ1ij5OVok3tqfpEBCBoaR4d7upFJk73HRJDw==
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types "~6.21.0"
|
undici-types "~6.21.0"
|
||||||
|
|
||||||
@@ -729,9 +729,9 @@ bl@^4.1.0:
|
|||||||
readable-stream "^3.4.0"
|
readable-stream "^3.4.0"
|
||||||
|
|
||||||
bl@^6.0.8:
|
bl@^6.0.8:
|
||||||
version "6.1.2"
|
version "6.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/bl/-/bl-6.1.2.tgz#fd4274e73c24f4c34ada6d69a612ec924f3df345"
|
resolved "https://registry.yarnpkg.com/bl/-/bl-6.1.3.tgz#158ac572ee2a3446884585ddd02d02b4c5d122bf"
|
||||||
integrity sha512-6J3oG82fpJ71WF4l0W6XslkwAPMr+Zcp+AmdxJ0L8LsXNzFeO8GYesV2J9AzGArBjrsb2xR50Ocbn/CL1B44TA==
|
integrity sha512-nHB8B5roHlGX5TFsWeiQJijdddZIOHuv1eL2cM2kHnG3qR91CYLsysGe+CvxQfEd23EKD0eJf4lto0frTbddKA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/readable-stream" "^4.0.0"
|
"@types/readable-stream" "^4.0.0"
|
||||||
buffer "^6.0.3"
|
buffer "^6.0.3"
|
||||||
@@ -1005,6 +1005,11 @@ concat-stream@^2.0.0:
|
|||||||
readable-stream "^3.0.2"
|
readable-stream "^3.0.2"
|
||||||
typedarray "^0.0.6"
|
typedarray "^0.0.6"
|
||||||
|
|
||||||
|
core-util-is@~1.0.0:
|
||||||
|
version "1.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85"
|
||||||
|
integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==
|
||||||
|
|
||||||
cross-dirname@^0.1.0:
|
cross-dirname@^0.1.0:
|
||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/cross-dirname/-/cross-dirname-0.1.0.tgz#b899599f30a5389f59e78c150e19f957ad16a37c"
|
resolved "https://registry.yarnpkg.com/cross-dirname/-/cross-dirname-0.1.0.tgz#b899599f30a5389f59e78c150e19f957ad16a37c"
|
||||||
@@ -1159,10 +1164,10 @@ electron-installer-debian@^3.2.0:
|
|||||||
word-wrap "^1.2.3"
|
word-wrap "^1.2.3"
|
||||||
yargs "^16.0.2"
|
yargs "^16.0.2"
|
||||||
|
|
||||||
electron@^37.4.0:
|
electron@^38.0.0:
|
||||||
version "37.4.0"
|
version "38.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/electron/-/electron-37.4.0.tgz#08b2eff9d6250fac7b298f17f93946ecd586f38e"
|
resolved "https://registry.yarnpkg.com/electron/-/electron-38.0.0.tgz#e51803f62c8d4c368f77642a1b1b05444c687fba"
|
||||||
integrity sha512-HhsSdWowE5ODOeWNc/323Ug2C52mq/TqNBG+4uMeOA3G2dMXNc/nfyi0RYu1rJEgiaJLEjtHveeZZaYRYFsFCQ==
|
integrity sha512-egljptiPJqbL/oamFCEY+g3RNeONWTVxZSGeyLqzK8xq106JhzuxnhJZ3sxt4DzJFaofbGyGJA37Oe9d+gVzYw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@electron/get" "^2.0.0"
|
"@electron/get" "^2.0.0"
|
||||||
"@types/node" "^22.7.7"
|
"@types/node" "^22.7.7"
|
||||||
@@ -1696,6 +1701,11 @@ ieee754@^1.1.13, ieee754@^1.2.1:
|
|||||||
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
|
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
|
||||||
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
|
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
|
||||||
|
|
||||||
|
immediate@~3.0.5:
|
||||||
|
version "3.0.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b"
|
||||||
|
integrity sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==
|
||||||
|
|
||||||
imurmurhash@^0.1.4:
|
imurmurhash@^0.1.4:
|
||||||
version "0.1.4"
|
version "0.1.4"
|
||||||
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
|
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
|
||||||
@@ -1719,7 +1729,7 @@ inflight@^1.0.4:
|
|||||||
once "^1.3.0"
|
once "^1.3.0"
|
||||||
wrappy "1"
|
wrappy "1"
|
||||||
|
|
||||||
inherits@2, inherits@^2.0.3, inherits@^2.0.4:
|
inherits@2, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3:
|
||||||
version "2.0.4"
|
version "2.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
|
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
|
||||||
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
|
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
|
||||||
@@ -1798,6 +1808,11 @@ is-unicode-supported@^0.1.0:
|
|||||||
resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7"
|
resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7"
|
||||||
integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==
|
integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==
|
||||||
|
|
||||||
|
isarray@~1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
|
||||||
|
integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==
|
||||||
|
|
||||||
isbinaryfile@^4.0.8:
|
isbinaryfile@^4.0.8:
|
||||||
version "4.0.10"
|
version "4.0.10"
|
||||||
resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-4.0.10.tgz#0c5b5e30c2557a2f06febd37b7322946aaee42b3"
|
resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-4.0.10.tgz#0c5b5e30c2557a2f06febd37b7322946aaee42b3"
|
||||||
@@ -1844,6 +1859,16 @@ jsonfile@^6.0.1:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
graceful-fs "^4.1.6"
|
graceful-fs "^4.1.6"
|
||||||
|
|
||||||
|
jszip@^3.10.1:
|
||||||
|
version "3.10.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.10.1.tgz#34aee70eb18ea1faec2f589208a157d1feb091c2"
|
||||||
|
integrity sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==
|
||||||
|
dependencies:
|
||||||
|
lie "~3.3.0"
|
||||||
|
pako "~1.0.2"
|
||||||
|
readable-stream "~2.3.6"
|
||||||
|
setimmediate "^1.0.5"
|
||||||
|
|
||||||
junk@^3.1.0:
|
junk@^3.1.0:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/junk/-/junk-3.1.0.tgz#31499098d902b7e98c5d9b9c80f43457a88abfa1"
|
resolved "https://registry.yarnpkg.com/junk/-/junk-3.1.0.tgz#31499098d902b7e98c5d9b9c80f43457a88abfa1"
|
||||||
@@ -1856,6 +1881,13 @@ keyv@^4.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
json-buffer "3.0.1"
|
json-buffer "3.0.1"
|
||||||
|
|
||||||
|
lie@~3.3.0:
|
||||||
|
version "3.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/lie/-/lie-3.3.0.tgz#dcf82dee545f46074daf200c7c1c5a08e0f40f6a"
|
||||||
|
integrity sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==
|
||||||
|
dependencies:
|
||||||
|
immediate "~3.0.5"
|
||||||
|
|
||||||
listr2@^7.0.2:
|
listr2@^7.0.2:
|
||||||
version "7.0.2"
|
version "7.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/listr2/-/listr2-7.0.2.tgz#3aa3e1549dfaf3c57ab5eeaba754da3b87f33063"
|
resolved "https://registry.yarnpkg.com/listr2/-/listr2-7.0.2.tgz#3aa3e1549dfaf3c57ab5eeaba754da3b87f33063"
|
||||||
@@ -2126,10 +2158,10 @@ mqtt-packet@^9.0.2:
|
|||||||
debug "^4.3.4"
|
debug "^4.3.4"
|
||||||
process-nextick-args "^2.0.1"
|
process-nextick-args "^2.0.1"
|
||||||
|
|
||||||
mqtt@^5.14.0:
|
mqtt@^5.14.1:
|
||||||
version "5.14.0"
|
version "5.14.1"
|
||||||
resolved "https://registry.yarnpkg.com/mqtt/-/mqtt-5.14.0.tgz#eeeb1563884f73cad4fb973449d3973666a4202f"
|
resolved "https://registry.yarnpkg.com/mqtt/-/mqtt-5.14.1.tgz#c65063b2cc9d9336430bde27a337ae98e5b4705a"
|
||||||
integrity sha512-H7EmeCJhbGblbWjm6APF5sAH3SkdI7lxHw/UkblZp8fjSNl8b2MsLcdAkIaQKxvZYmiORkdAjffvKjqQWPkd6w==
|
integrity sha512-NxkPxE70Uq3Ph7goefQa7ggSsVzHrayCD0OyxlJgITN/EbzlZN+JEPmaAZdxP1LsIT5FamDyILoQTF72W7Nnbw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/readable-stream" "^4.0.21"
|
"@types/readable-stream" "^4.0.21"
|
||||||
"@types/ws" "^8.18.1"
|
"@types/ws" "^8.18.1"
|
||||||
@@ -2169,9 +2201,9 @@ nice-try@^1.0.4:
|
|||||||
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
|
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
|
||||||
|
|
||||||
node-abi@^3.45.0:
|
node-abi@^3.45.0:
|
||||||
version "3.75.0"
|
version "3.77.0"
|
||||||
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.75.0.tgz#2f929a91a90a0d02b325c43731314802357ed764"
|
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.77.0.tgz#3ad90d5c9d45663420e5aa4ff58dbf4e3625419a"
|
||||||
integrity sha512-OhYaY5sDsIka7H7AtijtI9jwGYLyl29eQn/W623DiN/MIv5sUqc4g7BIDThX+gb7di9f6xK02nkp8sdfFWZLTg==
|
integrity sha512-DSmt0OEcLoK4i3NuscSbGjOf3bqiDEutejqENSplMSFA/gmB8mkED9G4pKWnPl7MDU4rSHebKPHeitpDfyH0cQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
semver "^7.3.5"
|
semver "^7.3.5"
|
||||||
|
|
||||||
@@ -2320,6 +2352,11 @@ p-try@^1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"
|
resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"
|
||||||
integrity sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==
|
integrity sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==
|
||||||
|
|
||||||
|
pako@~1.0.2:
|
||||||
|
version "1.0.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf"
|
||||||
|
integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==
|
||||||
|
|
||||||
parse-author@^2.0.0:
|
parse-author@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/parse-author/-/parse-author-2.0.0.tgz#d3460bf1ddd0dfaeed42da754242e65fb684a81f"
|
resolved "https://registry.yarnpkg.com/parse-author/-/parse-author-2.0.0.tgz#d3460bf1ddd0dfaeed42da754242e65fb684a81f"
|
||||||
@@ -2417,7 +2454,7 @@ proc-log@^2.0.1:
|
|||||||
resolved "https://registry.yarnpkg.com/proc-log/-/proc-log-2.0.1.tgz#8f3f69a1f608de27878f91f5c688b225391cb685"
|
resolved "https://registry.yarnpkg.com/proc-log/-/proc-log-2.0.1.tgz#8f3f69a1f608de27878f91f5c688b225391cb685"
|
||||||
integrity sha512-Kcmo2FhfDTXdcbfDH76N7uBYHINxc/8GW7UAVuVP9I+Va3uHSerrnKV6dLooga/gh7GlgzuCCr/eoldnL1muGw==
|
integrity sha512-Kcmo2FhfDTXdcbfDH76N7uBYHINxc/8GW7UAVuVP9I+Va3uHSerrnKV6dLooga/gh7GlgzuCCr/eoldnL1muGw==
|
||||||
|
|
||||||
process-nextick-args@^2.0.1:
|
process-nextick-args@^2.0.1, process-nextick-args@~2.0.0:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
|
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
|
||||||
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
|
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
|
||||||
@@ -2512,6 +2549,19 @@ readable-stream@^4.2.0, readable-stream@^4.7.0:
|
|||||||
process "^0.11.10"
|
process "^0.11.10"
|
||||||
string_decoder "^1.3.0"
|
string_decoder "^1.3.0"
|
||||||
|
|
||||||
|
readable-stream@~2.3.6:
|
||||||
|
version "2.3.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b"
|
||||||
|
integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==
|
||||||
|
dependencies:
|
||||||
|
core-util-is "~1.0.0"
|
||||||
|
inherits "~2.0.3"
|
||||||
|
isarray "~1.0.0"
|
||||||
|
process-nextick-args "~2.0.0"
|
||||||
|
safe-buffer "~5.1.1"
|
||||||
|
string_decoder "~1.1.1"
|
||||||
|
util-deprecate "~1.0.1"
|
||||||
|
|
||||||
rechoir@^0.8.0:
|
rechoir@^0.8.0:
|
||||||
version "0.8.0"
|
version "0.8.0"
|
||||||
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.8.0.tgz#49f866e0d32146142da3ad8f0eff352b3215ff22"
|
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.8.0.tgz#49f866e0d32146142da3ad8f0eff352b3215ff22"
|
||||||
@@ -2609,6 +2659,11 @@ run-parallel@^1.1.9:
|
|||||||
dependencies:
|
dependencies:
|
||||||
queue-microtask "^1.2.2"
|
queue-microtask "^1.2.2"
|
||||||
|
|
||||||
|
safe-buffer@~5.1.0, safe-buffer@~5.1.1:
|
||||||
|
version "5.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
|
||||||
|
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
|
||||||
|
|
||||||
safe-buffer@~5.2.0:
|
safe-buffer@~5.2.0:
|
||||||
version "5.2.1"
|
version "5.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
|
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
|
||||||
@@ -2646,6 +2701,11 @@ serialize-error@^7.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
type-fest "^0.13.1"
|
type-fest "^0.13.1"
|
||||||
|
|
||||||
|
setimmediate@^1.0.5:
|
||||||
|
version "1.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
|
||||||
|
integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==
|
||||||
|
|
||||||
shebang-command@^1.2.0:
|
shebang-command@^1.2.0:
|
||||||
version "1.2.0"
|
version "1.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
|
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
|
||||||
@@ -2786,6 +2846,13 @@ string_decoder@^1.1.1, string_decoder@^1.3.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
safe-buffer "~5.2.0"
|
safe-buffer "~5.2.0"
|
||||||
|
|
||||||
|
string_decoder@~1.1.1:
|
||||||
|
version "1.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
|
||||||
|
integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==
|
||||||
|
dependencies:
|
||||||
|
safe-buffer "~5.1.0"
|
||||||
|
|
||||||
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||||
version "6.0.1"
|
version "6.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||||
@@ -2956,7 +3023,7 @@ username@^5.1.0:
|
|||||||
execa "^1.0.0"
|
execa "^1.0.0"
|
||||||
mem "^4.3.0"
|
mem "^4.3.0"
|
||||||
|
|
||||||
util-deprecate@^1.0.1:
|
util-deprecate@^1.0.1, util-deprecate@~1.0.1:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
||||||
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
|
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
|
||||||
|
|||||||
Reference in New Issue
Block a user