Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/plugins/proot/libs/arm32/libaxs.so
Binary file not shown.
Binary file added src/plugins/proot/libs/arm64/libaxs.so
Binary file not shown.
Binary file added src/plugins/proot/libs/x64/libaxs.so
Binary file not shown.
9 changes: 9 additions & 0 deletions src/plugins/proot/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,28 @@
<source-file src="libs/x64/libproot32.so" target-dir="libs/x86_64" />
<source-file src="libs/x64/libproot-xed.so" target-dir="libs/x86_64" />
<source-file src="libs/x64/libtalloc.so" target-dir="libs/x86_64" />

<source-file src="libs/x64/libaxs.so" target-dir="libs/x86_64" />
<resource-file src="assets/alpine_assets/x64/alpine.rootfs" target="assets/alpine_assets/x64/alpine.rootfs" />

<!-- arm64 / arm-v8a -->
<source-file src="libs/arm64/libproot.so" target-dir="libs/arm64-v8a" />
<source-file src="libs/arm64/libproot32.so" target-dir="libs/arm64-v8a" />
<source-file src="libs/arm64/libproot-xed.so" target-dir="libs/arm64-v8a" />
<source-file src="libs/arm64/libtalloc.so" target-dir="libs/arm64-v8a" />

<source-file src="libs/arm64/libaxs.so" target-dir="libs/arm64-v8a" />
<resource-file src="assets/alpine_assets/arm64/alpine.rootfs" target="assets/alpine_assets/arm64/alpine.rootfs" />


<!-- armhf / armeabi-v7a (armeabi / armeabi-v6a not supported)-->
<source-file src="libs/arm32/libproot.so" target-dir="libs/armeabi-v7a" />
<source-file src="libs/arm32/libproot-xed.so" target-dir="libs/armeabi-v7a" />
<source-file src="libs/arm32/libtalloc.so" target-dir="libs/armeabi-v7a" />

<source-file src="libs/arm32/libaxs.so" target-dir="libs/armeabi-v7a" />
<resource-file src="assets/alpine_assets/arm32/alpine.rootfs" target="assets/alpine_assets/arm32/alpine.rootfs" />


</platform>
</plugin>
31 changes: 31 additions & 0 deletions src/plugins/system/android/com/foxdebug/system/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ public boolean execute(
case "getInstaller":
case "compare-file-text":
case "compare-texts":
case "extractAsset":
case "pin-file-shortcut":
break;
case "get-configuration":
Expand Down Expand Up @@ -431,6 +432,17 @@ public void run() {
new Runnable() {
public void run() {
switch (action) {
case "extractAsset":
try{
String assetName = args.getString(0);
String destinationPath = args.getString(1);
extractAsset(assetName, destinationPath, callbackContext);
}catch(Exception e){
callbackContext.error("Failed to extract asset: " + e.getMessage());

}
return;

case "getInstaller":
try {
PackageManager pm = context.getPackageManager();
Expand Down Expand Up @@ -2163,4 +2175,23 @@ private void setNativeContextMenuDisabled(boolean disabled) {
}
webView.setNativeContextMenuDisabled(disabled);
}

private void extractAsset(String assetName, String destinationPath, CallbackContext callback) {
try (
InputStream in = context.getAssets().open(assetName);
OutputStream out = new FileOutputStream(destinationPath)
) {
byte[] buffer = new byte[8192];
int length;
while ((length = in.read(buffer)) != -1) {
out.write(buffer, 0, length);
}
out.flush();
callback.success();
}catch (IOException e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
callback.error(sw.toString());
}
}
Comment thread
RohitKushvaha01 marked this conversation as resolved.
}
6 changes: 6 additions & 0 deletions src/plugins/system/www/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ module.exports = {
shareText: function (text, success, error) {
cordova.exec(success, error, 'System', 'shareText', [text]);
},
getNativeLibraryPath: function (success, error) {
cordova.exec(success, error, 'System', 'getNativeLibraryPath', []);
},


getNativeLibraryPath: function (success, error) {
Expand All @@ -48,6 +51,9 @@ module.exports = {
redeemReward: function (offerId, success, error) {
cordova.exec(success, error, 'System', 'redeemReward', [offerId]);
},
extractAsset: function (assetName, destinationPath, success, error) {
cordova.exec(success, error, 'System', 'extractAsset', [assetName, destinationPath]);
},

getParentPath: function (path, success, error) {
cordova.exec(success, error, 'System', 'getParentPath', [path]);
Expand Down
1 change: 1 addition & 0 deletions src/plugins/terminal/scripts/init-sandbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ ARGS="$ARGS -b /dev/urandom:/dev/random"
ARGS="$ARGS -b /proc"
ARGS="$ARGS -b /sys"
ARGS="$ARGS -b $PREFIX"
ARGS="$ARGS -b $NATIVE_DIR"
ARGS="$ARGS -b $PREFIX/public:/public"
ARGS="$ARGS -b $PREFIX/public:/home"
ARGS="$ARGS -b $PREFIX/public:/root"
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/terminal/src/android/Executor.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,15 @@ public void handleMessage(Message msg) {
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
// For actions that don't need the service, handle them directly
if (action.equals("loadLibrary")) {
callbackContext.error("This feature is no longer supported. Loading native libraries directly from JavaScript is no longer allowed due to security reasons.");
/*
try {
System.load(args.getString(0));
callbackContext.success("Library loaded successfully.");
} catch (Exception e) {
callbackContext.error("Failed to load library: " + e.getMessage());
}
*/
return true;
}

Expand Down
Loading