summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/ucode
AgeCommit message (Collapse)Author
2024-03-17Revert "luci-base: force menu to regenerate after uci change"Hannu Nyman
This reverts commit 97ebdcbddb9cad76dc551086fcb887e55886a069. The commit seems to cause errors already before the login screen. Discussion in https://github.com/openwrt/luci/commit/97ebdcbddb9cad76dc551086fcb887e55886a069#commitcomment-139871175 Errors like: In error(), file [C] called from function [anonymous function] (/usr/lib/lua/luci/ucodebridge.lua:23) called from function ((tail call)) In [anonymous function](), file /usr/share/ucode/luci/runtime.uc, line 148, byte 45: called from function build_pagetree (/usr/share/ucode/luci/dispatcher.uc:382:73) called from function menu_json (/usr/share/ucode/luci/dispatcher.uc:439:26) called from function [anonymous function] (/usr/share/ucode/luci/dispatcher.uc:898:24) called from anonymous function (/www/cgi-bin/luci:39:13) ` return lcall.call(modname, method, ...args);` Near here ----------------------------------------^ Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2024-03-17luci-base: force menu to regenerate after uci changeJames Haggerty
Because the menu JSON can have 'depends' in them, uci changes should force the menu to regenerate. Closes #6423 Signed-off-by: James Haggerty <james.haggerty@morsemicro.com> Signed-off-by: Paul Donald <newtwen@gmail.com>
2024-02-09luci-base: update timezone data to 2024aHannu Nyman
Update timezone data to 2024a. https://mm.icann.org/pipermail/tz-announce/2024-February/000081.html Briefly: * Kazakhstan unifies on UTC+5 beginning 2024-03-01. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2024-01-06timezone data: update to 2023dHannu Nyman
Update timezone data to 2023d. https://mm.icann.org/pipermail/tz-announce/2023-December/000080.html Summary: * Ittoqqortoormiit, Greenland changes time zones on 2024-03-31. * Vostok, Antarctica changed time zones on 2023-12-18. * Casey, Antarctica changed time zones five times since 2020. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2023-08-21luci-base: http.uc: fix eof detection in temporary upload filesJo-Philipp Wich
Binary string comparisons in ucode are currently unsafe, so use the `length()` function to determine the just read data chunk size in order to test for end of file. Fixes: #6530 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-08-21luci-base: dispatcher.uc: improve error reporting for actionless nodesJo-Philipp Wich
In case a - potentially auto-created, intermediate - node is requested, reply with a clean HTTP 404 error instead of an internal assertion about an unknown action type. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-08-21luci-base: dispatcher.uc: satisfy auto-created intermediate nodesJo-Philipp Wich
When we auto-create intermediate parent nodes, make sure that those nodes are marked as satisfied, so that it is possible to dispatch their actual child nodes. This aligns the behavior with the old Lua based dispatcher implementation. Fixes: #6529 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-08-11luci-base: grammar fixesPaul Dee
Login (n) -> Log (v) in Logout (n) -> Log (v) out Signed-off-by: Paul Dee <itsascambutmailmeanyway@gmail.com>
2023-08-07luci-base: runtime.uc: fix error500() invocation on theme failureJo-Philipp Wich
In case no single theme could be loaded successfully, the runtime class failed to properly invoke the `error500()` method, which is only available through the passed environment at this point. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-08-07luci-base: dispatcher.uc: fix `N_()` fallback implementationJo-Philipp Wich
The fallback implementation of `N_()` accessed the wrong variable, a global `n` instead of the local `args`. Adjust the expression to reference the correct variable. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-08-07luci-base: dispatcher.uc: fix error500() reporting in fallback caseJo-Philipp Wich
Fix the `error500()` fallback code path to properly output the given error message in case rendering the error template failed. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-04-14luci-base: http.uc: fix reference error of undeclared variable `err`Tianling Shen
The variable `err` was used without initialized. Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2023-04-03timezone data: update to 2023cHannu Nyman
Update timezone data to 2023a, 2023b, 2023c. (2023c reverts 2023b.) https://mm.icann.org/pipermail/tz-announce/2023-March/000077.html https://mm.icann.org/pipermail/tz-announce/2023-March/000078.html https://mm.icann.org/pipermail/tz-announce/2023-March/000079.html Summary: * Egypt now uses DST again, from April through October. * Much of Greenland still uses DST from 2024 on. * America/Yellowknife now links to America/Edmonton. (removed here) * Europe/Kirov and Europe/Volgograd now use the abbreviations MSK/MSD Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2023-03-10luci-base: dispatcher.uc: prevent XSS through 404 error templateJo-Philipp Wich
Make sure to escape the user controlled URL passed as part of the error message into the error404 template in order to avoid XSS. Reported-by: 40826d <40826d@posteo.de> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-01-13luci-base: dispatcher.uc: urldecode URL componentsJo-Philipp Wich
In order to maintain compatibility with the old Lua runtime, ensure to URL decode the request path segments since they might end up as arguments to invoked action functions. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-12-01timezone data: update to 2022gHannu Nyman
Update timezone data to 2022g. * https://mm.icann.org/pipermail/tz-announce/2022-November/000076.html - In the Mexican state of Chihuahua, the border strip near the US will change to agree with nearby US locations on 2022-11-30. The strip's western part, represented by Ciudad Juárez, switches from -06 all year to -07/-06 with US DST rules, like El Paso, TX. The eastern part, represented by Ojinaga, will observe US DST next year, like Presidio, TX. - A new Zone America/Ciudad_Juarez splits from America/Ojinaga. - Much of Greenland, represented by America/Nuuk, stops observing winter time after March 2023, so its daylight saving time becomes standard time. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2022-11-25luci-base: only render theme specific sysauth template when it existsJo-Philipp Wich
Avoid displaying non-fatal "File not found" exceptions when a theme is not shipping an own sysauth template. Fixes: #6118 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-22luci-base: fix passing dispatched node details to templatesJo-Philipp Wich
Fixes: #6111 Fixes: 08ae8d40a9 ("luci-base, luci-lua-runtime: fix "dispatched" and "requested" properties") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-22luci-base: fix (again) rendering ucode templates in `template` targetJo-Philipp Wich
Fixes: #6111 Fixes: a5d21dadbd ("luci-base: fix rendering ucode templates from `template` target") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-22luci-base: fix rendering ucode templates from `template` targetJo-Philipp Wich
A previous commit inadvertently broke support for rendering ucode templates from the `template` dispatcher target. Fixes: #6111 Fixes: fa17c1573f ("luci-base, luci-lua-runtime: adjust Lua template environment") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-21luci-base, luci-lua-runtime: adjust Lua template environmentJo-Philipp Wich
To maintain full compatibility with the old Lua runtime, templates rendered from a menu `template()` action must implicitly inherit the `luci.dispatcher` namespace as scope while other indirectly included templates must not. Fixes: #6105 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-21luci-base, luci-lua-runtime: fix "dispatched" and "requested" propertiesJo-Philipp Wich
Ensure to properly emulate the "dispatched" and "requested" properties which refer to the executed and initially resolved menu node respectivey. Also stop exposing a `node` property in Lua context to maintain full compatibility with the old Lua runtime. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-21luci-base: expose sysauth rendering errorsJo-Philipp Wich
In case a theme shipped sysauth.htm failed to render/execute, expose the exception error details in the ui theme fallback indicator. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-03luci-base: fix empty reply format in ubus gateway fallback codeJo-Philipp Wich
The ubus gateway fallback code incorrectly formatted ubus replies containing no payload data when forwarding them via HTTP, leading to `TypeError: Unexpected reply data format` errors in at least the `luci.fs` class when receiving replies without payload. Fix this issue by ensuring that the result array never contains a `null` value for the payload, send an one-element array containing just the status code in this case instead. Fixes: #6074 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-03luci-base: dispatcher.uc: only flush HTTP headers after rendering outputJo-Philipp Wich
Ensure to first completely render the action function before flushing HTTP headers since the invoked action logic might modify the HTTP headers itself. Fixes: e7afd0d327 ("luci-base: fix luci.http.close()") Ref: https://github.com/openwrt/luci/commit/e7afd0d327bb35c502ca41a3c5e3ea098898fbd7#commitcomment-88736854 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-03luci-base: fix luci.http.close()Jo-Philipp Wich
Ensure that `http.write()` or template rendering operations after a call to `http.close()` do not produce additional output. This is required for certain legacy Lua apps which invoke write and close operations in the middle of a server side cbi rendering process. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-02luci-base: runtime.uc: avoid Lua not installed exeption from trycompile()Jo-Philipp Wich
Make sure to request loading the Lua bridge as optional when initializing the Lua VM context from trycompile() in order to not raise a fatal exception in case the Lua runtime support is not present. Ref: https://forum.openwrt.org/t/x/141426 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-02luci-base: dispatcher.uc: apply ACLs to menu tree JSONJo-Philipp Wich
Add menu tree annotations for node readonly and dependency satisfied state in order to ensure that unreachable menu nodes are hidden from view. Fixes: ded8ccf93e ("luci-base-ucode: add initial ucode based LuCI runtime") Ref: https://forum.openwrt.org/t/x/141426/10 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-02luci-base: http.uc: fix invoking Lua file upload callbacksJo-Philipp Wich
In case a callback is installed from Lua code, the received callback argument is not a callable function but a resource object with a call method. Attempts to call it will leading to a `Type error: left-hand side is not a function` error. To solve this issue, invoke the internally set filehandler instead which wraps the resource if needed. Fixes: #6067 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-31timezone data: update to 2022fHannu Nyman
Update timezone data to 2022f. * http://mm.icann.org/pipermail/tz-announce/2022-October/000075.html - Mexico will no longer observe DST after 2022, except for areas near the US border that continue to observe US DST rules. On 2022-10-30 at 02:00 the Mexican state of Chihuahua moves from -07 (-06 with DST) to year-round -06. - Fiji will not observe DST in 2022/3. For now, assume DST is suspended indefinitely. - Simplify four Ontario zones. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2022-10-27luci-base: add ui indicator when fallback theme is usedJo-Philipp Wich
Add a ui indicator displaying error details when the configured theme failed to load and the next available one is being used instead. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-27luci-base: dispatcher.uc: update uci session ID in Lua contextJo-Philipp Wich
Make sure that the uci session ID of the `luci.model.uci` module within the Lua context is updated once we acquire the login session information. In case legacy themes are used, the probing of the theme header template might indirectly load the Lua runtime and the Lua side `luci.dispatcher` module which in turn will load the `luci.model.uci` and set the session ID there which is not yet initialized at this point in time. This results in broken uci change handling within legacy Lua applications when a legacy theme is loaded. Fixes: #6060 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-25luci-base: dispatcher.uc: ensure usage of dashes in language tagsJo-Philipp Wich
The LuCI uci configuration requires language tags with underscores due limitations of uci option names but the language catalogs themselves are designated with dash separated language tags. Make sure to substitute underscores with dashes when determining the desired request language in order to fix loading of languages such as `pt-br` or `zh-cn`. Ref: https://github.com/openwrt/luci/pull/5976#issuecomment-1290352951 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-25luci-base: dispatcher.uc: reintroduce support for 'absent' fs dependsJo-Philipp Wich
The ability to require certain paths to be absent for a menu entry to show up was lost during the ucode conversion. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-25luci-base: sys.uc: reliably skip TIME_WAIT connections in conntrack listJo-Philipp Wich
The TIME_WAIT indicator might not appear at the beginning of the tuple string in some cases, so match it anywhere. Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> [add commit message] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-25luci-base: sys.uc: fix parsing conntrack listJo-Philipp Wich
Ensure that the extracted tuple string starts with a space to fully match all contained key-value pairs. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-25luci-base: sys.uc: increase init script START/STOP search spaceJo-Philipp Wich
Some init scripts, such as the sysfsutils one, declare their START or STOP variables very late in the file. Duplicate the search buffer to 2048 byte in order to catch these cases. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-25luci-base: dispatcher.uc: support `cbi` and `form` action typesJo-Philipp Wich
Some existing LuCI apps ship menu.d JSON files with `cbi` and `form` typed dispatch targets, support those as well. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-25treewide: separate Lua runtime resourcesJo-Philipp Wich
Move classes required for Lua runtime support into a new `luci-lua-runtime` package. Also replace the `luci.http` and `luci.util` classes in `luci-lib-base` with stubbed versions interacting with the ucode based runtime environment. Finally merge `luci-base-ucode` into the remainders of `luci-base`. Signed-off-by: Jo-Philipp Wich <jo@mein.io>