-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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-acme: render DNS API fields from the Structured Info #7515
base: master
Are you sure you want to change the base?
Conversation
d873254
to
2735988
Compare
Use for of. Use let instead of var. Fix missing ; Make load to return an array of promises. Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
The ACME.sh scripts have a description of all options. In preparation to use it include it generated into the app itself and render. Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2735988
to
8e27306
Compare
Neat! Feels like the dnsapi.info.txt file should be part of the acme.sh package, not the luci app, though? Also, AFAICT the parser is not terribly robust against malformed entries (judging from the unconditional shift() calls)? Not sure how the javascript runtime will handle failures, but IMO the parser should be smart enough to just skip malformed entries instead of aborting the whole thing (which is what I'm assuming will happen if the code throws an exception?). |
Use JSON, whose handling is far more well-defined. But no, a more opaque format, so everything can be done in (ba)sh. Doesn't really matter where the file is, repo-wise, but if the GUI is the only thing that depends on it, here is its home. |
The full parser with some tests is located here https://github.com/yurt-page/acmesh-parse-dnsapi-info Right now we parsing own file that is 100% correct. Even now it will always parse to at least api Id and Name. I'll try to check it later to improve error handling, maybe half of the parser can be replaced with a regexp :) In the PR I added a stripped info version 16 Kb. Maybe we can convert to JSON in shell but it's easier to do in JS, especially that we don't need for a full parsing (with Issues, Author fields). |
The main thing I'm after from a robustness perspective is that a malformed entry will just be skipped, but not interfere with the parsing of the rest of the file. Should be pretty straight forward to add a test for that :)
I don't have a strong opinion about whether the file should generated as JSON at build time, or just be a concatenation of the definitions from the plugin files as you are doing now. But the "at build time" thing is important, IMO. I.e., the file should not be manually generated and included in the Luci package, it should be generated at build time of the acme-acmesh-dnsapi package and included in that package. Otherwise we have to manually keep the list of providers in sync between the two packages, and avoiding that is (presumably) the whole point of having an automatic parser in the first place :) |
The parsing is lenient. It may potentially improved for a future when we switch to the parsing of extracted info directly from scripts. The acme.sh already made a release that contains the dnsinfo so actually we do can update the package and switch to extracting. There was some minor problems and I fixed and reviewed all of them so after the next acmesh release we can switch to extracting. The PR can be merged today. |
Hmm, but why do it in this order? Seems to me that getting the extraction bits in place first, and the merging this afterwards makes more sense? :) |
I'm not sure where the acmesh will be released and the current released version has some minor issues in the infos.
But we can deliver one part today and the second later.
|
Maintainer: @tohojo
To show fields specific to a DNS API provider I made a list of all options and included them directly into the JS file.
The upcoming ACME.sh release all scripts now contain a Structured Info with list of options:
So once release we can make an RPC call to gather the info for all providers right from scripts and render it.
The PR adds the parsing and rendering part. Once the acmesh will be updated in the OpenWrt we can include the script and RPC call.
For now I just generated it and included as a file (slightly stripped to keep disk space).
We might use the file converted to a JSON but the info is really big and it's takes much less space and ram to have a JS parser right on UI.
CC @hgl @systemcrash @dannil @IamRPDev