Skip to content

Commit 80e780f

Browse files
committed
edex-ui: fix bugs
1 parent 20d68f3 commit 80e780f

File tree

5 files changed

+111
-1
lines changed

5 files changed

+111
-1
lines changed

tur/edex-ui/0002-max-threads.patch

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/src/_multithread.js
2+
+++ b/src/_multithread.js
3+
@@ -7,7 +7,7 @@
4+
// Also, leave a core available for the renderer process
5+
const osCPUs = require("os").cpus().length - 1;
6+
// See #904
7+
- const numCPUs = (osCPUs > 7) ? 7 : osCPUs;
8+
+ const numCPUs = (osCPUs > 3) ? 3 : osCPUs;
9+
10+
const si = require("systeminformation");
11+

tur/edex-ui/0003-hardware.patch

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
`systeminfomation.system()` and `systeminfomation.chassis()` will call `dmesg`
2+
which doesn't work on Android without root
3+
4+
--- a/src/classes/hardwareInspector.class.js
5+
+++ b/src/classes/hardwareInspector.class.js
6+
@@ -29,13 +29,22 @@
7+
}, 20000);
8+
}
9+
updateInfo() {
10+
- window.si.system().then(d => {
11+
- window.si.chassis().then(e => {
12+
- document.getElementById("mod_hardwareInspector_manufacturer").innerText = this._trimDataString(d.manufacturer);
13+
- document.getElementById("mod_hardwareInspector_model").innerText = this._trimDataString(d.model, d.manufacturer, e.type);
14+
- document.getElementById("mod_hardwareInspector_chassis").innerText = e.type;
15+
- });
16+
- });
17+
+ const exec = require('child_process').exec;
18+
+ exec('getprop ro.product.manufacturer', function (_, stdout) {
19+
+ let manufacturer = "Unknown";
20+
+ if (stdout !== undefined && stdout !== "") {
21+
+ manufacturer = stdout;
22+
+ }
23+
+ document.getElementById("mod_hardwareInspector_manufacturer").innerText = _trimDataString(manufacturer);
24+
+ });
25+
+ exec('getprop ro.product.model', function (_, stdout) {
26+
+ let model = "Unknown";
27+
+ if (stdout !== undefined && stdout !== "") {
28+
+ model = stdout;
29+
+ }
30+
+ document.getElementById("mod_hardwareInspector_model").innerText = _trimDataString(model);
31+
+ });
32+
+ document.getElementById("mod_hardwareInspector_chassis").innerText = "Unknown";
33+
}
34+
_trimDataString(str, ...filters) {
35+
return str.trim().split(" ").filter(word => {

tur/edex-ui/0004-filesystem.patch

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
`systeminfomation.fsSize()` doesn't work on Android
2+
3+
--- a/src/classes/filesystem.class.js
4+
+++ b/src/classes/filesystem.class.js
5+
@@ -504,17 +504,8 @@
6+
this.space_bar.text.innerHTML = "Calculating available space...";
7+
this.space_bar.bar.removeAttribute("value");
8+
9+
- window.si.fsSize().catch(() => {
10+
- this.space_bar.text.innerHTML = "Could not calculate mountpoint usage.";
11+
- this.space_bar.bar.value = 100;
12+
- }).then(d => {
13+
- d.forEach(fsBlock => {
14+
- if (path.startsWith(fsBlock.mount)) {
15+
- this.fsBlock = fsBlock;
16+
- }
17+
- });
18+
- this.renderDiskUsage(this.fsBlock);
19+
- });
20+
+ this.space_bar.text.innerHTML = "Could not calculate mountpoint usage.";
21+
+ this.space_bar.bar.value = 100;
22+
};
23+
24+
this.renderDiskUsage = async fsBlock => {

tur/edex-ui/0005-netstat.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
`net.mac` is always empty on Android.
2+
3+
--- a/src/classes/netstat.class.js
4+
+++ b/src/classes/netstat.class.js
5+
@@ -77,7 +77,7 @@
6+
} else {
7+
// Find the first external, IPv4 connected networkInterface that has a MAC address set
8+
9+
- while (net.operstate !== "up" || net.internal === true || net.ip4 === "" || net.mac === "") {
10+
+ while (net.operstate !== "up" || net.internal === true || net.ip4 === "") {
11+
netID++;
12+
if (data[netID]) {
13+
net = data[netID];

tur/edex-ui/build.sh

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ TERMUX_PKG_DESCRIPTION="A cross-platform, customizable science fiction terminal
33
TERMUX_PKG_LICENSE="MIT"
44
TERMUX_PKG_MAINTAINER="@termux-user-repository"
55
TERMUX_PKG_VERSION="2.2.8"
6+
TERMUX_PKG_REVISION=1
67
TERMUX_PKG_SRCURL=git+https://github.com/GitSquared/edex-ui
78
TERMUX_PKG_SHA256=c6a8ef34890c028ee2a1e4c64485db29d4d0aedda0d63c0fc5f8572d45226b51
89
TERMUX_PKG_DEPENDS="electron-deps"
10+
TERMUX_PKG_ANTI_BUILD_DEPENDS="electron-deps"
911
TERMUX_PKG_BUILD_IN_SRC=true
1012
TERMUX_PKG_NO_STATICSPLIT=true
1113

@@ -38,8 +40,33 @@ termux_step_get_source() {
3840
cp -Rf $TMP_CHECKOUT $TERMUX_PKG_SRCDIR
3941
}
4042

43+
__tur_setup_nodejs_14() {
44+
local NODEJS_VERSION=14.2.0
45+
local NODEJS_FOLDER=${TERMUX_PKG_CACHEDIR}/build-tools/nodejs-${NODEJS_VERSION}
46+
47+
if [ ! -x "$NODEJS_FOLDER/bin/node" ]; then
48+
mkdir -p "$NODEJS_FOLDER"
49+
local NODEJS_TAR_FILE=$TERMUX_PKG_TMPDIR/nodejs-$NODEJS_VERSION.tar.xz
50+
termux_download https://nodejs.org/dist/v${NODEJS_VERSION}/node-v${NODEJS_VERSION}-linux-x64.tar.xz \
51+
"$NODEJS_TAR_FILE" \
52+
468cbd92271da8c0cacaa3fa432a73a332e398bade8ad7359a94aa8ab3cc3cca
53+
tar -xf "$NODEJS_TAR_FILE" -C "$NODEJS_FOLDER" --strip-components=1
54+
fi
55+
export PATH="$NODEJS_FOLDER/bin:$PATH"
56+
}
57+
58+
__tur_setup_pypy2() {
59+
termux_download \
60+
https://downloads.python.org/pypy/pypy2.7-v7.3.17-linux64.tar.bz2 \
61+
"$TERMUX_PKG_CACHEDIR"/pypy2.7-v7.3.17-linux64.tar.bz2 \
62+
9f3497f87b3372d17e447369e0016a4bec99a6b4d2a59aba774a25bfe4353474
63+
tar -C "$TERMUX_PKG_CACHEDIR" -xf "$TERMUX_PKG_CACHEDIR"/pypy2.7-v7.3.17-linux64.tar.bz2
64+
export PATH="$TERMUX_PKG_CACHEDIR/pypy2.7-v7.3.17-linux64/bin:$PATH"
65+
}
66+
4167
termux_step_configure() {
42-
termux_setup_nodejs
68+
__tur_setup_nodejs_14
69+
__tur_setup_pypy2
4370

4471
if [ $TERMUX_ARCH = "arm" ]; then
4572
electron_arch="armv7l"

0 commit comments

Comments
 (0)