Commit Graph

4206 Commits

Author SHA1 Message Date
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
Maxim Prokhorov
39f2fa14cc webui(build): bump esbuild & vitest 2025-03-05 18:44:06 +03:00
Maxim Prokhorov
12a6506905 webui(build): bump locked versions 2025-03-05 18:44:06 +03:00
Maxim Prokhorov
f984ec9dbc libs(delimiter): revert to shared iterator instance
old gcc compat, plus stl would work more nicely
2025-03-05 18:44:06 +03:00
Maxim Prokhorov
cc0f3b2d03 sns(dht): merge common dht11 & dht12 calculations
notice sign bit in both bytes, apply magnitude mask to integer & scale
nb. technically... dht11 shares dht12 format, but prefer to stay on the integer side
2025-03-05 18:13:33 +03:00
Maxim Prokhorov
305918d5d8 sns(dht): different number representations for dht22
sometimes sign-magnitude, sometimes twos-complement
resolve #2638
2025-03-05 18:13:33 +03:00
Maxim Prokhorov
ff6d86c7e5 light(color): fix stateful parser api 2025-03-05 18:13:33 +03:00
Maxim Prokhorov
edb458fac6 test(sch): fix utc offset 2025-03-05 18:13:33 +03:00
Maxim Prokhorov
5ff4efd513 test(sns): voltage magnitude should work 2025-03-05 18:13:33 +03:00
Maxim Prokhorov
180361a89d test: expected vs. actual stringified 2025-03-05 18:13:33 +03:00