Minor code formatting adjustments
This commit is contained in:
parent
fe3b9e1637
commit
e23ad3b0d5
266
www/js/app.js
266
www/js/app.js
@ -4,28 +4,30 @@
|
||||
|
||||
userinfo = null;
|
||||
|
||||
document.addEventListener("deviceready", function () {
|
||||
if (cordova.platformId == 'android') {
|
||||
StatusBar.backgroundColorByHexString("#1976d2");
|
||||
}
|
||||
|
||||
// Enable/disable jQuery animations depending on user preference
|
||||
$.fx.off = !(localStorage.getItem("animations") === null || localStorage.getItem("animations") === "true");
|
||||
|
||||
/* Fade out alerts */
|
||||
$(".alert .close").click(function (e) {
|
||||
$(this).parent().fadeOut("slow");
|
||||
});
|
||||
|
||||
if (localStorage.getItem("setupcomplete")) {
|
||||
getuserinfo(function () {
|
||||
openscreen("home");
|
||||
});
|
||||
/**
|
||||
* Switches the app to the given screen.
|
||||
* @param {String} screenname The name of the screen to show.
|
||||
* @param {String} effect FADE, SLIDE, or nothing
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function openscreen(screenname, effect) {
|
||||
if (effect === 'FADE') {
|
||||
$('#content-zone').fadeOut(300, function () {
|
||||
$('#content-zone').load("views/" + screenname + ".html", function () {
|
||||
$('#content-zone').fadeIn(300);
|
||||
});
|
||||
});
|
||||
} else if (effect === 'SLIDE') {
|
||||
$('#content-zone').slideToggle('400', function () {
|
||||
$('#content-zone').load("views/" + screenname + ".html", function () {
|
||||
$('#content-zone').slideToggle('400');
|
||||
});
|
||||
});
|
||||
} else {
|
||||
openscreen("setup1");
|
||||
$('#content-zone').load("views/" + screenname + ".html");
|
||||
}
|
||||
setTimeout(navigator.splashscreen.hide, 1000);
|
||||
}, false);
|
||||
currentscreen = screenname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch user info (name, email, etc) from the server and save to the global
|
||||
@ -36,67 +38,42 @@ document.addEventListener("deviceready", function () {
|
||||
function getuserinfo(callback) {
|
||||
$(".loading-text").text("Loading account...");
|
||||
$.post(localStorage.getItem("syncurl"), {
|
||||
username: localStorage.getItem("username"),
|
||||
key: localStorage.getItem("key"),
|
||||
password: localStorage.getItem("password"),
|
||||
action: "user_info"
|
||||
username: localStorage.getItem("username"),
|
||||
key: localStorage.getItem("key"),
|
||||
password: localStorage.getItem("password"),
|
||||
action: "user_info"
|
||||
}, function (data) {
|
||||
if (data.status === 'OK') {
|
||||
$(".loading-text").text("Loading...");
|
||||
userinfo = data.info;
|
||||
if (typeof callback == 'function') {
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
navigator.notification.alert(data.msg, null, "Error", 'Dismiss');
|
||||
openscreen("homeloaderror");
|
||||
}
|
||||
if (data.status === 'OK') {
|
||||
$(".loading-text").text("Loading...");
|
||||
userinfo = data.info;
|
||||
if (typeof callback == 'function') {
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
navigator.notification.alert(data.msg, null, "Error", 'Dismiss');
|
||||
openscreen("homeloaderror");
|
||||
}
|
||||
}, "json").fail(function () {
|
||||
navigator.notification.alert("Could not connect to the server. Try again later.", null, "Error", 'Dismiss');
|
||||
openscreen("homeloaderror");
|
||||
navigator.notification.alert("Could not connect to the server. Try again later.", null, "Error", 'Dismiss');
|
||||
openscreen("homeloaderror");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches the app to the given screen.
|
||||
* @param {String} screenname The name of the screen to show.
|
||||
* @param {String} effect FADE, SLIDE, or nothing
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function openscreen(screenname, effect) {
|
||||
if (effect === 'FADE') {
|
||||
$('#content-zone').fadeOut(300, function () {
|
||||
$('#content-zone').load("views/" + screenname + ".html", function () {
|
||||
$('#content-zone').fadeIn(300);
|
||||
});
|
||||
});
|
||||
} else if (effect === 'SLIDE') {
|
||||
$('#content-zone').slideToggle('400', function () {
|
||||
$('#content-zone').load("views/" + screenname + ".html", function () {
|
||||
$('#content-zone').slideToggle('400');
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$('#content-zone').load("views/" + screenname + ".html");
|
||||
}
|
||||
currentscreen = screenname;
|
||||
}
|
||||
|
||||
function openfragment(fragment, target, effect) {
|
||||
if (effect === 'FADE') {
|
||||
$(target).fadeOut('slow', function () {
|
||||
$(target).load("views/" + fragment + ".html", function () {
|
||||
$(target).fadeIn('slow');
|
||||
});
|
||||
});
|
||||
$(target).fadeOut('slow', function () {
|
||||
$(target).load("views/" + fragment + ".html", function () {
|
||||
$(target).fadeIn('slow');
|
||||
});
|
||||
});
|
||||
} else if (effect === 'SLIDE') {
|
||||
$(target).slideToggle('400', function () {
|
||||
$(target).load("views/" + fragment + ".html", function () {
|
||||
$(target).slideToggle('400');
|
||||
});
|
||||
});
|
||||
$(target).slideToggle('400', function () {
|
||||
$(target).load("views/" + fragment + ".html", function () {
|
||||
$(target).slideToggle('400');
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$(target).load("views/" + fragment + ".html");
|
||||
$(target).load("views/" + fragment + ".html");
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,45 +89,45 @@ function openfragment(fragment, target, effect) {
|
||||
function setnavbar(type, title, returnscreen) {
|
||||
var navbar = $('#navbar-header');
|
||||
if (type == false) {
|
||||
$('#navbar').css('display', 'none');
|
||||
$('#content-zone').css('margin-top', '0px');
|
||||
$('#navbar').css('display', 'none');
|
||||
$('#content-zone').css('margin-top', '0px');
|
||||
} else {
|
||||
if (cordova.platformId == 'android') {
|
||||
StatusBar.backgroundColorByHexString("#1976d2");
|
||||
window.plugins.headerColor.tint("#2196f3");
|
||||
} else {
|
||||
StatusBar.backgroundColorByHexString("#2196f3");
|
||||
}
|
||||
$('#navbar').css('display', 'initial');
|
||||
$('#content-zone').css('margin-top', '75px');
|
||||
if (returnscreen === undefined) {
|
||||
returnscreen = "home";
|
||||
_returnscreen = null;
|
||||
} else {
|
||||
_returnscreen = returnscreen;
|
||||
}
|
||||
navbar.fadeOut(150, function () {
|
||||
switch (type) {
|
||||
case "home":
|
||||
navbar.html('<span class="navbar-brand" style="color: white;">Business</span><span class="navbar-brand pull-right"><span onclick="openscreen(\'mobilecode\', \'FADE\')"><img src="icons/ic_lock.svg" alt="" /></span> <span onclick="openscreen(\'otp\', \'FADE\')"><img src="icons/ic_vpn_key.svg" alt="" /></span> <span onclick="openscreen(\'settings\', \'FADE\')"><img src="icons/ic_settings.svg" alt="" /></span></span>');
|
||||
break;
|
||||
case "setup":
|
||||
navbar.html('<span class="navbar-brand" style="color: white;">Business</span><span class="navbar-brand pull-right"><span onclick="openscreen(\'otp\', \'FADE\')"><img src="icons/ic_vpn_key.svg" alt="" /></span> <span onclick="openscreen(\'settings\', \'FADE\')"><img src="icons/ic_settings.svg" alt="" /></span></span>');
|
||||
break;
|
||||
case "settings":
|
||||
navbar.html('<span class="navbar-brand pull-left" style="color: white;" onclick="openscreen(\'home\', \'FADE\')"><img src="icons/ic_arrow-back.svg" /></span><span class="navbar-brand navbar-title" style="color: white;" onclick="openscreen(\'home\', \'FADE\')">Settings</span>');
|
||||
break;
|
||||
case "otp":
|
||||
navbar.html('<span class="navbar-brand pull-left" style="color: white;" onclick="openscreen(\'home\', \'FADE\')"><img src="icons/ic_arrow-back.svg" /></span><span class="navbar-brand navbar-title" style="color: white;" onclick="openscreen(\'home\', \'FADE\')">Auth Keys</span><span class="navbar-brand pull-right" onclick="openscreen(\'addotp\', \'FADE\')"><img src="icons/ic_add.svg" alt="" /></span>');
|
||||
break;
|
||||
case "app":
|
||||
navbar.html('<span class="navbar-brand pull-left" style="color: white;" onclick="openscreen(\'' + returnscreen + '\', \'FADE\')"><img src="icons/ic_arrow-back.svg" /></span><span class="navbar-brand navbar-title" style="color: white;" onclick="openscreen(\'' + returnscreen + '\', \'FADE\')">' + title + '</span>');
|
||||
break;
|
||||
default:
|
||||
navbar.html('<span class="navbar-brand" style="color: white;">Business</span>');
|
||||
}
|
||||
navbar.fadeIn(150);
|
||||
});
|
||||
if (cordova.platformId == 'android') {
|
||||
StatusBar.backgroundColorByHexString("#1976d2");
|
||||
window.plugins.headerColor.tint("#2196f3");
|
||||
} else {
|
||||
StatusBar.backgroundColorByHexString("#2196f3");
|
||||
}
|
||||
$('#navbar').css('display', 'initial');
|
||||
$('#content-zone').css('margin-top', '75px');
|
||||
if (returnscreen === undefined) {
|
||||
returnscreen = "home";
|
||||
_returnscreen = null;
|
||||
} else {
|
||||
_returnscreen = returnscreen;
|
||||
}
|
||||
navbar.fadeOut(150, function () {
|
||||
switch (type) {
|
||||
case "home":
|
||||
navbar.html('<span class="navbar-brand" style="color: white;">Business</span><span class="navbar-brand pull-right"><span onclick="openscreen(\'mobilecode\', \'FADE\')"><img src="icons/ic_lock.svg" alt="" /></span> <span onclick="openscreen(\'otp\', \'FADE\')"><img src="icons/ic_vpn_key.svg" alt="" /></span> <span onclick="openscreen(\'settings\', \'FADE\')"><img src="icons/ic_settings.svg" alt="" /></span></span>');
|
||||
break;
|
||||
case "setup":
|
||||
navbar.html('<span class="navbar-brand" style="color: white;">Business</span><span class="navbar-brand pull-right"><span onclick="openscreen(\'otp\', \'FADE\')"><img src="icons/ic_vpn_key.svg" alt="" /></span> <span onclick="openscreen(\'settings\', \'FADE\')"><img src="icons/ic_settings.svg" alt="" /></span></span>');
|
||||
break;
|
||||
case "settings":
|
||||
navbar.html('<span class="navbar-brand pull-left" style="color: white;" onclick="openscreen(\'home\', \'FADE\')"><img src="icons/ic_arrow-back.svg" /></span><span class="navbar-brand navbar-title" style="color: white;" onclick="openscreen(\'home\', \'FADE\')">Settings</span>');
|
||||
break;
|
||||
case "otp":
|
||||
navbar.html('<span class="navbar-brand pull-left" style="color: white;" onclick="openscreen(\'home\', \'FADE\')"><img src="icons/ic_arrow-back.svg" /></span><span class="navbar-brand navbar-title" style="color: white;" onclick="openscreen(\'home\', \'FADE\')">Auth Keys</span><span class="navbar-brand pull-right" onclick="openscreen(\'addotp\', \'FADE\')"><img src="icons/ic_add.svg" alt="" /></span>');
|
||||
break;
|
||||
case "app":
|
||||
navbar.html('<span class="navbar-brand pull-left" style="color: white;" onclick="openscreen(\'' + returnscreen + '\', \'FADE\')"><img src="icons/ic_arrow-back.svg" /></span><span class="navbar-brand navbar-title" style="color: white;" onclick="openscreen(\'' + returnscreen + '\', \'FADE\')">' + title + '</span>');
|
||||
break;
|
||||
default:
|
||||
navbar.html('<span class="navbar-brand" style="color: white;">Business</span>');
|
||||
}
|
||||
navbar.fadeIn(150);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,11 +144,11 @@ function setnavbar(type, title, returnscreen) {
|
||||
*/
|
||||
function openapp(id, api, url, icon, title, injectcode, shownavbar) {
|
||||
$('#content-zone').fadeOut(300, function () {
|
||||
$('#content-zone').load("views/app.html", function () {
|
||||
$('#content-zone').fadeIn(300, function () {
|
||||
launchapp(id, api, url, icon, title, injectcode, shownavbar);
|
||||
});
|
||||
});
|
||||
$('#content-zone').load("views/app.html", function () {
|
||||
$('#content-zone').fadeIn(300, function () {
|
||||
launchapp(id, api, url, icon, title, injectcode, shownavbar);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -183,8 +160,8 @@ function openapp(id, api, url, icon, title, injectcode, shownavbar) {
|
||||
*/
|
||||
function openmodal(filename, modalselector) {
|
||||
$('#modal-load-box').load("views/" + filename + ".html", null, function (x) {
|
||||
$(modalselector).css('z-index', 9999999);
|
||||
$(modalselector).modal('show');
|
||||
$(modalselector).css('z-index', 9999999);
|
||||
$(modalselector).modal('show');
|
||||
});
|
||||
}
|
||||
|
||||
@ -201,28 +178,51 @@ function restartApplication() {
|
||||
navigator.splashscreen.show();
|
||||
// We're doing the timeout so we don't run afoul of server-side rate limiting
|
||||
setTimeout(function () {
|
||||
window.location = "index.html";
|
||||
window.location = "index.html";
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
// Handle back button to close things
|
||||
document.addEventListener("backbutton", function (event) {
|
||||
if (localStorage.getItem("setupcomplete")) {
|
||||
if ($("#appframe").length && historyctr > 0) {
|
||||
console.log("going back");
|
||||
var iframe = document.getElementById("appframe");
|
||||
iframe.contentWindow.postMessage("goback", "*");
|
||||
historyctr--;
|
||||
} else if (_returnscreen != null) {
|
||||
openscreen(_returnscreen, "FADE");
|
||||
_returnscreen = null;
|
||||
} else {
|
||||
openscreen("home", "FADE");
|
||||
}
|
||||
if ($("#appframe").length && historyctr > 0) {
|
||||
console.log("going back");
|
||||
var iframe = document.getElementById("appframe");
|
||||
iframe.contentWindow.postMessage("goback", "*");
|
||||
historyctr--;
|
||||
} else if (_returnscreen != null) {
|
||||
openscreen(_returnscreen, "FADE");
|
||||
_returnscreen = null;
|
||||
} else {
|
||||
openscreen("home", "FADE");
|
||||
}
|
||||
} else {
|
||||
if (_returnscreen != null) {
|
||||
openscreen(_returnscreen, "FADE");
|
||||
_returnscreen = null;
|
||||
}
|
||||
if (_returnscreen != null) {
|
||||
openscreen(_returnscreen, "FADE");
|
||||
_returnscreen = null;
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("deviceready", function () {
|
||||
if (cordova.platformId == 'android') {
|
||||
StatusBar.backgroundColorByHexString("#1976d2");
|
||||
}
|
||||
|
||||
// Enable/disable jQuery animations depending on user preference
|
||||
$.fx.off = !(localStorage.getItem("animations") === null || localStorage.getItem("animations") === "true");
|
||||
|
||||
/* Fade out alerts */
|
||||
$(".alert .close").click(function (e) {
|
||||
$(this).parent().fadeOut("slow");
|
||||
});
|
||||
|
||||
if (localStorage.getItem("setupcomplete")) {
|
||||
getuserinfo(function () {
|
||||
openscreen("home");
|
||||
});
|
||||
} else {
|
||||
openscreen("setup1");
|
||||
}
|
||||
setTimeout(navigator.splashscreen.hide, 1000);
|
||||
}, false);
|
@ -9,12 +9,12 @@
|
||||
// This code from
|
||||
// https://stackoverflow.com/a/6177502
|
||||
$.cssHooks.backgroundColor = {
|
||||
get: function(elem) {
|
||||
get: function (elem) {
|
||||
if (elem.currentStyle)
|
||||
var bg = elem.currentStyle["backgroundColor"];
|
||||
else if (window.getComputedStyle)
|
||||
var bg = document.defaultView.getComputedStyle(elem,
|
||||
null).getPropertyValue("background-color");
|
||||
null).getPropertyValue("background-color");
|
||||
if (bg.search("rgb") == -1)
|
||||
return bg;
|
||||
else {
|
||||
@ -60,11 +60,11 @@ $(document).ready(function () {
|
||||
var logo = "__LOGO__";
|
||||
$('body').append("<div id='swipe-nav'><div id='swipe-header' style='background-color: " + menucolor + "; color: " + textcolor + "'><a href='./app.php'><img id='swipe-appicon' src='" + logo + "' /></a> <div id='swipe-username'><i class='fa fa-user fa-fw'></i> " + username + "</div></div>\n<ul id='swipe-pages'>" + pages + "</ul><ul><li><a onclick='quitapp()'><i class='fa fa-sign-out fa-fw'></i> Back to Menu</a></li></ul></div>");
|
||||
$('body').append("<div id='swipe-shader'></div>");
|
||||
|
||||
|
||||
$(".navbar-brand").attr("href", "#");
|
||||
|
||||
|
||||
parent.postMessage("setcolor " + menucolor, "*");
|
||||
|
||||
|
||||
$('button.navbar-toggle[data-toggle="collapse"]').click(togglemenu);
|
||||
|
||||
$('#swipe-shader').click(togglemenu);
|
||||
@ -77,11 +77,11 @@ $(document).ready(function () {
|
||||
openmenu();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Hammer(document.body).on("swipeleft", function (e) {
|
||||
closemenu();
|
||||
});
|
||||
|
||||
|
||||
window.addEventListener('message', function (event) {
|
||||
if (event.data.startsWith("coderesult~|~")) {
|
||||
var data = event.data.split("~|~");
|
||||
@ -92,12 +92,12 @@ $(document).ready(function () {
|
||||
$(ref).trigger("change");
|
||||
console.log("app: received " + event.data);
|
||||
} else if (event.data.startsWith("goback")) {
|
||||
console.log("app: received " + event.data);
|
||||
window.history.back();
|
||||
parent.postMessage('goneback','*');
|
||||
}
|
||||
console.log("app: received " + event.data);
|
||||
window.history.back();
|
||||
parent.postMessage('goneback', '*');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
setInterval(function () {
|
||||
$.getJSON("mobile/index.php", {action: "ping"}, function (d) {
|
||||
console.log("app: keepalive ping " + d.status);
|
||||
@ -106,7 +106,7 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
function quitapp() {
|
||||
parent.postMessage('quit','*');
|
||||
parent.postMessage('quit', '*');
|
||||
}
|
||||
|
||||
function scancode(refstring) {
|
||||
|
@ -25,124 +25,124 @@
|
||||
|
||||
<script>
|
||||
$("#key").on("keyup", function () {
|
||||
if (window.getSelection().toString() !== '') {
|
||||
return;
|
||||
}
|
||||
var text = $('#key').val().replace(/\s+/g, '');
|
||||
var formatted = "";
|
||||
for (var i = 1; i <= text.length; i++) {
|
||||
formatted = formatted + text[i - 1];
|
||||
if (i % 4 == 0 && i > 1 && i < text.length) {
|
||||
// add a space every 5 characters,
|
||||
// unless it's the first character
|
||||
// or the last character
|
||||
formatted = formatted + " ";
|
||||
}
|
||||
}
|
||||
$('#key').val(formatted.toUpperCase());
|
||||
if (window.getSelection().toString() !== '') {
|
||||
return;
|
||||
}
|
||||
var text = $('#key').val().replace(/\s+/g, '');
|
||||
var formatted = "";
|
||||
for (var i = 1; i <= text.length; i++) {
|
||||
formatted = formatted + text[i - 1];
|
||||
if (i % 4 == 0 && i > 1 && i < text.length) {
|
||||
// add a space every 5 characters,
|
||||
// unless it's the first character
|
||||
// or the last character
|
||||
formatted = formatted + " ";
|
||||
}
|
||||
}
|
||||
$('#key').val(formatted.toUpperCase());
|
||||
});
|
||||
|
||||
function manualadd() {
|
||||
var key = $('#key').val().replace(/\s+/g, '');
|
||||
var label = $('#label').val();
|
||||
var issuer = $('#issuer').val();
|
||||
addOTP(key, label, issuer);
|
||||
var key = $('#key').val().replace(/\s+/g, '');
|
||||
var label = $('#label').val();
|
||||
var issuer = $('#issuer').val();
|
||||
addOTP(key, label, issuer);
|
||||
}
|
||||
|
||||
function manualshow() {
|
||||
$('#manual_add').css('display', 'block');
|
||||
$('#manual_add').css('display', 'block');
|
||||
}
|
||||
|
||||
function addOTP(key, label, issuer) {
|
||||
if (key == "") {
|
||||
navigator.notification.alert("Missing secret key.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
if (key == "") {
|
||||
navigator.notification.alert("Missing secret key.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
key = key.toUpperCase();
|
||||
/* Thanks to https://stackoverflow.com/a/27362880 for the regex */
|
||||
if (!key.match(/^(?:[A-Z2-7]{8})*(?:[A-Z2-7]{2}={6}|[A-Z2-7]{4}={4}|[A-Z2-7]{5}={3}|[A-Z2-7]{7}=)?$/)) {
|
||||
navigator.notification.alert("Secret key is not valid base32.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if (label == "") {
|
||||
navigator.notification.alert("Missing label.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
var ls_text = localStorage.getItem("otp");
|
||||
var keys = [];
|
||||
if (ls_text != null && ls_text != "") {
|
||||
keys = JSON.parse(ls_text || "[]");
|
||||
}
|
||||
if (label == "") {
|
||||
navigator.notification.alert("Missing label.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
var ls_text = localStorage.getItem("otp");
|
||||
var keys = [];
|
||||
if (ls_text != null && ls_text != "") {
|
||||
keys = JSON.parse(ls_text || "[]");
|
||||
}
|
||||
|
||||
keys.push({"secret": key, "label": label, "issuer": issuer});
|
||||
localStorage.setItem("otp", JSON.stringify(keys));
|
||||
navigator.notification.alert("2-factor key saved.", null, "Key added", 'Dismiss');
|
||||
openscreen("otp");
|
||||
keys.push({"secret": key, "label": label, "issuer": issuer});
|
||||
localStorage.setItem("otp", JSON.stringify(keys));
|
||||
navigator.notification.alert("2-factor key saved.", null, "Key added", 'Dismiss');
|
||||
openscreen("otp");
|
||||
}
|
||||
|
||||
function scanCode() {
|
||||
try {
|
||||
cordova.plugins.barcodeScanner.scan(
|
||||
function (result) {
|
||||
if (!result.cancelled) {
|
||||
try {
|
||||
var url = decodeURI(result.text);
|
||||
} catch (e) {
|
||||
navigator.notification.alert("Could not decode OTP URI.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
if (!url.startsWith("otpauth://")) {
|
||||
navigator.notification.alert("Invalid OTP code. Try again.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
if (!url.startsWith("otpauth://totp/")) {
|
||||
navigator.notification.alert("Unsupported key type.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
var stripped = url.replace("otpauth://totp/", "");
|
||||
var params = stripped.split("?")[1].split("&");
|
||||
var label = stripped.split("?")[0];
|
||||
var secret = "";
|
||||
var issuer = "";
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
var param = params[i].split("=");
|
||||
if (param[0] == "secret") {
|
||||
secret = param[1].toUpperCase();
|
||||
} else if (param[0] == "issuer") {
|
||||
issuer = param[1];
|
||||
} else if (param[0] == "algorithm" && param[1].toLowerCase() != "sha1") {
|
||||
navigator.notification.alert("Unsupported hash algorithm.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
} else if (param[0] == "digits" && param[1] != "6") {
|
||||
navigator.notification.alert("Unsupported digit count.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
} else if (param[0] == "period" && param[1] != "30") {
|
||||
navigator.notification.alert("Unsupported period.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
}
|
||||
try {
|
||||
try {
|
||||
cordova.plugins.barcodeScanner.scan(
|
||||
function (result) {
|
||||
if (!result.cancelled) {
|
||||
try {
|
||||
var url = decodeURI(result.text);
|
||||
} catch (e) {
|
||||
navigator.notification.alert("Could not decode OTP URI.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
if (!url.startsWith("otpauth://")) {
|
||||
navigator.notification.alert("Invalid OTP code. Try again.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
if (!url.startsWith("otpauth://totp/")) {
|
||||
navigator.notification.alert("Unsupported key type.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
var stripped = url.replace("otpauth://totp/", "");
|
||||
var params = stripped.split("?")[1].split("&");
|
||||
var label = stripped.split("?")[0];
|
||||
var secret = "";
|
||||
var issuer = "";
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
var param = params[i].split("=");
|
||||
if (param[0] == "secret") {
|
||||
secret = param[1].toUpperCase();
|
||||
} else if (param[0] == "issuer") {
|
||||
issuer = param[1];
|
||||
} else if (param[0] == "algorithm" && param[1].toLowerCase() != "sha1") {
|
||||
navigator.notification.alert("Unsupported hash algorithm.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
} else if (param[0] == "digits" && param[1] != "6") {
|
||||
navigator.notification.alert("Unsupported digit count.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
} else if (param[0] == "period" && param[1] != "30") {
|
||||
navigator.notification.alert("Unsupported period.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
}
|
||||
try {
|
||||
secret = decodeURIComponent(secret);
|
||||
issuer = decodeURIComponent(issuer);
|
||||
label = decodeURIComponent(label);
|
||||
} catch (e) {
|
||||
navigator.notification.alert("Could not decode OTP URI.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
addOTP(secret, label, issuer);
|
||||
}
|
||||
},
|
||||
function (error) {
|
||||
navigator.notification.alert("Scanning failed: " + error, null, "Error", 'Dismiss');
|
||||
},
|
||||
{
|
||||
"showFlipCameraButton": false,
|
||||
"prompt": "Scan OTP QR code."
|
||||
}
|
||||
);
|
||||
} catch (ex) {
|
||||
navigator.notification.alert(ex.message, null, "Error", 'Dismiss');
|
||||
}
|
||||
issuer = decodeURIComponent(issuer);
|
||||
label = decodeURIComponent(label);
|
||||
} catch (e) {
|
||||
navigator.notification.alert("Could not decode OTP URI.", null, "Error", 'Dismiss');
|
||||
return;
|
||||
}
|
||||
addOTP(secret, label, issuer);
|
||||
}
|
||||
},
|
||||
function (error) {
|
||||
navigator.notification.alert("Scanning failed: " + error, null, "Error", 'Dismiss');
|
||||
},
|
||||
{
|
||||
"showFlipCameraButton": false,
|
||||
"prompt": "Scan OTP QR code."
|
||||
}
|
||||
);
|
||||
} catch (ex) {
|
||||
navigator.notification.alert(ex.message, null, "Error", 'Dismiss');
|
||||
}
|
||||
}
|
||||
|
||||
setnavbar("app", "Add Auth Key", "otp");
|
||||
|
@ -19,63 +19,63 @@
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function launchapp(id, api, url, icon, title, injectcode, shownavbar) {
|
||||
if (typeof shownavbar === 'undefined' || shownavbar === false) {
|
||||
setnavbar(false);
|
||||
} else {
|
||||
setnavbar("app", title);
|
||||
$('#appframe').css('top', '75px');
|
||||
}
|
||||
$.post(url + api, {
|
||||
username: localStorage.getItem("username"),
|
||||
key: localStorage.getItem("key"),
|
||||
password: localStorage.getItem("password"),
|
||||
action: "start_session"
|
||||
}, function (data) {
|
||||
if (data.status === 'OK') {
|
||||
if (typeof shownavbar === 'undefined' || shownavbar === false) {
|
||||
setnavbar(false);
|
||||
} else {
|
||||
setnavbar("app", title);
|
||||
$('#appframe').css('top', '75px');
|
||||
}
|
||||
$.post(url + api, {
|
||||
username: localStorage.getItem("username"),
|
||||
key: localStorage.getItem("key"),
|
||||
password: localStorage.getItem("password"),
|
||||
action: "start_session"
|
||||
}, function (data) {
|
||||
if (data.status === 'OK') {
|
||||
document.getElementById("loadframe").contentWindow.postMessage("loginok", "*");
|
||||
if (typeof injectcode === 'undefined' || injectcode === true) {
|
||||
$('#appframe').on("load", function () {
|
||||
if (typeof injectcode === 'undefined' || injectcode === true) {
|
||||
$('#appframe').on("load", function () {
|
||||
$("#loadframe").fadeOut(300);
|
||||
historyctr++;
|
||||
$.get("css/sidemenu.css", function (style) {
|
||||
$('#appframe').contents().find('head').append("<style>" + style + "</style>");
|
||||
$.get("js/jquery-ui.min.js", function (script) {
|
||||
$('#appframe').contents().find('body').append("<script>" + script + "<\/script>");
|
||||
$.get("js/hammer.min.js", function (script) {
|
||||
$('#appframe').contents().find('body').append("<script>" + script + "<\/script>");
|
||||
$.get("js/sidemenu.js", function (script) {
|
||||
script = script.replace("__JQUERYFXOFF__", !(localStorage.getItem("animations") === null || localStorage.getItem("animations") === "true"));
|
||||
script = script.replace("__USERNAME__", userinfo.realname);
|
||||
script = script.replace("__LOGO__", icon);
|
||||
$('#appframe').contents().find('body').append("<script>" + script + "<\/script>");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// Only inject minimal CSS
|
||||
$('#appframe').on("load", function () {
|
||||
$.get("css/inject_mini.css", function (style) {
|
||||
$('#appframe').contents().find('head').append("<style>" + style + "</style>");
|
||||
});
|
||||
});
|
||||
}
|
||||
$('#appframe').attr('src', url);
|
||||
} else {
|
||||
navigator.notification.alert(data.msg, null, "Error", 'Dismiss');
|
||||
openscreen("home");
|
||||
}
|
||||
}, "json").fail(function () {
|
||||
navigator.notification.alert("Could not connect to the server. Try again later.", null, "Error", 'Dismiss');
|
||||
openscreen("home");
|
||||
});
|
||||
historyctr++;
|
||||
$.get("css/sidemenu.css", function (style) {
|
||||
$('#appframe').contents().find('head').append("<style>" + style + "</style>");
|
||||
$.get("js/jquery-ui.min.js", function (script) {
|
||||
$('#appframe').contents().find('body').append("<script>" + script + "<\/script>");
|
||||
$.get("js/hammer.min.js", function (script) {
|
||||
$('#appframe').contents().find('body').append("<script>" + script + "<\/script>");
|
||||
$.get("js/sidemenu.js", function (script) {
|
||||
script = script.replace("__JQUERYFXOFF__", !(localStorage.getItem("animations") === null || localStorage.getItem("animations") === "true"));
|
||||
script = script.replace("__USERNAME__", userinfo.realname);
|
||||
script = script.replace("__LOGO__", icon);
|
||||
$('#appframe').contents().find('body').append("<script>" + script + "<\/script>");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// Only inject minimal CSS
|
||||
$('#appframe').on("load", function () {
|
||||
$.get("css/inject_mini.css", function (style) {
|
||||
$('#appframe').contents().find('head').append("<style>" + style + "</style>");
|
||||
});
|
||||
});
|
||||
}
|
||||
$('#appframe').attr('src', url);
|
||||
} else {
|
||||
navigator.notification.alert(data.msg, null, "Error", 'Dismiss');
|
||||
openscreen("home");
|
||||
}
|
||||
}, "json").fail(function () {
|
||||
navigator.notification.alert("Could not connect to the server. Try again later.", null, "Error", 'Dismiss');
|
||||
openscreen("home");
|
||||
});
|
||||
}
|
||||
|
||||
var scanningactive = false;
|
||||
var dedup = false;
|
||||
window.addEventListener('message', function (event) {
|
||||
console.log("app event: " + event.data);
|
||||
console.log("app event: " + event.data);
|
||||
setTimeout(function () {
|
||||
dedup = false;
|
||||
}, 500);
|
||||
@ -83,57 +83,57 @@
|
||||
return;
|
||||
}
|
||||
dedup = true;
|
||||
if (event.data == "quit") {
|
||||
openscreen("home");
|
||||
} else if (event.data == "goneback") {
|
||||
historyctr -= 1;
|
||||
} else if (event.data.startsWith("setcolor ")) {
|
||||
var color = event.data.split(" ", 2)[1];
|
||||
if (cordova.platformId == 'android') {
|
||||
window.plugins.headerColor.tint(color);
|
||||
for (var swatch in _PALETTE) {
|
||||
if (color == _PALETTE[swatch]["shade_500"]) {
|
||||
StatusBar.backgroundColorByHexString(_PALETTE[swatch]["shade_700"]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
StatusBar.backgroundColorByHexString(color);
|
||||
}
|
||||
} else if (event.data.startsWith("scancode ")) {
|
||||
var callbackcode = event.data.split(" ").slice(1).join(" ");
|
||||
console.log("got scancode " + callbackcode);
|
||||
try {
|
||||
if (scanningactive) {
|
||||
console.log("Scanner already active, ignoring request.");
|
||||
return;
|
||||
}
|
||||
scanningactive = true;
|
||||
cordova.plugins.barcodeScanner.scan(
|
||||
function (result) {
|
||||
scanningactive = false;
|
||||
if (!result.cancelled) {
|
||||
var iframe = document.getElementById("appframe");
|
||||
iframe.contentWindow.postMessage("coderesult~|~" + callbackcode + "~|~" + result.text, "*");
|
||||
}
|
||||
},
|
||||
function (error) {
|
||||
scanningactive = false;
|
||||
navigator.notification.alert("Scanning failed: " + error, null, "Error", 'Dismiss');
|
||||
},
|
||||
{
|
||||
"showFlipCameraButton": true,
|
||||
"prompt": "Scan Code"
|
||||
}
|
||||
);
|
||||
} catch (ex) {
|
||||
scanningactive = false;
|
||||
navigator.notification.alert(ex.message, null, "Error", 'Dismiss');
|
||||
}
|
||||
}
|
||||
if (event.data == "quit") {
|
||||
openscreen("home");
|
||||
} else if (event.data == "goneback") {
|
||||
historyctr -= 1;
|
||||
} else if (event.data.startsWith("setcolor ")) {
|
||||
var color = event.data.split(" ", 2)[1];
|
||||
if (cordova.platformId == 'android') {
|
||||
window.plugins.headerColor.tint(color);
|
||||
for (var swatch in _PALETTE) {
|
||||
if (color == _PALETTE[swatch]["shade_500"]) {
|
||||
StatusBar.backgroundColorByHexString(_PALETTE[swatch]["shade_700"]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
StatusBar.backgroundColorByHexString(color);
|
||||
}
|
||||
} else if (event.data.startsWith("scancode ")) {
|
||||
var callbackcode = event.data.split(" ").slice(1).join(" ");
|
||||
console.log("got scancode " + callbackcode);
|
||||
try {
|
||||
if (scanningactive) {
|
||||
console.log("Scanner already active, ignoring request.");
|
||||
return;
|
||||
}
|
||||
scanningactive = true;
|
||||
cordova.plugins.barcodeScanner.scan(
|
||||
function (result) {
|
||||
scanningactive = false;
|
||||
if (!result.cancelled) {
|
||||
var iframe = document.getElementById("appframe");
|
||||
iframe.contentWindow.postMessage("coderesult~|~" + callbackcode + "~|~" + result.text, "*");
|
||||
}
|
||||
},
|
||||
function (error) {
|
||||
scanningactive = false;
|
||||
navigator.notification.alert("Scanning failed: " + error, null, "Error", 'Dismiss');
|
||||
},
|
||||
{
|
||||
"showFlipCameraButton": true,
|
||||
"prompt": "Scan Code"
|
||||
}
|
||||
);
|
||||
} catch (ex) {
|
||||
scanningactive = false;
|
||||
navigator.notification.alert(ex.message, null, "Error", 'Dismiss');
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
||||
if (userinfo == null) {
|
||||
getuserinfo();
|
||||
getuserinfo();
|
||||
}
|
||||
</script>
|
@ -122,24 +122,24 @@
|
||||
<div id="giveup" onclick="parent.postMessage('quit', '*');">Give up</div>
|
||||
<script>
|
||||
window.addEventListener('message', function (event) {
|
||||
if (event.data == "loginok") {
|
||||
document.getElementById("statustext").innerHTML = "Loading...";
|
||||
setTimeout(function () {
|
||||
document.getElementById("statustext").innerHTML = "Still loading...";
|
||||
}, 5000);
|
||||
setTimeout(function () {
|
||||
document.getElementById("statustext").innerHTML = "Just a moment...";
|
||||
document.getElementById("giveup").style.display = "inline-block";
|
||||
}, 10000);
|
||||
setTimeout(function () {
|
||||
document.getElementById("statustext").innerHTML = "Well this is awkward.";
|
||||
}, 20000);
|
||||
setTimeout(function () {
|
||||
document.getElementById("statustext").innerHTML = "[fidgets nervously]";
|
||||
}, 25000);
|
||||
setTimeout(function () {
|
||||
document.getElementById("statustext").innerHTML = "Either something is broken or your connection is too slow.";
|
||||
}, 30000);
|
||||
}
|
||||
if (event.data == "loginok") {
|
||||
document.getElementById("statustext").innerHTML = "Loading...";
|
||||
setTimeout(function () {
|
||||
document.getElementById("statustext").innerHTML = "Still loading...";
|
||||
}, 5000);
|
||||
setTimeout(function () {
|
||||
document.getElementById("statustext").innerHTML = "Just a moment...";
|
||||
document.getElementById("giveup").style.display = "inline-block";
|
||||
}, 10000);
|
||||
setTimeout(function () {
|
||||
document.getElementById("statustext").innerHTML = "Well this is awkward.";
|
||||
}, 20000);
|
||||
setTimeout(function () {
|
||||
document.getElementById("statustext").innerHTML = "[fidgets nervously]";
|
||||
}, 25000);
|
||||
setTimeout(function () {
|
||||
document.getElementById("statustext").innerHTML = "Either something is broken or your connection is too slow.";
|
||||
}, 30000);
|
||||
}
|
||||
});
|
||||
</script>
|
@ -235,7 +235,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.</pre>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<h2>catfan/medoo</h2>
|
||||
<pre>MIT License
|
||||
|
||||
@ -258,9 +258,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>twbs/bootstrap</h2>
|
||||
<pre>The MIT License (MIT)
|
||||
|
||||
@ -283,9 +283,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>bassjobsen/Bootstrap-3-Typeahead</h2>
|
||||
<pre>MIT License
|
||||
|
||||
@ -296,8 +296,8 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</pre>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
<div>
|
||||
<h2>DataTables/DataTables</h2>
|
||||
<pre>Copyright (c) 2008-2015 SpryMedia Limited
|
||||
http://datatables.net
|
||||
@ -319,9 +319,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>npm/npm</h2>
|
||||
<pre>The npm application
|
||||
Copyright (c) npm, Inc. and Contributors
|
||||
@ -558,9 +558,9 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
--------
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>FortAwesome/Font-Awesome</h2>
|
||||
<pre>SIL OPEN FONT LICENSE
|
||||
|
||||
@ -620,9 +620,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRES
|
||||
|
||||
=================================
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>thomaspark/bootswatch</h2>
|
||||
<pre>The MIT License (MIT)
|
||||
|
||||
@ -645,9 +645,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>composer/composer</h2>
|
||||
<pre>Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
@ -668,9 +668,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>nwjs/nw.js</h2>
|
||||
<pre>Copyright (c) 2012-2015 Intel Corp
|
||||
Copyright (c) 2012-2015 The Chromium Authors
|
||||
@ -691,9 +691,9 @@ A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYR
|
||||
IGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT
|
||||
H THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>google/material-design-icons</h2>
|
||||
<pre>
|
||||
Apache License
|
||||
@ -897,8 +897,8 @@ H THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.</pre>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
<div>
|
||||
<h2>guzzle/guzzle</h2>
|
||||
<pre>Copyright (c) 2011-2016 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
|
||||
|
||||
@ -919,9 +919,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>ezyang/htmlpurifier</h2>
|
||||
<pre> GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
@ -1427,9 +1427,9 @@ necessary. Here is a sample; alter the names:
|
||||
That's all there is to it!
|
||||
|
||||
vim: et sw=4 sts=4
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>endroid/qrcode</h2>
|
||||
<pre>Copyright (c) Jeroen van den Enden
|
||||
|
||||
@ -1450,9 +1450,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>ldaptools/ldaptools</h2>
|
||||
<pre>Copyright (c) 2015 Chad Sikorra
|
||||
|
||||
@ -1473,8 +1473,8 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.</pre>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
<div>
|
||||
<h2>phpmailer/phpmailer</h2>
|
||||
<pre> GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
@ -1978,8 +1978,8 @@ necessary. Here is a sample; alter the names:
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!</pre>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
<div>
|
||||
<h2>spomky-labs/otphp</h2>
|
||||
<pre>The MIT License (MIT)
|
||||
|
||||
@ -2001,9 +2001,9 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>jquery/jquery</h2>
|
||||
<pre>Copyright JS Foundation and other contributors, https://js.foundation/
|
||||
|
||||
@ -2041,9 +2041,9 @@ All files located in the node_modules and external directories are
|
||||
externally maintained libraries used by this software which have their
|
||||
own licenses; we recommend you read them, as their terms may differ from
|
||||
the terms above.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>pawelczak/EasyAutocomplete</h2>
|
||||
<pre>The MIT License (MIT)
|
||||
|
||||
@ -2066,9 +2066,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>jquery/jquery-ui</h2>
|
||||
<pre>Copyright jQuery Foundation and other contributors, https://jquery.org/
|
||||
|
||||
@ -2113,9 +2113,9 @@ All files located in the node_modules and external directories are
|
||||
externally maintained libraries used by this software which have their
|
||||
own licenses; we recommend you read them, as their terms may differ from
|
||||
the terms above.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>Eonasdan/bootstrap-datetimepicker</h2>
|
||||
<pre>The MIT License (MIT)
|
||||
|
||||
@ -2138,9 +2138,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>moment/moment</h2>
|
||||
<pre>Copyright (c) JS Foundation and other contributors
|
||||
|
||||
@ -2164,9 +2164,9 @@ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>becvert/cordova-plugin-zeroconf</h2>
|
||||
<pre>The MIT License (MIT)
|
||||
|
||||
@ -2190,9 +2190,9 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>tomloprod/cordova-plugin-headercolor</h2>
|
||||
<pre>The MIT License (MIT)
|
||||
|
||||
@ -2203,9 +2203,9 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>whiteoctober/cordova-plugin-app-version</h2>
|
||||
<pre>Copyright (c) 2013 White October
|
||||
|
||||
@ -2227,9 +2227,9 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>phonegap/phonegap-plugin-barcodescanner</h2>
|
||||
<pre>Copyright 2010 Matt Kane
|
||||
Copyright 2011 IBM Corporation
|
||||
@ -2253,9 +2253,9 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>apache/cordova-android</h2>
|
||||
<pre>
|
||||
Apache License
|
||||
@ -2571,9 +2571,9 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>apache/cordova-ios</h2>
|
||||
<pre>
|
||||
Apache License
|
||||
@ -2831,9 +2831,9 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>apache/cordova-js</h2>
|
||||
<pre>
|
||||
Apache License
|
||||
@ -3130,8 +3130,8 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.</pre>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
<div>
|
||||
<h2>thephpleague/csv</h2>
|
||||
<pre>The MIT License (MIT)
|
||||
|
||||
@ -3153,9 +3153,9 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>Lapinator/odsPhpGenerator</h2>
|
||||
<pre>GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
@ -3228,8 +3228,8 @@ Each version is given a distinguishing version number. If the Library as you rec
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.</pre>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
<div>
|
||||
<h2>jiangts/JS-OTP</h2>
|
||||
<pre>MIT License
|
||||
|
||||
@ -3252,9 +3252,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
<h2>hammerjs/hammer.js</h2>
|
||||
<pre>The MIT License (MIT)
|
||||
|
||||
@ -3277,5 +3277,5 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
</pre>
|
||||
</div>
|
||||
</pre>
|
||||
</div>
|
@ -15,37 +15,37 @@
|
||||
|
||||
<script>
|
||||
function loadapps() {
|
||||
$(".loading-text").html("Loading Apps...");
|
||||
$.post(localStorage.getItem("syncurl"), {
|
||||
username: localStorage.getItem("username"),
|
||||
key: localStorage.getItem("key"),
|
||||
action: "listapps"
|
||||
}, function (data) {
|
||||
if (data.status === 'OK') {
|
||||
$("#loading-text").text("One moment...");
|
||||
$('#app-dock').html("");
|
||||
Object.keys(data.apps).forEach(function (k) {
|
||||
var app = data.apps[k];
|
||||
var iconurl = app.icon;
|
||||
if (!app.icon.startsWith("http")) {
|
||||
iconurl = app.url + app.icon;
|
||||
}
|
||||
$("<div class=\"app-dock-item\" onclick=\"openapp('" + k + "', '" + app.mobileapi + "', '" + app.url + "', '" + iconurl + "', '" + app.title + "')\"><p><img src=\"" + iconurl + "\" class=\"img-responsive app-icon\" /><span>" + app.title + "</span></p></div>").hide().appendTo("#app-dock").fadeIn(200);
|
||||
});
|
||||
} else {
|
||||
navigator.notification.alert(data.msg, null, "Error", 'Dismiss');
|
||||
openscreen("homeloaderror");
|
||||
}
|
||||
}, "json").fail(function () {
|
||||
navigator.notification.alert("Could not connect to the server. Try again later.", null, "Error", 'Dismiss');
|
||||
openscreen("homeloaderror");
|
||||
});
|
||||
$(".loading-text").html("Loading Apps...");
|
||||
$.post(localStorage.getItem("syncurl"), {
|
||||
username: localStorage.getItem("username"),
|
||||
key: localStorage.getItem("key"),
|
||||
action: "listapps"
|
||||
}, function (data) {
|
||||
if (data.status === 'OK') {
|
||||
$("#loading-text").text("One moment...");
|
||||
$('#app-dock').html("");
|
||||
Object.keys(data.apps).forEach(function (k) {
|
||||
var app = data.apps[k];
|
||||
var iconurl = app.icon;
|
||||
if (!app.icon.startsWith("http")) {
|
||||
iconurl = app.url + app.icon;
|
||||
}
|
||||
$("<div class=\"app-dock-item\" onclick=\"openapp('" + k + "', '" + app.mobileapi + "', '" + app.url + "', '" + iconurl + "', '" + app.title + "')\"><p><img src=\"" + iconurl + "\" class=\"img-responsive app-icon\" /><span>" + app.title + "</span></p></div>").hide().appendTo("#app-dock").fadeIn(200);
|
||||
});
|
||||
} else {
|
||||
navigator.notification.alert(data.msg, null, "Error", 'Dismiss');
|
||||
openscreen("homeloaderror");
|
||||
}
|
||||
}, "json").fail(function () {
|
||||
navigator.notification.alert("Could not connect to the server. Try again later.", null, "Error", 'Dismiss');
|
||||
openscreen("homeloaderror");
|
||||
});
|
||||
}
|
||||
|
||||
if (localStorage.getItem('setupcomplete')) {
|
||||
setnavbar("home");
|
||||
loadapps();
|
||||
setnavbar("home");
|
||||
loadapps();
|
||||
} else {
|
||||
openscreen("setup1");
|
||||
openscreen("setup1");
|
||||
}
|
||||
</script>
|
@ -26,34 +26,34 @@
|
||||
var ls_text = localStorage.getItem("otp");
|
||||
var keys = [];
|
||||
if (ls_text !== null && ls_text != "") {
|
||||
var keys = JSON.parse(ls_text || "[]");
|
||||
if (keys.length > 0) {
|
||||
$("#nokeys").css("display", "none");
|
||||
}
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var code = totp.getOtp(keys[i]["secret"]);
|
||||
// Escape HTML characters
|
||||
var label = $('<div/>').html(keys[i]["label"]).html();
|
||||
var issuer = $('<div/>').text(keys[i]["issuer"]).html();
|
||||
$("#codelist").append("<div class=\"list-group-item\" id=\"codeitem_" + i + "\">"
|
||||
+ "<span class=\"pull-right\" style=\"color: red;\" onclick=\"deleteCode(" + i + ")\"><i class=\"fa fa-trash-o\"></i></span>"
|
||||
+ "<p class=\"h6\">" + label + "</p>"
|
||||
+ "<div class=\"h3 code\" style=\"font-weight: bold;\">" + code + "</div>"
|
||||
+ "<p class=\"small\">" + issuer + "</p>"
|
||||
+ "</div>");
|
||||
}
|
||||
var keys = JSON.parse(ls_text || "[]");
|
||||
if (keys.length > 0) {
|
||||
$("#nokeys").css("display", "none");
|
||||
}
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var code = totp.getOtp(keys[i]["secret"]);
|
||||
// Escape HTML characters
|
||||
var label = $('<div/>').html(keys[i]["label"]).html();
|
||||
var issuer = $('<div/>').text(keys[i]["issuer"]).html();
|
||||
$("#codelist").append("<div class=\"list-group-item\" id=\"codeitem_" + i + "\">"
|
||||
+ "<span class=\"pull-right\" style=\"color: red;\" onclick=\"deleteCode(" + i + ")\"><i class=\"fa fa-trash-o\"></i></span>"
|
||||
+ "<p class=\"h6\">" + label + "</p>"
|
||||
+ "<div class=\"h3 code\" style=\"font-weight: bold;\">" + code + "</div>"
|
||||
+ "<p class=\"small\">" + issuer + "</p>"
|
||||
+ "</div>");
|
||||
}
|
||||
}
|
||||
|
||||
function refreshCountdown() {
|
||||
var percent = ((30 - ((new Date).getSeconds() % 30)) / 30) * 100;
|
||||
$("#countdown").css("width", percent + "%");
|
||||
var percent = ((30 - ((new Date).getSeconds() % 30)) / 30) * 100;
|
||||
$("#countdown").css("width", percent + "%");
|
||||
}
|
||||
|
||||
function refreshCodes() {
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var code = totp.getOtp(keys[i]["secret"]);
|
||||
$("#codelist #codeitem_" + i + " .code").text(code);
|
||||
}
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var code = totp.getOtp(keys[i]["secret"]);
|
||||
$("#codelist #codeitem_" + i + " .code").text(code);
|
||||
}
|
||||
}
|
||||
|
||||
function deleteCode(index) {
|
||||
@ -68,8 +68,8 @@
|
||||
}
|
||||
|
||||
setInterval(function () {
|
||||
refreshCountdown();
|
||||
refreshCodes();
|
||||
refreshCountdown();
|
||||
refreshCodes();
|
||||
}, 1000);
|
||||
|
||||
refreshCountdown();
|
||||
|
@ -76,7 +76,7 @@
|
||||
}
|
||||
$('#key').val(formatted.toUpperCase());
|
||||
});
|
||||
|
||||
|
||||
$('#username').on("keyup", function () {
|
||||
$('#username').val($('#username').val().toLowerCase());
|
||||
});
|
||||
|
@ -37,6 +37,6 @@
|
||||
navigator.notification.alert("Could not connect to the server. Try again later.", null, "Error", 'Dismiss');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
setnavbar("setup");
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user