Commit 6d6d5074 authored by jonasled's avatar jonasled

Merge branch 'develop'

parents bc467000 0574d364
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
<package name="io.ktor" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
......
......@@ -10,7 +10,7 @@ android {
minSdkVersion 23
targetSdkVersion 29
versionCode Integer.valueOf(System.env.VERSION_CODE ?: 10)
versionName "1.8.0-${System.env.VERSION_SHA}"
versionName "1.9.0-${System.env.VERSION_SHA}"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
......
......@@ -135,36 +135,35 @@ public class HelperFunctions {
public static void trustCert(Context context, String url){//This function is used to ask for a new cert to trust.
try {
String[] result = new String[6];
URL urlURL = new URL(url + "/");
String[] result = new String[6];
URL urlURL = new URL(url + "/");
SSLContext sslCtx = SSLContext.getInstance("TLS"); //create a new SSL context, which trusts all Certificates
sslCtx.init(null, new TrustManager[]{ new X509TrustManager() {
SSLContext sslCtx = SSLContext.getInstance("TLS"); //create a new SSL context, which trusts all Certificates
sslCtx.init(null, new TrustManager[]{ new X509TrustManager() {
private X509Certificate[] accepted;
private X509Certificate[] accepted;
@Override
public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException {
accepted = xcs;
}
@Override
public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return accepted;
}
}}, null);
@Override
public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException {
accepted = xcs;
}
HttpsURLConnection connection = (HttpsURLConnection) urlURL.openConnection(); //open the URL submitted with the Parameter
@Override
public X509Certificate[] getAcceptedIssuers() {
return accepted;
}
}}, null);
connection.setHostnameVerifier((String string, SSLSession ssls) -> true);
HttpsURLConnection connection = (HttpsURLConnection) urlURL.openConnection(); //open the URL submitted with the Parameter
connection.setSSLSocketFactory(sslCtx.getSocketFactory());
connection.setHostnameVerifier((String string, SSLSession ssls) -> true);
if (connection.getResponseCode() == 200) { //if success get the Certificate
connection.setSSLSocketFactory(sslCtx.getSocketFactory());
connection.connect();
Certificate[] certificates = connection.getServerCertificates();
for (int i = certificates.length - 1; i <= 0; i--) { //for every certificate in chain ask if we should trust it.
......@@ -204,10 +203,8 @@ public class HelperFunctions {
}
}
connection.disconnect();//catch all exceptions
} catch (Exception ex) {
connection.disconnect();
} catch (Exception ex) {//catch all exceptions
ex.printStackTrace();//print the exception to console
}
}
......
......@@ -33,6 +33,7 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(loginActivity.theme == 3) setTheme(R.style.Theme_App_black);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
listView = findViewById(R.id.listView);
......@@ -127,6 +128,19 @@ public class MainActivity extends AppCompatActivity {
databaseID.add(entry.toString());//add the id of the Server
}
for (int i = 0; i < names.size(); i++) { //sort the nodes alphabetical
for (int j = i + 1; j < names.size(); j++) {
if (names.get(i).toLowerCase().compareTo(names.get(j).toLowerCase()) > 0) {
String temp_ = names.get(i);
names.set(i, names.get(j));
names.set(j, temp_);
temp_ = databaseID.get(i);
databaseID.set(i, databaseID.get(j));
databaseID.set(j, temp_);
}
}
}
adapter = new ServerListAdapter(this, names.toArray(new String[0]) , R.drawable.proxmox); //save the array to the adapter (use Proxmox logo as icon=
} else {
//database is empty
......
......@@ -77,6 +77,7 @@ public class NewServer extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(loginActivity.theme == 3) setTheme(R.style.Theme_App_black);
setContentView(R.layout.activity_new_server);
Toolbar toolbar = findViewById(R.id.toolbar);//find the UI elements
setSupportActionBar(toolbar);
......
......@@ -85,6 +85,7 @@ public class NodeControl extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(loginActivity.theme == 3) setTheme(R.style.Theme_App_black);
setContentView(R.layout.activity_node_control);
Toolbar toolbar = findViewById(R.id.toolbar);
consoleButton = findViewById(R.id.buttonConsole);
......@@ -269,6 +270,7 @@ public class NodeControl extends AppCompatActivity {
protected void onPostExecute(String result) {
pd.dismiss();
if (result == "failedIO") {
timer.cancel();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(NodeControl.this);
dlgAlert.setMessage(R.string.errNotReachable);
dlgAlert.setTitle(R.string.errNotReachableTitle);
......@@ -276,6 +278,7 @@ public class NodeControl extends AppCompatActivity {
dlgAlert.setPositiveButton(R.string.ok,(DialogInterface dialog, int which) -> finish());
dlgAlert.create().show();
} else if (result == "failedJSON") {
timer.cancel();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(NodeControl.this);
dlgAlert.setMessage(R.string.errInvalidJson);
dlgAlert.setTitle(R.string.errInvalidJsonTitle);
......@@ -341,6 +344,7 @@ public class NodeControl extends AppCompatActivity {
protected void onPostExecute(String result) {
pd.dismiss();
if (result == "failedIO") {
timer.cancel();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(NodeControl.this);
dlgAlert.setMessage(R.string.errNotReachable);
dlgAlert.setTitle(R.string.errNotReachableTitle);
......@@ -348,6 +352,7 @@ public class NodeControl extends AppCompatActivity {
dlgAlert.setPositiveButton(R.string.ok,(DialogInterface dialog, int which) -> finish());
dlgAlert.create().show();
} else if (result == "failedJSON") {
timer.cancel();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(NodeControl.this);
dlgAlert.setMessage(R.string.errInvalidJson);
dlgAlert.setTitle(R.string.errInvalidJsonTitle);
......@@ -502,6 +507,7 @@ public class NodeControl extends AppCompatActivity {
showLoading = false;
}
if (result == "failedIO") {
timer.cancel();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(NodeControl.this);
dlgAlert.setMessage(R.string.errNotReachable);
dlgAlert.setTitle(R.string.errNotReachableTitle);
......@@ -509,6 +515,7 @@ public class NodeControl extends AppCompatActivity {
dlgAlert.setPositiveButton(R.string.ok,(DialogInterface dialog, int which) -> finish());
dlgAlert.create().show();
} else if (result == "failedJSON") {
timer.cancel();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(NodeControl.this);
dlgAlert.setMessage(R.string.errInvalidJson);
dlgAlert.setTitle(R.string.errInvalidJsonTitle);
......@@ -548,6 +555,7 @@ public class NodeControl extends AppCompatActivity {
HelperFunctions.formatGraph(networkGraph, networkInGraphSeries, networkOutGraphSeries);
} catch (JSONException e){
timer.cancel();
e.printStackTrace();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(NodeControl.this);
dlgAlert.setMessage(R.string.errInvalidJson);
......
......@@ -65,6 +65,7 @@ public class ProxmoxConnected extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
try {
super.onCreate(savedInstanceState);
if(loginActivity.theme == 3) setTheme(R.style.Theme_App_black);
setContentView(R.layout.activity_proxmox_connected);
listView = findViewById(R.id.listView);
swipeRefreshLayout = findViewById(R.id.swiperefresh);
......
......@@ -35,6 +35,7 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
......@@ -181,12 +182,13 @@ public class ServerControl extends AppCompatActivity {
consoleButton.setOnClickListener((View v) -> {
Intent intent = new Intent(getApplicationContext(), de.jonasled.proxdroid.ConsoleView.class);
intent.putExtra("ticket", ticket);
String type_ = type;
if(type.equals("qemu")) type = "kvm";
if(type.equals("qemu")) type_ = "kvm";
if(type.equals("lxc") && PreferenceManager.getDefaultSharedPreferences(this).getBoolean("useXterm", false)){
intent.putExtra("url", urlString + "?console=" + type + "&vmid=" + id + "&node=" + node + "&xtermjs=1");
intent.putExtra("url", urlString + "?console=" + type_ + "&vmid=" + id + "&node=" + node + "&xtermjs=1");
}else {
intent.putExtra("url", urlString + "?console=" + type + "&vmid=" + id + "&node=" + node + "&novnc=1");
intent.putExtra("url", urlString + "?console=" + type_ + "&vmid=" + id + "&node=" + node + "&novnc=1");
}
intent.putExtra("baseurl", urlString);
intent.putExtra("CSRFPreventionToken", CSRFPreventionToken);
......@@ -330,6 +332,7 @@ public class ServerControl extends AppCompatActivity {
protected void onPostExecute(String result) {
pd.dismiss();
if (result == "failedIO") {
timer.cancel();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(ServerControl.this);
dlgAlert.setMessage(R.string.errNotReachable);
dlgAlert.setTitle(R.string.errNotReachableTitle);
......@@ -337,6 +340,7 @@ public class ServerControl extends AppCompatActivity {
dlgAlert.setPositiveButton(R.string.ok,(DialogInterface dialog, int which) -> finish());
dlgAlert.create().show();
} else if (result == "failedJSON") {
timer.cancel();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(ServerControl.this);
dlgAlert.setMessage(R.string.errInvalidJson);
dlgAlert.setTitle(R.string.errInvalidJsonTitle);
......@@ -402,6 +406,7 @@ public class ServerControl extends AppCompatActivity {
protected void onPostExecute(String result) {
pd.dismiss();
if (result == "failedIO") {
timer.cancel();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(ServerControl.this);
dlgAlert.setMessage(R.string.errNotReachable);
dlgAlert.setTitle(R.string.errNotReachableTitle);
......@@ -409,6 +414,7 @@ public class ServerControl extends AppCompatActivity {
dlgAlert.setPositiveButton(R.string.ok,(DialogInterface dialog, int which) -> finish());
dlgAlert.create().show();
} else if (result == "failedJSON") {
timer.cancel();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(ServerControl.this);
dlgAlert.setMessage(R.string.errInvalidJson);
dlgAlert.setTitle(R.string.errInvalidJsonTitle);
......@@ -449,8 +455,6 @@ public class ServerControl extends AppCompatActivity {
networkOutGraphSeries = new LineGraphSeries<>();
networkOutGraphSeries.setColor(Color.RED);
hddReadGraphSeries.setColor(Color.RED);
System.out.println("update Data");
});
spinnerID = graphSpinner.getSelectedItemPosition();
......@@ -515,7 +519,6 @@ public class ServerControl extends AppCompatActivity {
}
url = new URL(urlString + "api2/json/nodes/" + node + "/" + type + "/" + id + "/rrddata?timeframe=" + timeframe + "&cf=AVERAGE");
System.out.println(url.toString());
conn2 = (HttpsURLConnection) url.openConnection();
conn2.setSSLSocketFactory(HelperFunctions.context.getSocketFactory());
conn2.setHostnameVerifier(HelperFunctions.hostnameVerifier);
......@@ -549,6 +552,9 @@ public class ServerControl extends AppCompatActivity {
} catch (JSONException e){
e.printStackTrace();
return "failedJSON";
} catch (NullPointerException e){
e.printStackTrace();
return "nullPointer";
}
return "";
......@@ -563,20 +569,30 @@ public class ServerControl extends AppCompatActivity {
showLoading = false;
}
if (result == "failedIO") {
timer.cancel();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(ServerControl.this);
dlgAlert.setMessage(R.string.errNotReachable);
dlgAlert.setTitle(R.string.errNotReachableTitle);
dlgAlert.setCancelable(false);
dlgAlert.setPositiveButton(R.string.ok,(DialogInterface dialog, int which) -> finish());
dlgAlert.create().show();
} else if (result == "nullPointer") {
timer.cancel();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(ServerControl.this);
dlgAlert.setMessage(R.string.errUnknownLong);
dlgAlert.setTitle(R.string.errUnknown);
dlgAlert.setCancelable(false);
dlgAlert.setPositiveButton(R.string.ok,(DialogInterface dialog, int which) -> finish());
dlgAlert.create().show();
} else if (result == "failedJSON") {
timer.cancel();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(ServerControl.this);
dlgAlert.setMessage(R.string.errInvalidJson);
dlgAlert.setTitle(R.string.errInvalidJsonTitle);
dlgAlert.setCancelable(false);
dlgAlert.setPositiveButton(R.string.ok,(DialogInterface dialog, int which) -> finish());
dlgAlert.create().show();
}
}
try{
name = vmConfig.getString("name");
if(type.equals("lxc")){
......@@ -624,7 +640,6 @@ public class ServerControl extends AppCompatActivity {
HelperFunctions.formatGraph(hddGraph, hddWriteGraphSeries, hddReadGraphSeries);
HelperFunctions.formatGraph(networkGraph, networkInGraphSeries, networkOutGraphSeries);
System.out.println(Iterators.size(networkOutGraphSeries.getValues(0, 999999999)));
if (Iterators.size(networkOutGraphSeries.getValues(0, 999999999)) == 0){
graphLayout.setVisibility(View.GONE);
} else {
......@@ -633,6 +648,7 @@ public class ServerControl extends AppCompatActivity {
} catch (JSONException e){
timer.cancel();
e.printStackTrace();
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(ServerControl.this);
dlgAlert.setMessage(R.string.errInvalidJson);
......
......@@ -56,6 +56,7 @@ public class StorageControl extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(loginActivity.theme == 3) setTheme(R.style.Theme_App_black);
setContentView(R.layout.activity_storage_control);
Toolbar toolbar = findViewById(R.id.toolbar);
nameText = findViewById(R.id.labelName);
......
......@@ -25,6 +25,7 @@ import javax.crypto.spec.SecretKeySpec;
public class loginActivity extends AppCompatActivity implements IAuthenticateListener {
public static SecretKey decryptToken;
public static int theme = 0;
private SharedPreferences mPreferences;
private FingerprintHandler mFingerprintHandler;
SharedPreferences.Editor editor;
......@@ -32,18 +33,22 @@ public class loginActivity extends AppCompatActivity implements IAuthenticateLis
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
mPreferences = PreferenceManager.getDefaultSharedPreferences(loginActivity.this);
switch (Integer.parseInt(mPreferences.getString("darkmode", "0"))){ //if overwritten enable or disable darkmode
theme = Integer.parseInt(mPreferences.getString("darkmode", "0"));
switch (theme){ //if overwritten enable or disable darkmode
case 1:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
break;
case 2:
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
break;
case 3:
setTheme(R.style.Theme_App_black);
}
setContentView(R.layout.activity_login);
editor = mPreferences.edit();
if(mPreferences.getBoolean("firstrun", true)){
......
......@@ -35,6 +35,7 @@ public class settings extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(loginActivity.theme == 3) setTheme(R.style.Theme_App_black);
setContentView(R.layout.settings_activity);
getSupportFragmentManager()
.beginTransaction()
......
Neue Features:
* Inhalt von Speicher wird nun aufgelistet
* Option um eigene Aktionen bei fehlgeschlagener Verbindung auszuführen
* SWAP verwendung wird bei node / Container angezeigt
* KSM Sharing wird bei nodes angezeigt
Bugfix:
* Container Sortieralgorythmus wurde berichtigt
* Konsole funktioniert wieder (nun auch auf älteren Geräten)
\ No newline at end of file
* Schwarzes Design wurde hinzugefügt
\ No newline at end of file
......@@ -70,15 +70,10 @@
</string-array>
<string name="beta">Helfen</string>
<string name="appSettings">App Einstellungen</string>
<string name="listTextSize">Text größe Liste</string>
<string name="listTextSize">Textgröße Liste</string>
<string name="useXterm">Für Container Konsole xterm.js anstatt novnc verwenden</string>
<string name="darkmode">Dunkles Design</string>
<string name="darkmode">App Design</string>
<string name="appRestartRequired">Ein neustart der App wird zum Anwenden der Änderungen benötigt.</string>
<string-array name="listDarkMode">
<item>Automatisch</item>
<item>Aktiviert</item>
<item>Deaktiviert</item>
</string-array>
<string name="sortOrder">Sortierreihenfolge in der VM Liste</string>
<string-array name="sortOrder">
<item>ID</item>
......@@ -129,4 +124,10 @@
<string name="advancedSettings">Erweiterte Einstellungen</string>
<string name="showAdvancedSettings">Erweiterte Einstellungen zeigen</string>
<string name="ksmSharing">KSM Sharing</string>
<string name="errUnknownLong">Ein unbekannter Fehler ist aufgetreten, dies sollte nicht passieren.</string>
<string name="errUnknown">Unbekannter Fehler</string>
<string name="light">Hell</string>
<string name="black">Schwarz</string>
<string name="dark">Dunkel</string>
<string name="automatic">Automatisch</string>
</resources>
\ No newline at end of file
......@@ -52,7 +52,7 @@
<string name="utilization">Serveranvändning</string>
<string name="restart">Starta om</string>
<string name="appSettings">Appinställningar</string>
<string name="listTextSize">listors textstorlek</string>
<string name="listTextSize">Listors textstorlek</string>
<string name="darkmode">Mörkt läge</string>
<string name="beta">Medverkande</string>
<string name="appRestartRequired">Appen måste startas om för att ändringar ska gälla.</string>
......@@ -93,7 +93,7 @@
<string name="pref_disable_acra">Skicka kraschrapporten automatiskt till utvecklarna.</string>
<string name="joinBetaLong">Om du går med i betatestning så kan du hjälpa mig att utveckla appen och få de nyaste funktionerna föra alla andra.</string>
<string name="errAppCrashed">Ursäkta, appen kraschade. En rapport kommer att skickas till utvecklarna.</string>
<string name="sortOrder">ordning för att sortera VMs i lista</string>
<string name="sortOrder">Ordning för att sortera VMs i lista</string>
<string name="days">dagar</string>
<string name="uptime">Drifttid</string>
<string name="translators">Översättare</string>
......@@ -106,4 +106,6 @@
<string name="extra">Extra</string>
<string name="extraDescription">Lägg till ett extra element per linje i följande format: NAMN:VÄRDE retur Text, eller true/false för booleska värden.</string>
<string name="testIntent">Testa avsikt</string>
<string name="errUnknownLong">Okänt fel uppstod, detta ska ej hända.</string>
<string name="errUnknown">Okänt fel uppstod</string>
</resources>
\ No newline at end of file
......@@ -72,23 +72,30 @@
<item>Settings</item>
</string-array>
<string name="appSettings">App Settings</string>
<string name="listTextSize">text size list</string>
<string name="darkmode">Dark design</string>
<string name="listTextSize">Lists text size</string>
<string name="darkmode">App Theme</string>
<string name="appRestartRequired">A restart of the app is required for this setting to take effect.</string>
<string name="automatic">Automatic</string>
<string name="dark">Dark</string>
<string name="black">Black</string>
<string name="light">Light</string>
<string-array name="listDarkMode">
<item>automatic</item>
<item>enabled</item>
<item>disabled</item>
<item>@string/automatic</item>
<item>@string/dark</item>
<item>@string/black</item>
<item>@string/light</item>
</string-array>
<string-array name="listDarkModeValues" translatable="false">
<item>0</item>
<item>1</item>
<item>3</item>
<item>2</item>
</string-array>
<string name="sortOrder">order to sort VMs in list</string>
<string name="sortOrder">Order to sort VMs in list</string>
<string-array name="sortOrder">
<item>ID</item>
<item>name</item>
<item>@string/id</item>
<item>@string/name</item>
</string-array>
<string-array name="sortOrderValues" translatable="false">
<item>0</item>
......@@ -124,6 +131,8 @@
<string name="errRunAgain">Please run this Action again to use newly trusted Certificate.</string>
<string name="errRunAgainTitle">Please run again</string>
<string name="errNoRealm">Please select a realm</string>
<string name="errUnknown">Unknown error occurred</string>
<string name="errUnknownLong">A unknown error occurred, this should not happen.</string>
<string name="errAppCrashed">Sorry, the application crashed. A report will be sent to the developers.</string>
<string name="crashreport">Crashreport</string>
<string name="pref_disable_acra">Send Crashreports automatically to the developers.</string>
......
......@@ -28,5 +28,4 @@
<style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar">
<item name="android:background">@color/black_overlay</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.App.black"
parent="AppTheme.NoActionBar">
<item name="android:colorBackground">#000</item>
</style>
</resources>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment