acme.sh
acme.sh copied to clipboard
Structured DNS provider API info
For the OpenWrt luci-app-acme we need to show on UI list of all DSN providers and their options. My goal is to make regular users to use it without knowing anything about console.
For now I just put a list of all providers into a select https://github.com/openwrt/luci/blob/master/applications/luci-app-acme/htdocs/luci-static/resources/view/acme.js#L97
And also I collected list of all options per provider and rendering input fields for them: https://github.com/openwrt/luci/blob/master/applications/luci-app-acme/htdocs/luci-static/resources/view/acme.js#L243
This makes it fragile because once a new DNS provider is added or changed I have to update the LUCI app.
Instead we need a way to get list of all options.
So my idea is to make a new command like acme.sh --dns-provider-info
that will print all options. Then I can parse them and render.
The info is stored in plain string and it's both human readable and easy to parse.
dns_example_info='API name
An extended description.
Site: the dns provider website e.g. example.com
Docs: Link to ACME.sh wiki for the provider
Options:
VARIABLE Title for the option. Optional. Description.
Issues: Link to https://github.com/acmesh-official/acme.sh
Author: First Lastname <[email protected]>
'
Some providers may have alternative names or domains e.g. Aliyun
and AlibabaCloud
so for them I added a Domains:
section.
Please tell me if you will accept the PR and I will continue for other providers.
@github-actions
Done
Hi @Neilpang sorry for pushing but please let me know if you'll accept the PR. I want to finish all opened tasks.
It seems not bad, but you will have to update all the almost near 200 dns providers. Are you sure?
No problem.
@Neilpang I added the structured info to all DNS providers.
There is no any impact on existing functionality so you please merge it.
The extracting of the info from a command line --dns-provider-info
is not implemented yet.
I can do that later in a separate PR but maybe this should be implemented by you.
@Neilpang I rebased on top of the dev branch and reviwed again. Now it should be better. Please merge
Hi @Neilpang please have a look
Hi @Neilpang sorry for pushing but this issue blocks me because I want to update GUI for acme in the luci-app-acme based on this functionality. Here I wrote a script (dash and ash complient) to generate a list of all infos:
#!/bin/ash
for f in ./dnsapi/dns_*.sh
do
filename=$(basename -- "$f")
dns_api="${filename%.*}"
echo "$dns_api"
dns_api_info_var="${dns_api}_info"
# shellcheck source=./dnsapi/dns_*.sh
. "$f"
info=""
eval info=\$$dns_api_info_var
echo "$info"
done
I executed it and stored result to info.txt file:
sh ./dns_info.sh > info.txt
The resulted file has size of 38kb bytes and gziped it's 9kb.
Basically it would be really great to put the info a separate txt file.
For example dns_1984hosting.sh and dns_1984hosting_info.txt.
Then to get list of all params we can just make cat *_info.txt
.
Also for limited embedded devices we can not include the info files into a package to save space.
Please tell me if you ok to store the info into a separate text file. Then I'll change the PR. This can double size of files but it should worth it.
For now I'm going to just include the info.txt file into the luci-app-acme and parse it in JS on a broswer side.
Here I wrote a parser: https://gist.github.com/stokito/f0770d1967e7000bc0302b5556529fb1
Hi @Neilpang I updated the PR and fixed merge conflict. Please merge it before new conflicts happen