4365 Commits

Author SHA1 Message Date
Maxim Prokhorov
9ba2734878 debug(impl): reduce stack usage by not constructing sv
pass message + length to callbacks in all cases
2025-04-03 03:14:31 +03:00
Maxim Prokhorov
221f33566c webui: rebuild blobs 2025-04-03 03:02:12 +03:00
Maxim Prokhorov
a8756c7975 webui(ws): proper type of the callback container element
lists refer to plain funcs, std::func only applies to a single callback
namespace things yet again to fix the original implementation discrepancy
2025-04-03 03:01:05 +03:00
Maxim Prokhorov
cac3e84110 webui(ws): namespace for postponed callbacks 2025-04-03 02:32:38 +03:00
Maxim Prokhorov
7efb72c86e webui(ws): refactored payload storage
- introduce plain constructors for storage container
  pack std::func, vector pointer or vector itself in one union
  streamline main entry to accept just Storage{} instead of vector plus
  iterator stored currently
- allow postponed callback to set json buffer size
  set up small buffers for logging, no need to spawn 3KiB for one entry
  drop the last wsSend usage in onConnected in favour of a callback
- revert 'manual' for all and sequence implementation in favour
  of just one - for a single std::func callback
2025-04-03 02:24:39 +03:00
Maxim Prokhorov
2525d88b04 webui(server): headers helpers 2025-04-03 02:22:54 +03:00
Maxim Prokhorov
db84cdda5e webui(ws): try to contain wsSend to the queue callback
- 'log' payload nesting reduced, just one element (for now)
- move terminal and ws logger into ws helper classes
- 'manual' callback mode to simply allow for ws send window
  by using slightly more complicated loop w/ queue checks, though
2025-04-02 23:03:32 +03:00
Maxim Prokhorov
be46c3fd70 webui(build): rollback to gzip & fix content-encoding
br only works w/ https://... endpoint and abruptly fails on most (if not all) clients
fix gz -> gzip previously missed in the response header
2025-04-02 19:09:22 +03:00
Maxim Prokhorov
e9c4118e65 debug(api): explicit prefix and message lengths
also sometimes missing data checked in modules
2025-04-02 06:09:48 +03:00
Maxim Prokhorov
a7d084206b webui(server): export web & ws settings in the respective module
cors setup does not have to be in ws, move to web setup routine
actually set up ws auth setting, don't just report it in the ui
2025-04-02 05:37:47 +03:00
Maxim Prokhorov
6622c6d3ab webui(server): remove ws & web internal settings references to external modules
- provide 'prepend' option for ws callbacks, in addition to current 'append'
- move unintentional adminpass check under normal callbacks, do not
  break the on_keychecks iteration when adminpass key is present
- move key checks to their respective modules; reference existing key objects
2025-04-02 05:15:19 +03:00
Maxim Prokhorov
1f017adfd0 webui(server): clean-up response headers handling
immediately access the header object instead of check -> access-value
function for generic corb / xss headers for responses
2025-04-02 00:33:18 +03:00
Maxim Prokhorov
a18913358c webui(build): last-modified as .html build value, not .cpp
also convert strings at comptime, ensure strlen never gets called
2025-04-01 03:22:28 +03:00
Maxim Prokhorov
00c3df0954 webui(build): group test & build 2025-04-01 03:00:12 +03:00
Maxim Prokhorov
e890b0be76 webui(build): allow both gzip and br in the builder
- switch to 'br' by default. convert relevant file references in the web.cpp
  .h -> .ipp and drop compression type from the filename
  'webui_content_encoding' string to help out the server
- build options now include both minification and compression type
- make sure output file syntax is valid when opening it standalone
2025-04-01 03:00:08 +03:00
Maxim Prokhorov
078df05d7f webui(build): lint & test imported on-demand
minor speed-up when just building .html & .mjs
2025-03-31 21:01:27 +03:00
Maxim Prokhorov
9ccef13050 webui(build): vendor clone-stats & bump deps 2025-03-31 20:54:12 +03:00
Maxim Prokhorov
e4b5dcb232 webui(build): consistent zlib header mtime and os-code 2025-03-31 19:55:14 +03:00
Maxim Prokhorov
5c0c20d046 webui(build): cleanup ci & mention tools in the readme
no need to manually invoke things when gulpfile already does it
c/p commands into the readme to handle any other use case
2025-03-31 19:55:14 +03:00
Maxim Prokhorov
181c12d719 webui(build): include vitest runner 2025-03-31 19:55:14 +03:00
Maxim Prokhorov
151b2bcebc webui(build): clarify gulp commands and tasks tree 2025-03-31 19:55:14 +03:00
Maxim Prokhorov
8c52153c7d webui(build): generic err cleanup 2025-03-31 19:55:13 +03:00
Maxim Prokhorov
1ab136cbdf webui(build): error tracing for the file stream pipeline
usually, errors of the build script itself of b/c of file access

lint is called separately, only build errors would be shown
esbuild opts out of too much syntax checks, usually breaking js
execution instead and / or when referenced modules cannot be loaded
2025-03-31 19:55:13 +03:00
Maxim Prokhorov
f98565e528 webui(build): missing builder readme.md 2025-03-31 19:55:13 +03:00
Maxim Prokhorov
a6fa8c8d8b webui(build): lint javascript & html before gulp build
reproduce cli calls in js api, do not wait for ci to run these
2025-03-31 19:55:13 +03:00
Maxim Prokhorov
6acb8c5a16 webui(build): through2 -> node:stream Transform
drop local dependency on through2 in favour of node:stream
but, still ensure that things work for gulp-style File streams
2025-03-31 19:55:13 +03:00
Maxim Prokhorov
108ee655fe webui(build): pipeline instead of pipe
ref.
https://github.com/gulpjs/gulp/issues/2812
https://nodejs.org/en/learn/modules/how-to-use-streams#how-to-operate-with-streams
https://nodejs.org/en/learn/modules/how-to-use-streams#pipeline

while the gulp issue refers to this as a workaround, this is actually the
proper way to handle streams, merging streams and applying transformations

webserver code still spawns the pipe(line) unconditionally, though
2025-03-31 19:55:13 +03:00
Maxim Prokhorov
2d33cc8da1 webui(build): yet another vite server ghsa bump
ref. npm-audit-fix and https://github.com/advisories/GHSA-x574-m823-4x7w
note that vite server is not used in webui_serve
2025-03-31 19:55:13 +03:00
Maxim Prokhorov
6384955e04 webui(build): clone-stats override for node-22+
avoid deprecation warning from incorrectly cloned fs.Stats{}
https://www.npmjs.com/package/clone-stats-node22
2025-03-31 19:55:13 +03:00
Maxim Prokhorov
a593009fbd webui(settings): clarify dataset[...] and query for data-... 2025-03-31 19:55:13 +03:00
Maxim Prokhorov
0e4ae21368 webui(lint): explicit file patterns
eslint v9 replaces empty pattern list with a ['.']

ignore known directories when running locally
explicit paths for eslint in the ci script
2025-03-19 23:56:03 +03:00
Maxim Prokhorov
d16fd98006 webui(build): bump npm dependencies 2025-03-19 23:55:52 +03:00
Maxim Prokhorov
1112cf47c3 mqtt(common): missing header ref 2025-03-19 06:15:23 +03:00
Maxim Prokhorov
edd5481388 webui: rebuild blobs 2025-03-19 04:42:34 +03:00
Maxim Prokhorov
efffead793 webui(settings): datalist enumerable for ntp timezones
making use of the feature to programatically generate offset options
additionally, saves 38bytes in the resulting blob
2025-03-19 04:41:06 +03:00
Maxim Prokhorov
1d2503a19e webui(settings): enumerables for both datalist & select
generalize <options> handlers, providing same entrypoint for both
2025-03-19 04:40:05 +03:00
Maxim Prokhorov
f2153f4a38 webui(settings): allow string id mapping in enumerables
store names as {id: name, ...}, not [{id, name}, ...]
entries appear the same way, and js stores keys in the insertion order

fixup numbers converted to strings
fixup select options typing to accept [string, string] instead of [number, string]
2025-03-19 04:38:39 +03:00
Maxim Prokhorov
d7af980bdf test(webui): enumerables spec extended
minimum viable checks for ranges and manually created entries
listen to and trigger events for span & select enumerable elements
2025-03-19 00:05:16 +03:00
Maxim Prokhorov
faf58e9237 sns: allow sensor instance to provide slot id
implement i2c address as slot id for the current sensors
ref. #2639
2025-03-18 20:50:02 +03:00
Maxim Prokhorov
58181d21a3 sns: explicit static instantiation
avoid yet again falling for ambigious instantiation order
amends 5ff4efd513
2025-03-18 20:47:50 +03:00
Maxim Prokhorov
ceeccce0b1 sns: off-by-one errors
mod10 and mod100 should be inclusive (oops)

recover from post vs. pre increment mixup
offset when formatting, store as-is
2025-03-18 04:26:20 +03:00
Maxim Prokhorov
fe08a66819 sns: experiment with magnitude persistent id
ref. #2639

global slot to identify specific sensor+num+type+slot combination
for now, not used anywhere but terminal listing
2025-03-18 03:43:43 +03:00
Maxim Prokhorov
cfa17df261 test(dht): consistent values and types
mask magnitude for all branches, matched when inlining
accumulate values for checksum without type ambiguity
2025-03-07 15:54:00 +03:00
Maxim Prokhorov
e48dac27b5 test(a02yyu): sample data
https://github.com/xoseperez/espurna/pull/2622#issuecomment-2440181937
2025-03-07 15:08:03 +03:00
Maxim Prokhorov
f77544fbd8 test(dht): checksum and dht11 2025-03-06 00:40:00 +03:00
Maxim Prokhorov
4c3122c153 test: fix unused / uninitialized warnings 2025-03-05 23:23:10 +03:00
Maxim Prokhorov
40500b489f sns(dht): another dht22 variant w/ 12bit values 2025-03-05 23:02:13 +03:00
Maxim Prokhorov
7476793a53 sns(dht): dont overwrite dht22 sign bit 2025-03-05 22:12:42 +03:00
Maxim Prokhorov
abbf7218f4 webui(build): rename files inline
note node-22 currently harmless deprecation warning coming from vinyl-fs clone()
2025-03-05 19:09:03 +03:00
Maxim Prokhorov
93dbcb9e31 test(unity): unused function 2025-03-05 18:44:07 +03:00