|
|
@ -38,6 +38,10 @@ import java.util.Iterator;
|
|
|
|
public class MainActivity extends AppCompatActivity {
|
|
|
|
public class MainActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
|
|
|
private static final String TAG = "FRP";
|
|
|
|
private static final String TAG = "FRP";
|
|
|
|
|
|
|
|
private static final String DEFAULT_SERVER = "61.169.135.146";
|
|
|
|
|
|
|
|
private static final int DEFAULT_PORT = 7000;
|
|
|
|
|
|
|
|
private static final int DEFAULT_REMOTE_PORT = 50001;
|
|
|
|
|
|
|
|
|
|
|
|
private Switch state_switch;
|
|
|
|
private Switch state_switch;
|
|
|
|
private Switch auto_start_switch;
|
|
|
|
private Switch auto_start_switch;
|
|
|
|
private ShellService mService;
|
|
|
|
private ShellService mService;
|
|
|
@ -45,11 +49,13 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
|
|
|
private static final String MICRO_KEY_SERVER = "%%SERVER%%";
|
|
|
|
private static final String MICRO_KEY_SERVER = "%%SERVER%%";
|
|
|
|
private static final String MICRO_KEY_PORT = "%%PORT%%";
|
|
|
|
private static final String MICRO_KEY_PORT = "%%PORT%%";
|
|
|
|
|
|
|
|
private static final String MICRO_KEY_REMOTE_PORT = "%%REMOTE_PORT%%";
|
|
|
|
|
|
|
|
|
|
|
|
Handler mHandler;
|
|
|
|
Handler mHandler;
|
|
|
|
|
|
|
|
|
|
|
|
private String mServer = "61.169.135.146";
|
|
|
|
private String mServer = DEFAULT_SERVER;
|
|
|
|
private int mPort = 7000;
|
|
|
|
private int mPort = DEFAULT_PORT;
|
|
|
|
|
|
|
|
private int mRemotePort = DEFAULT_REMOTE_PORT;
|
|
|
|
|
|
|
|
|
|
|
|
private final ServiceConnection connection = new ServiceConnection() {
|
|
|
|
private final ServiceConnection connection = new ServiceConnection() {
|
|
|
|
public void onServiceConnected(@NotNull ComponentName className, @NotNull IBinder service) {
|
|
|
|
public void onServiceConnected(@NotNull ComponentName className, @NotNull IBinder service) {
|
|
|
@ -90,7 +96,8 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Intent intent = getIntent();
|
|
|
|
Intent intent = getIntent();
|
|
|
|
String server = intent.getStringExtra("server");
|
|
|
|
String server = intent.getStringExtra("server");
|
|
|
|
mPort = intent.getIntExtra("port", 7000);
|
|
|
|
mPort = intent.getIntExtra("port", DEFAULT_PORT);
|
|
|
|
|
|
|
|
mRemotePort = intent.getIntExtra("remotePort", DEFAULT_REMOTE_PORT);
|
|
|
|
startFrp = intent.getIntExtra("startFrp", 0);
|
|
|
|
startFrp = intent.getIntExtra("startFrp", 0);
|
|
|
|
if (!TextUtils.isEmpty(server)) {
|
|
|
|
if (!TextUtils.isEmpty(server)) {
|
|
|
|
mServer = server;
|
|
|
|
mServer = server;
|
|
|
@ -104,7 +111,7 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
checkConfig(mServer, mPort);
|
|
|
|
checkConfig(mServer, mPort, mRemotePort);
|
|
|
|
checkNotificationPermission();
|
|
|
|
checkNotificationPermission();
|
|
|
|
createBGNotificationChannel();
|
|
|
|
createBGNotificationChannel();
|
|
|
|
|
|
|
|
|
|
|
@ -192,7 +199,7 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public final void checkConfig(String server, int port) {
|
|
|
|
public final void checkConfig(String server, int port, int remotePort) {
|
|
|
|
// Intrinsics.checkNotNullExpressionValue(var12, "resources");
|
|
|
|
// Intrinsics.checkNotNullExpressionValue(var12, "resources");
|
|
|
|
AssetManager assetmanager = getResources().getAssets();
|
|
|
|
AssetManager assetmanager = getResources().getAssets();
|
|
|
|
|
|
|
|
|
|
|
@ -209,6 +216,7 @@ public class MainActivity extends AppCompatActivity {
|
|
|
|
String content = FilesUtils.readTextFile(inputStream);
|
|
|
|
String content = FilesUtils.readTextFile(inputStream);
|
|
|
|
content = content.replaceAll(MICRO_KEY_SERVER, server);
|
|
|
|
content = content.replaceAll(MICRO_KEY_SERVER, server);
|
|
|
|
content = content.replaceAll(MICRO_KEY_PORT, Integer.toString(port));
|
|
|
|
content = content.replaceAll(MICRO_KEY_PORT, Integer.toString(port));
|
|
|
|
|
|
|
|
content = content.replaceAll(MICRO_KEY_REMOTE_PORT, Integer.toString(remotePort));
|
|
|
|
|
|
|
|
|
|
|
|
FilesUtils.writeTextFile(file.getAbsolutePath(), content);
|
|
|
|
FilesUtils.writeTextFile(file.getAbsolutePath(), content);
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|