Merge branch 'hotfix/error_reporting'
This commit is contained in:
@@ -9,10 +9,16 @@
|
|||||||
log('[tpl] Script "custom.js" loaded');
|
log('[tpl] Script "custom.js" loaded');
|
||||||
|
|
||||||
var loaderCount = 2;
|
var loaderCount = 2;
|
||||||
|
var showConsoleButtonTimeout = setTimeout(function(){
|
||||||
|
$('#button-show-console').show();
|
||||||
|
}, 10000);
|
||||||
var showLoader = function() {
|
var showLoader = function() {
|
||||||
if (loaderCount < 1) {
|
if (loaderCount < 1) {
|
||||||
$('#preloader').removeClass('preloader-hide');
|
$('#preloader').removeClass('preloader-hide');
|
||||||
loaderCount = 0;
|
loaderCount = 0;
|
||||||
|
showConsoleButtonTimeout = setTimeout(function(){
|
||||||
|
$('#button-show-console').show();
|
||||||
|
}, 10000);
|
||||||
log('[tpl] Loader shown');
|
log('[tpl] Loader shown');
|
||||||
}
|
}
|
||||||
loaderCount ++;
|
loaderCount ++;
|
||||||
@@ -22,6 +28,8 @@ var hideLoader = function() {
|
|||||||
if (loaderCount < 1) {
|
if (loaderCount < 1) {
|
||||||
$('#preloader').addClass('preloader-hide');
|
$('#preloader').addClass('preloader-hide');
|
||||||
loaderCount = 0;
|
loaderCount = 0;
|
||||||
|
clearTimeout(showConsoleButtonTimeout);
|
||||||
|
$('#button-show-console').hide();
|
||||||
log('[tpl] Loader hidden');
|
log('[tpl] Loader hidden');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -370,7 +378,7 @@ eraseCookie('sticky_dark_mode');
|
|||||||
$(this).parent().find('span').removeClass('input-style-1-inactive input-style-1-active');
|
$(this).parent().find('span').removeClass('input-style-1-inactive input-style-1-active');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
log('[tpl] init a2h');
|
log('[tpl] init a2h');
|
||||||
|
|
||||||
//Adding added-to-homescreen class to be targeted when used as PWA.
|
//Adding added-to-homescreen class to be targeted when used as PWA.
|
||||||
|
|||||||
@@ -1155,6 +1155,8 @@ var mobileConsole = (function () {
|
|||||||
if (!msgContainer.innerHTML) { return; }
|
if (!msgContainer.innerHTML) { return; }
|
||||||
leftContainer.appendChild(msgContainer);
|
leftContainer.appendChild(msgContainer);
|
||||||
|
|
||||||
|
var errorReportEntry = { message: arguments[1].newMessage };
|
||||||
|
|
||||||
if (detailTable || stackTable) {
|
if (detailTable || stackTable) {
|
||||||
setCSS(msgContainer, {cursor : 'pointer'});
|
setCSS(msgContainer, {cursor : 'pointer'});
|
||||||
leftContainer.appendChild(detailTable || stackTable);
|
leftContainer.appendChild(detailTable || stackTable);
|
||||||
@@ -1164,8 +1166,18 @@ var mobileConsole = (function () {
|
|||||||
//populate right side
|
//populate right side
|
||||||
if (stackTrace && typeof stackTrace[stackTrace.length - 1] !== 'undefined') {
|
if (stackTrace && typeof stackTrace[stackTrace.length - 1] !== 'undefined') {
|
||||||
rightContainer.appendChild(setCSS(getLink(stackTrace[0].url, stackTrace[0].linkText), {color: '#808080'}));
|
rightContainer.appendChild(setCSS(getLink(stackTrace[0].url, stackTrace[0].linkText), {color: '#808080'}));
|
||||||
|
errorReportEntry.stack = { caller: stackTrace[0].caller, file: stackTrace[0].url, line: stackTrace[0].line, col: stackTrace[0].col };
|
||||||
|
if ((typeof LINK_PRE !== 'undefined') && (errorReportEntry.stack.file.startsWith(LINK_PRE))) {
|
||||||
|
errorReportEntry.stack.file = errorReportEntry.stack.file.substr(LINK_PRE.length);
|
||||||
|
}
|
||||||
|
var pos = errorReportEntry.stack.file.indexOf('?');
|
||||||
|
if (pos >= 0) {
|
||||||
|
errorReportEntry.stack.file = errorReportEntry.stack.file.substr(0, pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof onConsoleOutput === 'function') onConsoleOutput(errorReportEntry);
|
||||||
|
|
||||||
//add to line
|
//add to line
|
||||||
lineContainer.appendChild(leftContainer);
|
lineContainer.appendChild(leftContainer);
|
||||||
lineContainer.appendChild(rightContainer);
|
lineContainer.appendChild(rightContainer);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
header('Content-Type: text/javascript');
|
header('Content-Type: text/javascript');
|
||||||
|
|
||||||
require_once(__DIR__ . '/../../server/config.php');
|
require_once(__DIR__ . '/../../server/config.php');
|
||||||
|
require_once(__DIR__ . '/../../server/version.php');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -13,6 +14,31 @@ const YOUTH_AGE = '<?php echo $_CLASS['youth-age']; ?>';
|
|||||||
const YOUTH_GERMAN_NAME = '<?php echo $_CLASS['youth-german-name']; ?>';
|
const YOUTH_GERMAN_NAME = '<?php echo $_CLASS['youth-german-name']; ?>';
|
||||||
const PUSH_SERVER_KEY = '<?php echo PUSH_SERVER_KEY; ?>';
|
const PUSH_SERVER_KEY = '<?php echo PUSH_SERVER_KEY; ?>';
|
||||||
|
|
||||||
|
var consoleOutput = [];
|
||||||
|
|
||||||
|
function onConsoleOutput(entry) {
|
||||||
|
consoleOutput.push(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onerror = function(message, source, lineno, colno, errorError) {
|
||||||
|
if (source.startsWith(LINK_PRE)) {
|
||||||
|
source = source.substr(LINK_PRE.length);
|
||||||
|
}
|
||||||
|
var pos = source.indexOf('?');
|
||||||
|
if (pos >= 0) {
|
||||||
|
source = source.substr(0, pos);
|
||||||
|
}
|
||||||
|
consoleOutput.push({
|
||||||
|
message: message,
|
||||||
|
stack: {
|
||||||
|
caller: '',
|
||||||
|
file: source,
|
||||||
|
line: lineno,
|
||||||
|
col: colno
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function log() {
|
function log() {
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
var hour = now.getHours().toString();
|
var hour = now.getHours().toString();
|
||||||
@@ -547,19 +573,39 @@ var addConsoleOpenerToPreloader = function() {
|
|||||||
addConsoleOpenerToPreloader = function(){};
|
addConsoleOpenerToPreloader = function(){};
|
||||||
var preloader = document.getElementById('preloader');
|
var preloader = document.getElementById('preloader');
|
||||||
var button = document.createElement('a');
|
var button = document.createElement('a');
|
||||||
|
button.id = 'button-show-console';
|
||||||
button.href = '#';
|
button.href = '#';
|
||||||
button.classList = 'btn rounded-s text-uppercase font-900 shadow-m m-3';
|
button.classList = 'btn rounded-s text-uppercase font-900 shadow-m m-3 bg-red2-dark bg-white';
|
||||||
button.style.position = 'fixed';
|
button.style.position = 'fixed';
|
||||||
button.style.bottom = 0;
|
button.style.bottom = 0;
|
||||||
|
button.style.left = 0;
|
||||||
button.style.right = 0;
|
button.style.right = 0;
|
||||||
button.innerHTML = '</>';
|
button.innerHTML = 'Fehlerbericht senden';
|
||||||
button.onclick = function(){
|
button.onclick = function(){
|
||||||
alert('CONSOLE OPENED\nDir werden jetzt einige Entwickler-Informationen angezeigt. Du kannst die Console über das X oben rechts wieder schließen.');
|
alert('FEHLERBERICHT\nEs wird jetzt ein Fehlerbericht an die Entwickler geschickt.\nBitte stelle sicher, dass Du mit dem Internet verbunden bist und drücke dann auf OK.');
|
||||||
mobileConsole.displayConsole();
|
$.ajax({
|
||||||
|
url: QUERY_URL + 'error_report',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
errors: consoleOutput,
|
||||||
|
device: navigator.userAgent,
|
||||||
|
version: '<?php echo PWA_VERSION; ?>'
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
if (xhr.status == 0) {
|
||||||
|
alert('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Fehlerbericht zu senden');
|
||||||
|
} else {
|
||||||
|
alert('Beim Senden ist ein unbekannter Fehler aufgetreten. Bitte versuche es noch einmal');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
success: function (data, status, xhr) {
|
||||||
|
alert('Wir leiten Dich jetzt zum erstellten Fehlerbericht um, sodass Du ggf. weitere Informationen ergänzen kannst.');
|
||||||
|
location.href = 'https://github.com/ostertun/RegattenApp/issues/' + data.issueNumber;
|
||||||
|
}
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setTimeout(function(){
|
preloader.appendChild(button);
|
||||||
preloader.appendChild(button);
|
$(button).hide();
|
||||||
}, 5000);
|
|
||||||
}
|
}
|
||||||
addConsoleOpenerToPreloader();
|
addConsoleOpenerToPreloader();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PWA_VERSION', '1.11h3');
|
define('PWA_VERSION', '1.11h4');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user