aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle12
-rw-r--r--app/proguard-rules.pro4
-rw-r--r--app/src/main/AndroidManifest.xml7
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/configure/ConfigurationAccessServerFragment.kt77
-rw-r--r--app/src/main/java/org/pacien/tincapp/context/AppNotificationManager.kt13
-rw-r--r--app/src/main/java/org/pacien/tincapp/service/ConfigurationAccessService.kt204
-rw-r--r--app/src/main/res/layout/configure_activity.xml14
-rw-r--r--app/src/main/res/layout/configure_tools_configuration_access_fragment.xml86
-rw-r--r--app/src/main/res/values-ru-rRU/strings.xml10
-rw-r--r--app/src/main/res/values/strings.xml10
10 files changed, 3 insertions, 434 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 5d2da3f..5d49965 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -71,17 +71,6 @@ android {
71 dataBinding = true 71 dataBinding = true
72 } 72 }
73 73
74 packagingOptions {
75 resources {
76 excludes += [
77 'META-INF/DEPENDENCIES',
78 'META-INF/spring.schemas',
79 'META-INF/spring.handlers',
80 'META-INF/license.txt',
81 ]
82 }
83 }
84
85 namespace 'org.pacien.tincapp' 74 namespace 'org.pacien.tincapp'
86} 75}
87 76
@@ -101,7 +90,6 @@ dependencies {
101 implementation('org.apache.commons:commons-configuration2:2.3') { exclude group: 'commons-logging', module: 'commons-logging' } 90 implementation('org.apache.commons:commons-configuration2:2.3') { exclude group: 'commons-logging', module: 'commons-logging' }
102 implementation('commons-beanutils:commons-beanutils:1.9.3') { exclude group: 'commons-logging', module: 'commons-logging' } 91 implementation('commons-beanutils:commons-beanutils:1.9.3') { exclude group: 'commons-logging', module: 'commons-logging' }
103 implementation('commons-io:commons-io:2.6') { exclude group: 'commons-logging', module: 'commons-logging' } 92 implementation('commons-io:commons-io:2.6') { exclude group: 'commons-logging', module: 'commons-logging' }
104 implementation('org.apache.ftpserver:ftpserver:1.1.1') { exclude group: 'org.slf4j', module: 'slf4j-log4j12' }
105} 93}
106 94
107repositories { 95repositories {
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index ffbb3e3..2bb4a71 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -1,5 +1,5 @@
1# Tinc App, an Android binding and user interface for the tinc mesh VPN daemon 1# Tinc App, an Android binding and user interface for the tinc mesh VPN daemon
2# Copyright (C) 2017-2020 Pacien TRAN-GIRARD 2# Copyright (C) 2017-2023 Pacien TRAN-GIRARD
3# 3#
4# This program is free software: you can redistribute it and/or modify 4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by 5# it under the terms of the GNU General Public License as published by
@@ -15,8 +15,6 @@
15# along with this program. If not, see <https://www.gnu.org/licenses/>. 15# along with this program. If not, see <https://www.gnu.org/licenses/>.
16 16
17-keep class org.apache.commons.** { *; } 17-keep class org.apache.commons.** { *; }
18-keep class org.apache.mina.** { *; }
19-keep class org.apache.ftpserver.** { *; }
20-keep class org.bouncycastle.** 18-keep class org.bouncycastle.**
21-keep class ch.qos.** { *; } 19-keep class ch.qos.** { *; }
22-keep class org.slf4j.** { *; } 20-keep class org.slf4j.** { *; }
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8d71109..827f421 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -26,9 +26,6 @@
26 <!-- required for VPN service error reporting, since API 33 --> 26 <!-- required for VPN service error reporting, since API 33 -->
27 <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> 27 <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
28 28
29 <!-- needed for the configuration FTP server -->
30 <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
31
32 <!-- workaround for broken file permissions on some Android ROMs --> 29 <!-- workaround for broken file permissions on some Android ROMs -->
33 <uses-permission-sdk-23 android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 30 <uses-permission-sdk-23 android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
34 31
@@ -91,10 +88,6 @@
91 </intent-filter> 88 </intent-filter>
92 </service> 89 </service>
93 90
94 <service
95 android:name="org.pacien.tincapp.service.ConfigurationAccessService">
96 </service>
97
98 </application> 91 </application>
99 92
100</manifest> 93</manifest>
diff --git a/app/src/main/java/org/pacien/tincapp/activities/configure/ConfigurationAccessServerFragment.kt b/app/src/main/java/org/pacien/tincapp/activities/configure/ConfigurationAccessServerFragment.kt
deleted file mode 100644
index c90299a..0000000
--- a/app/src/main/java/org/pacien/tincapp/activities/configure/ConfigurationAccessServerFragment.kt
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon
3 * Copyright (C) 2017-2020 Pacien TRAN-GIRARD
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19package org.pacien.tincapp.activities.configure
20
21import android.content.Intent
22import android.os.Bundle
23import android.view.LayoutInflater
24import android.view.View
25import android.view.ViewGroup
26import androidx.databinding.Observable
27import androidx.databinding.ObservableBoolean
28import org.pacien.tincapp.activities.BaseFragment
29import org.pacien.tincapp.databinding.ConfigureToolsConfigurationAccessFragmentBinding
30import org.pacien.tincapp.service.ConfigurationAccessService
31
32/**
33 * @author pacien
34 */
35class ConfigurationAccessServerFragment : BaseFragment() {
36 private val ftpServerStartListener = object : Observable.OnPropertyChangedCallback() {
37 override fun onPropertyChanged(sender: Observable, propertyId: Int) {
38 binding.ftpEnabled = (sender as ObservableBoolean).get()
39 }
40 }
41
42 private lateinit var binding: ConfigureToolsConfigurationAccessFragmentBinding
43
44 override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
45 binding = ConfigureToolsConfigurationAccessFragmentBinding.inflate(inflater, container, false)
46 binding.toggleFtpState = { toggleServer() }
47 setConnectionInfo()
48 return binding.root
49 }
50
51 override fun onResume() {
52 super.onResume()
53 setConnectionInfo()
54 ConfigurationAccessService.runningState.addOnPropertyChangedCallback(ftpServerStartListener)
55 binding.ftpEnabled = ConfigurationAccessService.runningState.get()
56 }
57
58 override fun onPause() {
59 ConfigurationAccessService.runningState.removeOnPropertyChangedCallback(ftpServerStartListener)
60 super.onPause()
61 }
62
63 private fun setConnectionInfo() {
64 binding.ftpUsername = ConfigurationAccessService.getFtpUsername()
65 binding.ftpPassword = ConfigurationAccessService.getFtpPassword()
66 binding.ftpPort = ConfigurationAccessService.getFtpPort()
67 }
68
69 private fun toggleServer() {
70 val targetServiceIntent = Intent(requireContext(), ConfigurationAccessService::class.java)
71
72 if (binding.ftpEnabled)
73 requireContext().stopService(targetServiceIntent)
74 else
75 requireContext().startService(targetServiceIntent)
76 }
77}
diff --git a/app/src/main/java/org/pacien/tincapp/context/AppNotificationManager.kt b/app/src/main/java/org/pacien/tincapp/context/AppNotificationManager.kt
index 5b01a54..d6e21f5 100644
--- a/app/src/main/java/org/pacien/tincapp/context/AppNotificationManager.kt
+++ b/app/src/main/java/org/pacien/tincapp/context/AppNotificationManager.kt
@@ -36,10 +36,7 @@ import org.pacien.tincapp.utils.PendingIntentUtils
36class AppNotificationManager(private val context: Context) { 36class AppNotificationManager(private val context: Context) {
37 companion object { 37 companion object {
38 private const val ERROR_CHANNEL_ID = "org.pacien.tincapp.notification.channels.error" 38 private const val ERROR_CHANNEL_ID = "org.pacien.tincapp.notification.channels.error"
39 private const val CONFIG_ACCESS_CHANNEL_ID = "org.pacien.tincapp.notification.channels.configuration"
40
41 const val ERROR_NOTIFICATION_ID = 0 39 const val ERROR_NOTIFICATION_ID = 0
42 const val CONFIG_ACCESS_NOTIFICATION_ID = 1
43 } 40 }
44 41
45 init { 42 init {
@@ -65,9 +62,6 @@ class AppNotificationManager(private val context: Context) {
65 NotificationManagerCompat.from(context).cancelAll() 62 NotificationManagerCompat.from(context).cancelAll()
66 } 63 }
67 64
68 fun newConfigurationAccessNotificationBuilder() =
69 NotificationCompat.Builder(context, CONFIG_ACCESS_CHANNEL_ID)
70
71 @RequiresApi(Build.VERSION_CODES.O) 65 @RequiresApi(Build.VERSION_CODES.O)
72 private fun registerChannels() { 66 private fun registerChannels() {
73 context.getSystemService(NotificationManager::class.java) 67 context.getSystemService(NotificationManager::class.java)
@@ -78,13 +72,6 @@ class AppNotificationManager(private val context: Context) {
78 NotificationManager.IMPORTANCE_HIGH 72 NotificationManager.IMPORTANCE_HIGH
79 )) 73 ))
80 } 74 }
81 .apply {
82 createNotificationChannel(NotificationChannel(