Skip to content

Commit

Permalink
v1.0.7: Auto-enable 'insecure TLS' if server address is an ip-addr
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrvarz committed Jun 24, 2022
1 parent d8c3f0d commit 485b28f
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 29 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "timur.webcall.callee"
minSdkVersion 21
targetSdkVersion 31
versionCode 97
versionName "1.0.6F"
versionCode 98
versionName "1.0.7F"
}
buildTypes {
release {
Expand Down
14 changes: 14 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/98.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
v1.0.7

Auto-enable "insecure TLS" if server address is an ip-addr.

v1.0.6

No speakermode by proximity sensor if headset is connected.

Now permiting clipboard paste on password form field.

Serializing concurrent network-change events.

Added missing "Online. Waiting for calls." notification msg.

35 changes: 17 additions & 18 deletions src/main/assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ <h1 id="title">WebCall Android</h1>
<form action="javascript:;" onsubmit="submitFormDone(this)" style="margin-top:20px;" id="formFrame">
<label for="domain">Server address:</label>
<br>
<input autocomplete="domain" id="domain" type="text" class="formtext" autofocus required>
<input autocomplete="domain" id="domain" type="text" class="formtext" onblur="domainAction()" autofocus required>
<span onclick="clearForm(0)" style="margin-left:5px; user-select:none; cursor:pointer;">X</span>

<br>
Expand All @@ -230,29 +230,28 @@ <h1 id="title">WebCall Android</h1>
<br>
<div style="font-size:0.85em; margin-top:3px;">(empty field will request a new ID)</div>


<br>
<input type="submit" name="Submit" id="submit" value="Start"
style="width:120px; margin-top:40px; margin-bottom:50px;">
style="width:120px; margin-top:40px; margin-bottom:30px;">


<br>
<div style="font-size:1.1em">
<label id="clearCookiesLabel" style="margin-top:16px; user-select:none;">
<input type="checkbox" id="clearCookies" class="checkbox"> Clear password cookie</label>
</label>
<label id="clearCookiesLabel" style="margin-top:14px; user-select:none;">
<input type="checkbox" id="clearCookies" class="checkbox"> Clear password cookie</label>
</label>

<br>
<label id="clearCacheLabel" style="margin-top:16px; user-select:none;">
<input type="checkbox" id="clearCache" class="checkbox"> Clear cache</label>
</label>
<br>
<label id="clearCacheLabel" style="margin-top:14px; user-select:none;">
<input type="checkbox" id="clearCache" class="checkbox"> Clear cache</label>
</label>

<br>
<label id="insecureTlsLabel" style="margin-top:16px; user-select:none;">
<input type="checkbox" id="insecureTls" class="checkbox"> Allow insecure TLS</label>
</label>
<br>
<label id="insecureTlsLabel" style="margin-top:14px; user-select:none;">
<input type="checkbox" id="insecureTls" class="checkbox"> Allow insecure TLS</label>
</label>
</div>

<br>
<table style="font-size:0.8em; margin-top:55px; line-height:1.2em; opacity:0.9;">

<table style="font-size:0.8em; margin-top:40px; line-height:1.2em; opacity:0.9;">
<tr>
<td>WebCall:</td>
<td><span id="webcallversion"></span></td>
Expand Down
45 changes: 36 additions & 9 deletions src/main/assets/webcall.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var username = "";
var versionName = "";

window.onload = function() {
if(typeof Android !== "undefined" && Android !== null) {
// if(typeof Android !== "undefined" && Android !== null) {
domain = Android.readPreference("webcalldomain");
username = Android.readPreference("username");
if(username=="register") {
Expand Down Expand Up @@ -87,7 +87,8 @@ window.onload = function() {
webviewVersion = webviewVersion + " TOO OLD!";
}
document.getElementById("webviewversion").innerHTML = webviewVersion;
}
// }

if(domain=="") {
domain = "timur.mobi";
} else if(domain==" ") {
Expand All @@ -99,15 +100,11 @@ window.onload = function() {
formUsername.value = username;

insecureTls.addEventListener('change', function() {
if(this.checked) {
console.log("insecureTls checked");
insecureTlsLabel.style.color = "#f44";
} else {
console.log("insecureTls unchecked");
insecureTlsLabel.style.color = "";
}
insecureTlsAction();
});

domainAction();

// remove focus from any of the elements (to prevent accidental modification)
setTimeout(function() {
document.activeElement.blur();
Expand All @@ -126,6 +123,36 @@ function clearForm(idx) {
}
}

function domainAction() {
let valueDomain = formDomain.value;
let valueDomainWithoutPort = valueDomain;
let portIdx = valueDomainWithoutPort.indexOf(":");
if(portIdx>=0) {
valueDomainWithoutPort = valueDomainWithoutPort.substring(0,portIdx);
}
// https://stackoverflow.com/questions/4460586/javascript-regular-expression-to-check-for-ip-addresses
if(valueDomainWithoutPort.split(".").map(ip => Number(ip) >= 0 && Number(ip) <= 255).includes(false)) {
// not a valid ip-address
console.log("domainAction: not a valid ip-address "+valueDomainWithoutPort);
insecureTls.checked = false;
} else {
// a valid ip-address
console.log("domainAction: is a valid ip-address "+valueDomainWithoutPort);
insecureTls.checked = true;
}
insecureTlsAction();
}

function insecureTlsAction() {
if(insecureTls.checked) {
console.log("insecureTls checked");
insecureTlsLabel.style.color = "#f44";
} else {
console.log("insecureTls unchecked");
insecureTlsLabel.style.color = "";
}
}

function submitFormDone(theForm) {
var valueDomain = formDomain.value;
console.log('valueDomain',valueDomain);
Expand Down

0 comments on commit 485b28f

Please sign in to comment.