Skip to content

Commit 2ef5d86

Browse files
feat: added public directory + merge /home + /public (#2049)
* feat: added public directory * format * feat: merged /root /home and /public
1 parent 6121291 commit 2ef5d86

2 files changed

Lines changed: 36 additions & 22 deletions

File tree

src/pages/fileBrowser/fileBrowser.js

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,31 +1046,23 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
10461046
);
10471047
}
10481048

1049-
// Check for Terminal Home Directory storage
10501049
try {
1051-
const isTerminalInstalled = await Terminal.isInstalled();
1052-
if (typeof Terminal !== "undefined" && isTerminalInstalled) {
1053-
const isTerminalSupported = await Terminal.isSupported();
1054-
1055-
if (isTerminalSupported && isTerminalInstalled) {
1056-
const terminalHomeUrl = cordova.file.dataDirectory + "alpine/home";
1057-
1058-
// Check if this storage is not already in the list
1059-
const terminalStorageExists = allStorages.find(
1060-
(storage) =>
1061-
storage.uuid === "terminal-home" ||
1062-
storage.url === terminalHomeUrl,
1063-
);
1050+
const terminalPublicUrl = cordova.file.dataDirectory + "public";
10641051

1065-
if (!terminalStorageExists) {
1066-
util.pushFolder(allStorages, "Terminal Home", terminalHomeUrl, {
1067-
uuid: "terminal-home",
1068-
});
1069-
}
1070-
}
1052+
// Check if this storage is not already in the list
1053+
const terminalPublicStorageExists = allStorages.find(
1054+
(storage) =>
1055+
storage.uuid === "terminal-public" ||
1056+
storage.url === terminalPublicUrl,
1057+
);
1058+
1059+
if (!terminalPublicStorageExists) {
1060+
util.pushFolder(allStorages, "Terminal Public", terminalPublicUrl, {
1061+
uuid: "terminal-public",
1062+
});
10711063
}
1072-
} catch (error) {
1073-
console.error("Error checking Terminal installation:", error);
1064+
} catch (err) {
1065+
console.error("Error while adding public directory", err);
10741066
}
10751067

10761068
try {

src/plugins/terminal/scripts/init-sandbox.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ mkdir -p "$PREFIX/tmp"
44
mkdir -p "$PREFIX/alpine/tmp"
55
mkdir -p "$PREFIX/public"
66

7+
SRC1="$PREFIX/alpine/home"
8+
SRC2="$PREFIX/alpine/root"
9+
DEST="$PREFIX/public"
10+
11+
mkdir -p "$DEST"
12+
13+
move_all() {
14+
SRC="$1"
15+
16+
[ -d "$SRC" ] || return 0
17+
18+
# Only continue if directory is not empty
19+
[ "$(find "$SRC" -mindepth 1 -maxdepth 1 | head -n 1)" ] || return 0
20+
21+
find "$SRC" -mindepth 1 -maxdepth 1 -exec mv -f {} "$DEST"/ \;
22+
}
23+
24+
move_all "$SRC1"
25+
move_all "$SRC2"
26+
727
export PROOT_TMP_DIR=$PREFIX/tmp
828

929
if [ "$FDROID" = "true" ]; then
@@ -63,6 +83,8 @@ ARGS="$ARGS -b /proc"
6383
ARGS="$ARGS -b /sys"
6484
ARGS="$ARGS -b $PREFIX"
6585
ARGS="$ARGS -b $PREFIX/public:/public"
86+
ARGS="$ARGS -b $PREFIX/public:/home"
87+
ARGS="$ARGS -b $PREFIX/public:/root"
6688
ARGS="$ARGS -b $PREFIX/alpine/tmp:/dev/shm"
6789

6890

0 commit comments

Comments
 (0)