diff --git a/_debug_replacements.php b/_debug_replacements.php
index 3ae64da..c7d4124 100644
--- a/_debug_replacements.php
+++ b/_debug_replacements.php
@@ -83,7 +83,7 @@ return [
'term_height' => '25',
'default_bg' => '0',
'default_fg' => '7',
- 'show_buttons' => '0',
+ 'show_buttons' => '1',
'show_config_links' => '1',
'uart_baud' => 115200,
diff --git a/base.php b/base.php
index 2e211d0..a049c68 100644
--- a/base.php
+++ b/base.php
@@ -12,19 +12,27 @@ if (!empty($argv[1])) {
parse_str($argv[1], $_GET);
}
-if (!file_exists(__DIR__ . '/_env.php')) {
- die("Copy _env.php.example to _env.php and check the settings inside!");
-}
-
define('GIT_HASH', trim(shell_exec('git rev-parse --short HEAD')));
-require_once __DIR__ . '/_env.php';
-
$prod = defined('STDIN');
define('DEBUG', !$prod);
-$root = DEBUG ? json_encode(ESP_IP) : 'location.host';
+
+// Resolve hostname for ajax etc
+$root = 'location.host';
+if (!file_exists(__DIR__ . '/_env.php')) {
+ if (DEBUG) {
+ die("No _env.php found! Copy _env.php.example to _env.php and check the settings inside!");
+ }
+} else {
+ if (DEBUG) {
+ require_once __DIR__ . '/_env.php';
+ $root = json_encode(ESP_IP);
+ }
+}
+
define('JS_WEB_ROOT', $root);
+
define('ESP_DEMO', (bool)getenv('ESP_DEMO'));
if (ESP_DEMO) {
define('DEMO_APS', << 550) {
$('.Box h2').forEach(function (x) {
x.removeAttribute('tabindex')
diff --git a/js/term_input.js b/js/term_input.js
index e9cee03..2199f7e 100644
--- a/js/term_input.js
+++ b/js/term_input.js
@@ -106,7 +106,9 @@ window.Input = function (conn) {
'np_sub': na('\x1bOS', '-'),
'np_point': na('\x1bOn', '.'),
'np_div': na('\x1bOQ', '/')
- // we don't implement numlock key (should change in numpad_alt mode, but it's even more useless than the rest)
+ // we don't implement numlock key (should change in numpad_alt mode,
+ // but it's even more useless than the rest and also has the side
+ // effect of changing the user's numlock state)
}
const blacklist = [
@@ -204,7 +206,7 @@ window.Input = function (conn) {
// Button presses
$('#action-buttons button').forEach(s => {
- s.addEventListener('click', () => {
+ s.addEventListener('click', function (evt) {
sendBtnMsg(+this.dataset['n'])
})
})
@@ -290,10 +292,10 @@ window.Input = function (conn) {
// console.log("B ",b," M ",m);
},
- mouseTracksClicks () {
- return cfg.mt_click
- },
-
+ /**
+ * Prevent capturing keys. This is used for text input
+ * modals on the terminal screen
+ */
blockKeys (yes) {
cfg.no_keys = yes
}
diff --git a/js/term_upload.js b/js/term_upload.js
index e399c4b..938b420 100644
--- a/js/term_upload.js
+++ b/js/term_upload.js
@@ -97,7 +97,6 @@ window.TermUpl = function (conn, input, screen) {
inline_pos += MAX_LINE_LEN
}
- console.log(chunk)
if (!input.sendString(chunk)) {
updateStatus('FAILED!')
return
@@ -134,10 +133,11 @@ window.TermUpl = function (conn, input, screen) {
qs('#fu_file').addEventListener('change', function (evt) {
let reader = new FileReader()
let file = evt.target.files[0]
- console.log('Selected file type: ' + file.type)
- if (!file.type.match(/text\/.*|application\/(json|csv|.*xml.*|.*script.*)/)) {
+ let ftype = file.type || 'application/octet-stream'
+ console.log('Selected file type: ' + ftype)
+ if (!ftype.match(/text\/.*|application\/(json|csv|.*xml.*|.*script.*|x-php)/)) {
// Deny load of blobs like img - can crash browser and will get corrupted anyway
- if (!confirm('This does not look like a text file: ' + file.type + '\nReally load?')) {
+ if (!confirm(`This does not look like a text file: ${ftype}\nReally load?`)) {
qs('#fu_file').value = ''
return
}
diff --git a/js/wifi.js b/js/wifi.js
index bd35fe4..8e90328 100644
--- a/js/wifi.js
+++ b/js/wifi.js
@@ -149,7 +149,7 @@
})
// Forget STA credentials
- $('#forget-sta').on('click', function () {
+ $('#forget-sta').on('click', () => {
selectSta('', '', '')
return false
})