-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
luci-app-adguardhome: Add new app #5853
base: master
Are you sure you want to change the base?
Conversation
What's missing is translations; I haven't worked out how to set up the master template for that yet. |
|
51d2f6a
to
a9ff41e
Compare
Thanks @jow- ; done and squashed in. |
ae97242
to
6e51693
Compare
6e51693
to
ace79f8
Compare
ace79f8
to
ac9827a
Compare
There is no integration into the web UI for AdGuard Home. This PR adds * A Lua script for rpcd to interface with the AGH REST API * ACL controls allowing JS code to call rpcd, uci, logread * Menu entries to put AdGuard Home under Services * Three UIs - status, logs, config The Lua script supports three API calls: * get_status - maps to /control/status in the AGH REST API * get_statistics - maps to /control/stats in the AGH REST API * get_config - converts /etc/adguardhome.yaml to JSON Authentication details must be provided by the user, as the password in the YAML file is encrypted. This results in the AGH password being stored cleartext in /etc/config/adguardhome. The Lua script will log if it encounters an error, in an effort to make it easier to debug. These logs are visible in the Logs UI of the application. I could not find any unit testing for things like the UI or the Lua code, so the only testing done was by hand. The credentials were removed from the config, and both the ubus call and the web UI render the failure to acquire the credentials. Incorrect credentials were supplied, and the UI was verified as showing a RPC error message. ACLs were checked by removing luci-compat.json (which wildcard allows saving/reading), and ensuring that the UI could read and save the config. Package was built and tested with ``` make package/luci-app-adguardhome/compile -j20 scp bin/packages/i386_pentium4/cricalixluci/luci-app-adguardhome_unknown_all.ipk root@192.168.0.1: ssh root@192.168.0.1 opkg remove luci-app-adguardhome && opkg install luci-app-adguardhome_unknown_all.ipk && rm luci-app-adguardhome_unknown_all.ipk ``` and then browsing the UI to make sure the deployment was clean and behaved as expected. Signed-off-by: Duncan Hill <openwrt-dev@cricalix.net>
ac9827a
to
3253c26
Compare
Can't this go in, as-is? |
I would have thought so, but apparently no one responsible for luci agrees (or has seen this PR). |
OK by me, if you commit to keeping this working. Have you verified this works with the latest (master, 23.05)? Could you please summarize what the LUA does? |
If possible, remove those merge commits, and just rebase your original commits onto a current master. |
ping @cricalix |
Yeah, back now. Christmas period was very busy with an international move in play. Let me work out how to remove merge commits; not used to Github/git - use Mercurial in my day-to-day work. Happy to keep it supported as LuCI/OpenWrt move onwards. What kind of clarification on the Lua do you want to see, and where (inline, README, other)? |
…t on 23.05, format code
|
@jow- are you OK with the lua dependency in the new luci package? |
If there are other preferred languages, I can probably rewrite the RPC portion (though it depends if I have to go learn that language first). At the time this was first offered, the example app and a lot of other apps used Lua for the RPC side. |
I also get the feeling that, to pass "Test formalities", I should probably just take all the code in this PR, export it out, and start a new PR with a single commit (and a pointer to this PR for discussion history). I don't see how I can fix the intermediate commits to have the right prefix, and a signed-off line. |
As far as I understand, the ucode or shell script are preferred as there's a goal of decreasing dependency on lua. I know the new luci apps are not accepted if the WebUI is written in lua, not sure what the policy is for use of lua in the RPCD scripts. |
I'd draw the line at fixes (ok) but not new features.
To be fair, I do not master either, so let testing be the judge.
This way the code should survive a decade until the next paradigm comes
along.
Perhaps legislation will change how ads happen and how they're tackled.
|
Parsing yaml in shell will be unfun. Ditto in ucode, which doesn't appear to have yaml support (given the origins, why would it?). Python would be trivial (if you're running AGH on OpenWrt, you're probably on a device with enough CPU to run a small Python script quickly enough). |
How about using yq? |
Hi @cricalix if you can amend your commits to correct the subject lines, we can merge this. Also remove merge commits, just rebase on master. |
Summary
There is no integration into the web UI for AdGuard Home. This PR adds
The Lua script supports three API calls:
Authentication details must be provided by the user, as the password in the YAML file is encrypted. This results in the AGH password being stored cleartext in /etc/config/adguardhome.
The Lua script will log if it encounters an error, in an effort to make it easier to debug. These logs are visible in the Logs UI of the application.
Testing
I could not find any unit testing for things like the UI or the Lua code, so the only testing done was by hand.
The credentials were removed from the config, and both the ubus call and the web UI render the failure to acquire the credentials.
Incorrect credentials were supplied, and the UI was verified as showing a RPC error message.
ACLs were checked by removing luci-compat.json (which wildcard allows saving/reading), and ensuring that the UI could read and save the config.
Package was built and tested with
and then browsing the UI to make sure the deployment was clean and behaved as expected.
Signed-off-by: Duncan Hill github.com@cricalix.net