Commit bc467000 authored by jonasled's avatar jonasled

Merge branch 'develop'

parents aeff35e4 413c4210
......@@ -43,25 +43,25 @@ public class ConsoleView extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_console_view);
browser = findViewById(R.id.browser);
ticket = getIntent().getStringExtra("ticket");
browser = findViewById(R.id.browser);//search the browser in layout
ticket = getIntent().getStringExtra("ticket");//get the data, give on start of this activity
url = getIntent().getStringExtra("url");
CSRFPreventionToken = getIntent().getStringExtra("CSRFPreventionToken");
SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(ConsoleView.this);
SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(ConsoleView.this); //get the settings
//fullscreen the view
getSupportActionBar().hide();
if(mPreferences.getBoolean("consoleFullscreen", true)){
if(mPreferences.getBoolean("consoleFullscreen", true)){//hide the status bar, if enabled in settings
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
}
CookieManager.getInstance().setCookie(getIntent().getStringExtra("baseurl"), "PVEAuthCookie=" + ticket);
CookieManager.getInstance().setCookie(getIntent().getStringExtra("baseurl"), "PVEAuthCookie=" + ticket);//set the auth cookie
browser.setWebViewClient(new customWebViewClient());
browser.setWebViewClient(new customWebViewClient());//setup the WebView
WebChromeClientCustom mWebChromeClient = new WebChromeClientCustom();
browser.setWebChromeClient(mWebChromeClient);
browser.getSettings().setJavaScriptEnabled(true);
browser.getSettings().setJavaScriptEnabled(true);//enable some settings in chrome WebView
browser.getSettings().setDomStorageEnabled(true);
browser.getSettings().setUseWideViewPort(true);
browser.getSettings().setLoadWithOverviewMode(true);
......@@ -100,14 +100,16 @@ public class ConsoleView extends AppCompatActivity {
@Override
public void onPageFinished(WebView view, String url){
SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(ConsoleView.this);//get the settings module
if(getIntent().getStringExtra("baseurl").contains("xterm")){//check if we have a xterm console, if yes inject custom font size via javascript
if(url.contains("xterm")){//check if we have a xterm console, if yes inject custom font size via javascript
view.loadUrl("javascript: (function() {term.setOption('fontSize', " + mPreferences.getString("xtermSize", "15") + ");})()");
} else if(url.contains("novnc")){//check if console is novnc
view.loadUrl("javascript: (function() {document.getElementById(\"noVNC_fullscreen_button\").click();})()");//press the fullscreen button in the menue on the right
}
}
}
private class WebChromeClientCustom extends WebChromeClient {
private class WebChromeClientCustom extends WebChromeClient { //taken from https://medium.com/@oliverdamjan2013/fullscreen-youtube-video-in-webview-android-21f1c778cf56 (we need this to get fullscreen working)
private View mCustomView;
private WebChromeClient.CustomViewCallback mCustomViewCallback;
private int mOriginalOrientation;
......
......@@ -98,7 +98,7 @@
<string name="fingerprint">Daten mit Fingerabdruck schützen</string>
<string name="fingerprintLong">Wenn du diese Einstellung aktivierst werden deine Daten verschlüsselt und du musst bei jedem Start deinen Finger scannen um sie zu entschlüsseln.</string>
<string name="version">Version</string>
<string name="consoleFullScreen">Konsole im Vollbildmodus abzeigen</string>
<string name="consoleFullScreen">Konsole im Vollbildmodus anzeigen</string>
<string name="consoleFullScreenLong">Auf manchen Geräten mit runden Ecken kann es helfen diese Option zu deaktivieren, um die komplette Konsole zu sehen.</string>
<string name="xtermFontSize">Schriftgröße für xterm.js</string>
<string name="xtermFontSizeLong">Falls du xterm.js verwendest und dir die Schriftgröße zu klein / groß ist, kannst du sie hier ändern.</string>
......
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