1
0
mirror of https://github.com/PurpleI2P/i2pd-android.git synced 2025-09-14 15:42:08 +00:00

get webconsole address from daemon

Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
R4SAS 2021-02-12 17:48:04 +03:00
parent 404cb804bc
commit f23335b1c1
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
6 changed files with 131 additions and 117 deletions

View File

@ -15,7 +15,7 @@ android {
targetSdkVersion 29
minSdkVersion 14
versionCode 23500
versionName "2.35.0-113-g01df1647"
versionName "2.35.0-121-gaa206d03"
setProperty("archivesBaseName", archivesBaseName + "-" + versionName)
ndk {

@ -1 +1 @@
Subproject commit 01df1647bcfe7a9b92a90b457fdf2683e338a4f9
Subproject commit aa206d034dfb744d9be28c5f0911061ebc33ead9

View File

@ -9,6 +9,7 @@
#include <jni.h>
#include "org_purplei2p_i2pd_I2PD_JNI.h"
#include "DaemonAndroid.h"
#include "Config.h"
#include "RouterContext.h"
#include "ClientContext.h"
#include "Transports.h"
@ -112,3 +113,11 @@ JNIEXPORT jint JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_GetTransitTunnelsCount
(JNIEnv *env, jclass clazz) {
return i2p::tunnel::tunnels.CountTransitTunnels();
}
JNIEXPORT jstring JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getWebConsAddr
(JNIEnv *env, jclass clazz) {
std::string httpAddr; i2p::config::GetOption("http.address", httpAddr);
uint16_t httpPort; i2p::config::GetOption("http.port", httpPort);
std::string result = "http://" + httpAddr + ":" + std::to_string(httpPort) + "/";
return env->NewStringUTF(result.c_str());
}

View File

@ -47,6 +47,9 @@ JNIEXPORT void JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_setDataDir
JNIEXPORT jint JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_GetTransitTunnelsCount
(JNIEnv *, jclass);
JNIEXPORT jstring JNICALL Java_org_purplei2p_i2pd_I2PD_1JNI_getWebConsAddr
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif

View File

@ -24,6 +24,8 @@ public class I2PD_JNI {
public static native int GetTransitTunnelsCount();
public static native String getWebConsAddr();
public static void loadLibraries() {
//System.loadLibrary("c++_shared");
System.loadLibrary("i2pd");

View File

@ -28,7 +28,7 @@ public class WebConsoleActivity extends Activity {
final WebSettings webSettings = webView.getSettings();
webSettings.setBuiltInZoomControls(true);
webSettings.setJavaScriptEnabled(false);
webView.loadUrl("http://127.0.0.1:7070"); // TODO: instead 7070 I2Pd....HttpPort
webView.loadUrl(I2PD_JNI.getWebConsAddr());
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {