After updating the JS-part of any package, the user is forced to clear the browser cache.
Proposed Solution
Add the version of the ipk-package to which the file belongs to the JS-file name.
Instead, all JS-files are now appended with a common version of LuCI.
All files in the package are known. The version is also known:
root@OpenWrt:# opkg files luci-app-zapret
Package luci-app-zapret (66-20241025) is installed on root and has the following files:
/www/luci-static/resources/view/zapret/service.js
/www/luci-static/resources/view/zapret/settings.js
/usr/share/rpcd/acl.d/luci-app-zapret.json
/www/luci-static/resources/view/zapret/tools.js
/usr/share/luci/menu.d/luci-app-zapret.json
root@OpenWrt:# opkg info luci-app-zapret
Package: luci-app-zapret
Version: 66-20241025
Depends: libc, zapret
Status: install user installed
Architecture: all
Installed-Time: 1729956777
Each time a package is removed or installed, the contents of the /usr/lib/opkg/status file are changed.
That's why I decided to add the modification time of the /usr/lib/opkg/status file to the version of the main LuCI package (luci-base).
On the snapshot, instead of file /usr/lib/opkg/status, there is file /lib/apk/db/installed.
Its contents also change after removing and installing packages.
Therefore, it is very easy to adapt my patch for apk.
Fixing this caching problem is a bit of chicken or egg problem. Going for the cache busting string is a good move, but perhaps something can be done on the luci JS side by simply checking for the last update time of either of those files in a promise, which when resolved, completes the string.