Skip to content

Commit

Permalink
edex-ui: fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
licy183 committed Feb 11, 2025
1 parent 20d68f3 commit 80e780f
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 1 deletion.
11 changes: 11 additions & 0 deletions tur/edex-ui/0002-max-threads.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/src/_multithread.js
+++ b/src/_multithread.js
@@ -7,7 +7,7 @@
// Also, leave a core available for the renderer process
const osCPUs = require("os").cpus().length - 1;
// See #904
- const numCPUs = (osCPUs > 7) ? 7 : osCPUs;
+ const numCPUs = (osCPUs > 3) ? 3 : osCPUs;

const si = require("systeminformation");

35 changes: 35 additions & 0 deletions tur/edex-ui/0003-hardware.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
`systeminfomation.system()` and `systeminfomation.chassis()` will call `dmesg`
which doesn't work on Android without root

--- a/src/classes/hardwareInspector.class.js
+++ b/src/classes/hardwareInspector.class.js
@@ -29,13 +29,22 @@
}, 20000);
}
updateInfo() {
- window.si.system().then(d => {
- window.si.chassis().then(e => {
- document.getElementById("mod_hardwareInspector_manufacturer").innerText = this._trimDataString(d.manufacturer);
- document.getElementById("mod_hardwareInspector_model").innerText = this._trimDataString(d.model, d.manufacturer, e.type);
- document.getElementById("mod_hardwareInspector_chassis").innerText = e.type;
- });
- });
+ const exec = require('child_process').exec;
+ exec('getprop ro.product.manufacturer', function (_, stdout) {
+ let manufacturer = "Unknown";
+ if (stdout !== undefined && stdout !== "") {
+ manufacturer = stdout;
+ }
+ document.getElementById("mod_hardwareInspector_manufacturer").innerText = _trimDataString(manufacturer);
+ });
+ exec('getprop ro.product.model', function (_, stdout) {
+ let model = "Unknown";
+ if (stdout !== undefined && stdout !== "") {
+ model = stdout;
+ }
+ document.getElementById("mod_hardwareInspector_model").innerText = _trimDataString(model);
+ });
+ document.getElementById("mod_hardwareInspector_chassis").innerText = "Unknown";
}
_trimDataString(str, ...filters) {
return str.trim().split(" ").filter(word => {
24 changes: 24 additions & 0 deletions tur/edex-ui/0004-filesystem.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
`systeminfomation.fsSize()` doesn't work on Android

--- a/src/classes/filesystem.class.js
+++ b/src/classes/filesystem.class.js
@@ -504,17 +504,8 @@
this.space_bar.text.innerHTML = "Calculating available space...";
this.space_bar.bar.removeAttribute("value");

- window.si.fsSize().catch(() => {
- this.space_bar.text.innerHTML = "Could not calculate mountpoint usage.";
- this.space_bar.bar.value = 100;
- }).then(d => {
- d.forEach(fsBlock => {
- if (path.startsWith(fsBlock.mount)) {
- this.fsBlock = fsBlock;
- }
- });
- this.renderDiskUsage(this.fsBlock);
- });
+ this.space_bar.text.innerHTML = "Could not calculate mountpoint usage.";
+ this.space_bar.bar.value = 100;
};

this.renderDiskUsage = async fsBlock => {
13 changes: 13 additions & 0 deletions tur/edex-ui/0005-netstat.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
`net.mac` is always empty on Android.

--- a/src/classes/netstat.class.js
+++ b/src/classes/netstat.class.js
@@ -77,7 +77,7 @@
} else {
// Find the first external, IPv4 connected networkInterface that has a MAC address set

- while (net.operstate !== "up" || net.internal === true || net.ip4 === "" || net.mac === "") {
+ while (net.operstate !== "up" || net.internal === true || net.ip4 === "") {
netID++;
if (data[netID]) {
net = data[netID];
29 changes: 28 additions & 1 deletion tur/edex-ui/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ TERMUX_PKG_DESCRIPTION="A cross-platform, customizable science fiction terminal
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux-user-repository"
TERMUX_PKG_VERSION="2.2.8"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=git+https://github.com/GitSquared/edex-ui
TERMUX_PKG_SHA256=c6a8ef34890c028ee2a1e4c64485db29d4d0aedda0d63c0fc5f8572d45226b51
TERMUX_PKG_DEPENDS="electron-deps"
TERMUX_PKG_ANTI_BUILD_DEPENDS="electron-deps"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_NO_STATICSPLIT=true

Expand Down Expand Up @@ -38,8 +40,33 @@ termux_step_get_source() {
cp -Rf $TMP_CHECKOUT $TERMUX_PKG_SRCDIR
}

__tur_setup_nodejs_14() {
local NODEJS_VERSION=14.2.0
local NODEJS_FOLDER=${TERMUX_PKG_CACHEDIR}/build-tools/nodejs-${NODEJS_VERSION}

if [ ! -x "$NODEJS_FOLDER/bin/node" ]; then
mkdir -p "$NODEJS_FOLDER"
local NODEJS_TAR_FILE=$TERMUX_PKG_TMPDIR/nodejs-$NODEJS_VERSION.tar.xz
termux_download https://nodejs.org/dist/v${NODEJS_VERSION}/node-v${NODEJS_VERSION}-linux-x64.tar.xz \
"$NODEJS_TAR_FILE" \
468cbd92271da8c0cacaa3fa432a73a332e398bade8ad7359a94aa8ab3cc3cca
tar -xf "$NODEJS_TAR_FILE" -C "$NODEJS_FOLDER" --strip-components=1
fi
export PATH="$NODEJS_FOLDER/bin:$PATH"
}

__tur_setup_pypy2() {
termux_download \
https://downloads.python.org/pypy/pypy2.7-v7.3.17-linux64.tar.bz2 \
"$TERMUX_PKG_CACHEDIR"/pypy2.7-v7.3.17-linux64.tar.bz2 \
9f3497f87b3372d17e447369e0016a4bec99a6b4d2a59aba774a25bfe4353474
tar -C "$TERMUX_PKG_CACHEDIR" -xf "$TERMUX_PKG_CACHEDIR"/pypy2.7-v7.3.17-linux64.tar.bz2
export PATH="$TERMUX_PKG_CACHEDIR/pypy2.7-v7.3.17-linux64/bin:$PATH"
}

termux_step_configure() {
termux_setup_nodejs
__tur_setup_nodejs_14
__tur_setup_pypy2

if [ $TERMUX_ARCH = "arm" ]; then
electron_arch="armv7l"
Expand Down

0 comments on commit 80e780f

Please sign in to comment.