Fix LMS plugin availability check. As I removed the download by ID, this needs a tweak on the UI/JS side.

This commit is contained in:
Michael Herger
2021-04-17 06:31:28 +02:00
parent 36571d3dad
commit f96d06912f
21 changed files with 68 additions and 58 deletions

View File

@@ -1 +1 @@
[{"C:\\Users\\sle11\\Documents\\VSCode\\squeezelite-esp32\\components\\wifi-manager\\webapp\\src\\js\\test.js":"1","C:\\Users\\sle11\\Documents\\VSCode\\squeezelite-esp32\\components\\wifi-manager\\webapp\\src\\js\\custom.js":"2"},{"size":4775,"mtime":1608244817341,"results":"3","hashOfConfig":"4"},{"size":61704,"mtime":1618438544167,"results":"5","hashOfConfig":"4"},{"filePath":"6","messages":"7","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"8"},"1275pne",{"filePath":"9","messages":"10","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\sle11\\Documents\\VSCode\\squeezelite-esp32\\components\\wifi-manager\\webapp\\src\\js\\test.js",[],[],"C:\\Users\\sle11\\Documents\\VSCode\\squeezelite-esp32\\components\\wifi-manager\\webapp\\src\\js\\custom.js",[]]
[{"/Users/mh/SynologyDrive/git/squeezelite-esp32/components/wifi-manager/webapp/src/js/custom.js":"1"},{"size":59815,"mtime":1618633783112,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"15w6qa4","/Users/mh/SynologyDrive/git/squeezelite-esp32/components/wifi-manager/webapp/src/js/custom.js",[]]

View File

@@ -1496,7 +1496,8 @@ function checkStatus() {
const baseUrl = 'http://' + data.lms_ip + ':' + data.lms_port;
prevLMSIP=data.lms_ip;
$.ajax({
url: baseUrl + '/plugins/SqueezeESP32/firmware/-99',
url: baseUrl + '/plugins/SqueezeESP32/firmware/-check.bin',
type: 'HEAD',
dataType: 'text',
cache: false,
error: function() {

View File

@@ -1,5 +1,5 @@
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/favicon-32x32.png BINARY)
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/index.html.gz BINARY)
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/js/index.abeafc.bundle.js.gz BINARY)
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/js/node-modules.abeafc.bundle.js.gz BINARY)
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/js/runtime.abeafc.bundle.js.gz BINARY)
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/js/index.cf3fe8.bundle.js.gz BINARY)
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/js/node-modules.cf3fe8.bundle.js.gz BINARY)
target_add_binary_data( __idf_wifi-manager ./webapp/webpack/dist/js/runtime.cf3fe8.bundle.js.gz BINARY)

View File

@@ -4,31 +4,31 @@ extern const uint8_t _favicon_32x32_png_start[] asm("_binary_favicon_32x32_png_s
extern const uint8_t _favicon_32x32_png_end[] asm("_binary_favicon_32x32_png_end");
extern const uint8_t _index_html_gz_start[] asm("_binary_index_html_gz_start");
extern const uint8_t _index_html_gz_end[] asm("_binary_index_html_gz_end");
extern const uint8_t _index_abeafc_bundle_js_gz_start[] asm("_binary_index_abeafc_bundle_js_gz_start");
extern const uint8_t _index_abeafc_bundle_js_gz_end[] asm("_binary_index_abeafc_bundle_js_gz_end");
extern const uint8_t _node_modules_abeafc_bundle_js_gz_start[] asm("_binary_node_modules_abeafc_bundle_js_gz_start");
extern const uint8_t _node_modules_abeafc_bundle_js_gz_end[] asm("_binary_node_modules_abeafc_bundle_js_gz_end");
extern const uint8_t _runtime_abeafc_bundle_js_gz_start[] asm("_binary_runtime_abeafc_bundle_js_gz_start");
extern const uint8_t _runtime_abeafc_bundle_js_gz_end[] asm("_binary_runtime_abeafc_bundle_js_gz_end");
extern const uint8_t _index_cf3fe8_bundle_js_gz_start[] asm("_binary_index_cf3fe8_bundle_js_gz_start");
extern const uint8_t _index_cf3fe8_bundle_js_gz_end[] asm("_binary_index_cf3fe8_bundle_js_gz_end");
extern const uint8_t _node_modules_cf3fe8_bundle_js_gz_start[] asm("_binary_node_modules_cf3fe8_bundle_js_gz_start");
extern const uint8_t _node_modules_cf3fe8_bundle_js_gz_end[] asm("_binary_node_modules_cf3fe8_bundle_js_gz_end");
extern const uint8_t _runtime_cf3fe8_bundle_js_gz_start[] asm("_binary_runtime_cf3fe8_bundle_js_gz_start");
extern const uint8_t _runtime_cf3fe8_bundle_js_gz_end[] asm("_binary_runtime_cf3fe8_bundle_js_gz_end");
const char * resource_lookups[] = {
"/dist/favicon-32x32.png",
"/dist/index.html.gz",
"/js/index.abeafc.bundle.js.gz",
"/js/node-modules.abeafc.bundle.js.gz",
"/js/runtime.abeafc.bundle.js.gz",
"/js/index.cf3fe8.bundle.js.gz",
"/js/node-modules.cf3fe8.bundle.js.gz",
"/js/runtime.cf3fe8.bundle.js.gz",
""
};
const uint8_t * resource_map_start[] = {
_favicon_32x32_png_start,
_index_html_gz_start,
_index_abeafc_bundle_js_gz_start,
_node_modules_abeafc_bundle_js_gz_start,
_runtime_abeafc_bundle_js_gz_start
_index_cf3fe8_bundle_js_gz_start,
_node_modules_cf3fe8_bundle_js_gz_start,
_runtime_cf3fe8_bundle_js_gz_start
};
const uint8_t * resource_map_end[] = {
_favicon_32x32_png_end,
_index_html_gz_end,
_index_abeafc_bundle_js_gz_end,
_node_modules_abeafc_bundle_js_gz_end,
_runtime_abeafc_bundle_js_gz_end
_index_cf3fe8_bundle_js_gz_end,
_node_modules_cf3fe8_bundle_js_gz_end,
_runtime_cf3fe8_bundle_js_gz_end
};

View File

@@ -1,40 +1,40 @@
/***********************************
webpack_headers
Hash: abeafc790ab5fbef1c83
Hash: cf3fe8058d89a1b0df6f
Version: webpack 4.46.0
Time: 7893ms
Built at: 2021-04-14 21 h 06 min 20 s
Time: 4393ms
Built at: 17.04.2021 06:30:07
Asset Size Chunks Chunk Names
./js/index.abeafc.bundle.js 231 KiB 0 [emitted] [immutable] index
./js/index.abeafc.bundle.js.br 32 KiB [emitted]
./js/index.abeafc.bundle.js.gz 41.2 KiB [emitted]
./js/node-modules.abeafc.bundle.js 266 KiB 1 [emitted] [immutable] [big] node-modules
./js/node-modules.abeafc.bundle.js.br 76.3 KiB [emitted]
./js/node-modules.abeafc.bundle.js.gz 88.7 KiB [emitted]
./js/runtime.abeafc.bundle.js 1.46 KiB 2 [emitted] [immutable] runtime
./js/runtime.abeafc.bundle.js.br 644 bytes [emitted]
./js/runtime.abeafc.bundle.js.gz 722 bytes [emitted]
favicon-32x32.png 578 bytes [emitted]
./js/index.cf3fe8.bundle.js 231 KiB 0 [emitted] [immutable] index
./js/index.cf3fe8.bundle.js.br 31.8 KiB [emitted]
./js/index.cf3fe8.bundle.js.gz 41.2 KiB [emitted]
./js/node-modules.cf3fe8.bundle.js 266 KiB 1 [emitted] [immutable] [big] node-modules
./js/node-modules.cf3fe8.bundle.js.br 76.3 KiB [emitted]
./js/node-modules.cf3fe8.bundle.js.gz 88.7 KiB [emitted]
./js/runtime.cf3fe8.bundle.js 1.46 KiB 2 [emitted] [immutable] runtime
./js/runtime.cf3fe8.bundle.js.br 644 bytes [emitted]
./js/runtime.cf3fe8.bundle.js.gz 722 bytes [emitted]
favicon-32x32.png 634 bytes [emitted]
index.html 21.7 KiB [emitted]
index.html.br 4.75 KiB [emitted]
index.html.gz 5.76 KiB [emitted]
sprite.svg 4.4 KiB [emitted]
sprite.svg.br 912 bytes [emitted]
Entrypoint index [big] = ./js/runtime.abeafc.bundle.js ./js/node-modules.abeafc.bundle.js ./js/index.abeafc.bundle.js
Entrypoint index [big] = ./js/runtime.cf3fe8.bundle.js ./js/node-modules.cf3fe8.bundle.js ./js/index.cf3fe8.bundle.js
[6] ./node_modules/bootstrap/dist/js/bootstrap-exposed.js 437 bytes {1} [built]
[11] ./src/sass/main.scss 1.55 KiB {0} [built]
[16] ./node_modules/remixicon/icons/Device/signal-wifi-fill.svg 340 bytes {1} [built]
[17] ./node_modules/remixicon/icons/Device/signal-wifi-3-fill.svg 344 bytes {1} [built]
[18] ./node_modules/remixicon/icons/Device/signal-wifi-2-fill.svg 344 bytes {1} [built]
[19] ./node_modules/remixicon/icons/Device/signal-wifi-1-fill.svg 344 bytes {1} [built]
[20] ./node_modules/remixicon/icons/Device/signal-wifi-line.svg 340 bytes {1} [built]
[21] ./node_modules/remixicon/icons/Device/battery-line.svg 332 bytes {1} [built]
[22] ./node_modules/remixicon/icons/Device/battery-low-line.svg 340 bytes {1} [built]
[23] ./node_modules/remixicon/icons/Device/battery-fill.svg 332 bytes {1} [built]
[24] ./node_modules/remixicon/icons/Media/headphone-fill.svg 335 bytes {1} [built]
[25] ./node_modules/remixicon/icons/Device/device-recover-fill.svg 346 bytes {1} [built]
[26] ./node_modules/remixicon/icons/Device/bluetooth-fill.svg 336 bytes {1} [built]
[27] ./node_modules/remixicon/icons/Device/bluetooth-connect-fill.svg 352 bytes {1} [built]
[16] ./node_modules/remixicon/icons/Device/signal-wifi-fill.svg 323 bytes {1} [built]
[17] ./node_modules/remixicon/icons/Device/signal-wifi-3-fill.svg 327 bytes {1} [built]
[18] ./node_modules/remixicon/icons/Device/signal-wifi-2-fill.svg 327 bytes {1} [built]
[19] ./node_modules/remixicon/icons/Device/signal-wifi-1-fill.svg 327 bytes {1} [built]
[20] ./node_modules/remixicon/icons/Device/signal-wifi-line.svg 323 bytes {1} [built]
[21] ./node_modules/remixicon/icons/Device/battery-line.svg 315 bytes {1} [built]
[22] ./node_modules/remixicon/icons/Device/battery-low-line.svg 323 bytes {1} [built]
[23] ./node_modules/remixicon/icons/Device/battery-fill.svg 315 bytes {1} [built]
[24] ./node_modules/remixicon/icons/Media/headphone-fill.svg 318 bytes {1} [built]
[25] ./node_modules/remixicon/icons/Device/device-recover-fill.svg 329 bytes {1} [built]
[26] ./node_modules/remixicon/icons/Device/bluetooth-fill.svg 319 bytes {1} [built]
[27] ./node_modules/remixicon/icons/Device/bluetooth-connect-fill.svg 335 bytes {1} [built]
[37] ./src/index.ts + 1 modules 62.5 KiB {0} [built]
| ./src/index.ts 1.36 KiB [built]
| ./src/js/custom.js 61 KiB [built]
@@ -43,14 +43,14 @@ Entrypoint index [big] = ./js/runtime.abeafc.bundle.js ./js/node-modules.abeafc.
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
./js/node-modules.abeafc.bundle.js (266 KiB)
./js/node-modules.cf3fe8.bundle.js (266 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
index (499 KiB)
./js/runtime.abeafc.bundle.js
./js/node-modules.abeafc.bundle.js
./js/index.abeafc.bundle.js
index (498 KiB)
./js/runtime.cf3fe8.bundle.js
./js/node-modules.cf3fe8.bundle.js
./js/index.cf3fe8.bundle.js
WARNING in webpack performance recommendations:
@@ -58,9 +58,9 @@ You can limit the size of your bundles by using import() or require.ensure to la
For more info visit https://webpack.js.org/guides/code-splitting/
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 560 KiB 0
index.html 559 KiB 0
Entrypoint undefined = index.html
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.ejs 23.9 KiB {0} [built]
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.ejs 22.9 KiB {0} [built]
[1] ./node_modules/lodash/lodash.js 531 KiB {0} [built]
[2] (webpack)/buildin/global.js 472 bytes {0} [built]
[3] (webpack)/buildin/module.js 497 bytes {0} [built]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 578 B

After

Width:  |  Height:  |  Size: 634 B

File diff suppressed because one or more lines are too long

View File

@@ -13,7 +13,7 @@ use constant FIRMWARE_POLL_INTERVAL => 3600 * (5 + rand());
use constant GITHUB_RELEASES_URI => "https://api.github.com/repos/sle118/squeezelite-esp32/releases";
use constant GITHUB_ASSET_URI => GITHUB_RELEASES_URI . "/assets/";
use constant GITHUB_DOWNLOAD_URI => "https://github.com/sle118/squeezelite-esp32/releases/download/";
use constant ESP32_STATUS_URI => "/status.json";
use constant ESP32_STATUS_URI => "http://%s/status.json";
my $FW_DOWNLOAD_REGEX = qr|plugins/SqueezeESP32/firmware/([-a-z0-9-/.]+\.bin)$|i;
my $FW_FILENAME_REGEX = qr/^squeezelite-esp32-.*\.bin(\.tmp)?$/;
@@ -61,7 +61,7 @@ sub initFirmwareDownload {
{
timeout => 10
}
)->get('http://' . $client->ip . ESP32_STATUS_URI);
)->get(sprintf(ESP32_STATUS_URI, $client->ip));
Slim::Utils::Timers::setTimer($client, Time::HiRes::time() + FIRMWARE_POLL_INTERVAL, \&initFirmwareDownload);
}
@@ -128,6 +128,15 @@ sub handleFirmwareDownload {
return $_errorDownloading->(undef, 'Invalid request', $request->uri, 400);
}
# this is the magic number used on the client to figure out whether the plugin does support download proxying
if ($path eq '-check.bin' && $request->method eq 'HEAD') {
$response->code(204);
$response->header('Access-Control-Allow-Origin' => '*');
$httpClient->send_response($response);
return Slim::Web::HTTP::closeHTTPSocket($httpClient);
}
main::INFOLOG && $log->is_info && $log->info("Requesting firmware from: $path");
downloadFirmwareFile(sub {