/** @type {?number} @private */
let unique = null;
+/** @type {?string} @private */
+let admin_password = null;
+
/** @type {boolean} @private */
let enable_sound = false;
} else {
document.getElementById("searchstats").textContent = "";
}
+ if (admin_password !== null) {
+ document.getElementById("searchstats").innerHTML += " | <span style=\"color: red;\">ADMIN MODE (if password is right)</span>";
+ }
// Update the board itself.
base_fen = data['position']['fen'];
promotion: 'q' // NOTE: always promote to a queen for example simplicity
});
+ if (admin_password !== null) {
+ let url = '/manual-override.pl';
+ url += '?fen=' + encodeURIComponent(display_fen);
+ url += '&history=' + encodeURIComponent(JSON.stringify(current_analysis_data['position']['history']));
+ url += '&move=' + encodeURIComponent(move.san);
+ url += '&player_w=' + encodeURIComponent(current_analysis_data['position']['player_w']);
+ url += '&player_b=' + encodeURIComponent(current_analysis_data['position']['player_b']);
+ url += '&password=' + encodeURIComponent(admin_password);
+ fetch(url);
+ return;
+ }
+
// Move ahead on the line we're on -- this includes history if we've
// gone backwards.
if (current_display_line &&
set_sound(false);
}
+ let admin_match = window.location.href.match(/\?password=([a-zA-Z0-9_-]+)/);
+ if (admin_match !== null) {
+ admin_password = admin_match[1];
+ }
+
// Create board.
board = new window.ChessBoard('board', {
onMoveEnd: function() { board_is_animating = false; },