Skip to content
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: improve UI for inexperienced users #7147

Draft
wants to merge 25 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4007313
luci-app-acme: dns_wait option
stokito Jun 1, 2024
28ec2b4
luci-app-acme: Move link out of translations
stokito Jun 1, 2024
96495b6
luci-app-acme: introduction: remove LetsEncrypt mention
stokito Jun 1, 2024
b0d2426
luci-app-acme: introduction: clarify that ZeroSSL is by default
stokito Jun 1, 2024
abc07d5
luci-app-acme: acme_server: remove Let's Encrypt from title
stokito Jun 1, 2024
6249c07
luci-app-acme: acme_server: add "See more" link
stokito Jun 1, 2024
7706c6d
luci-app-acme: introduction: add link to OpenWrt Wiki
stokito Jun 1, 2024
76ca13f
luci-app-acme: put validation_method above domains
stokito Jun 1, 2024
99aea87
luci-app-acme: Validate domains
stokito Jun 1, 2024
30f8b1b
luci-app-acme: show button "Install package acme-acmesh-dnsapi" if DN…
stokito Jun 1, 2024
1e8a228
luci-app-acme: Guess the system domain and pre-fill it to domains.
stokito Jun 1, 2024
8e86389
luci-app-acme: Import domains from DDNS
stokito Jun 1, 2024
8ed4768
luci-app-acme: Add Log reader
stokito Jun 1, 2024
30e8b84
luci-app-acme: Set default validation_method to standalone
stokito Jun 2, 2024
86458bb
luci-app-acme: LetsEncrypt is default
stokito Jun 3, 2024
94f551e
luci-app-acme: code style: Use <br />
stokito Jun 3, 2024
dc3c47d
luci-app-acme: ACL for /proc/sys/kernel/hostname
stokito Jun 3, 2024
ef59e3c
luci-app-acme: domains validate
stokito Jun 3, 2024
35f4d1e
luci-app-acme: staging: show the flag only for letsencrypt
stokito Jun 3, 2024
c11d803
luci-app-acme: fix typo
stokito Jun 4, 2024
3ff1564
luci-app-acme: fix _isFqdn() to not allow raw IPv4
stokito Jun 4, 2024
6b4530d
luci-app-acme: remove the ZeroSSL mention
stokito Jun 4, 2024
c5a7289
luci-app-acme: DDNS import: check for duplicates
stokito Jun 4, 2024
faefaf1
luci-app-acme: DDNS import: also create a wildcard domain
stokito Jun 4, 2024
7b3206d
luci-app-acme: wildcards * require Validation method: DNS
stokito Jun 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,7 @@ return view.extend({
o.inputtitle = _('Import') + ': ' + ddnsDomainsList.join();
o.inputstyle = 'apply';
o.onclick = function () {
for (let ddnsDomain of ddnsDomains) {
let sectionId = uci.add('acme', 'cert', ddnsDomain.name);
uci.set('acme', sectionId, 'domains', ddnsDomain.domains);
uci.set('acme', sectionId, 'validation_method', 'dns');
uci.set('acme', sectionId, 'dns', ddnsDomain.dnsApi);
uci.set('acme', sectionId, 'credentials', ddnsDomain.credentials);
}
uci.save();
window.location.reload();
_importDdns(ddnsDomains);
};
}

Expand Down Expand Up @@ -655,7 +647,7 @@ function _collectDdnsDomains() {
}
if (credentials.length > 0) {
ddnsDomains.push({
name: ddnsService['.name'],
sectionId: ddnsService['.name'],
domains: [ddnsService['domain']],
dnsApi: dnsApi,
credentials: credentials,
Expand All @@ -665,6 +657,45 @@ function _collectDdnsDomains() {
return ddnsDomains;
}

function _importDdns(ddnsDomains) {
alert(_('After import check the added domain certificate configurations.'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alert() is not a good way to send messages to the uses. Pretty sure luci has some way of adding messages, please use that instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this alert()

let certSections = uci.sections('acme', 'cert');
let certSectionNames = new Map();
let certSectionDomains = new Map();
for (let s of certSections) {
certSectionNames.set(s['.name'], null);
if (s.domains) {
for (let d of s.domains) {
certSectionDomains.set(d, s['.name']);
}
}
}
console.log(certSections);
console.log(certSectionDomains);
for (let ddnsDomain of ddnsDomains) {
let sectionId = ddnsDomain.sectionId;
// ensure unique sectionId
if (certSectionNames.has(sectionId)) {
sectionId += '_' + new Date().getTime();
}
if (ddnsDomain.domains) {
for (let d of ddnsDomain.domains) {
let dupDomainSection = certSectionDomains.get(d);
if (dupDomainSection) {
alert(_('The domain %s in DDNS %s already was configured in %s. Please check it after the import.').format(d, sectionId, dupDomainSection));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's already configured we should just skip it instead of bugging the user...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this alert()

}
}
}
uci.add('acme', 'cert', sectionId);
uci.set('acme', sectionId, 'domains', ddnsDomain.domains);
uci.set('acme', sectionId, 'validation_method', 'dns');
uci.set('acme', sectionId, 'dns', ddnsDomain.dnsApi);
uci.set('acme', sectionId, 'credentials', ddnsDomain.credentials);
}
uci.save();
window.location.reload();
}

function _addDnsProviderField(s, provider, env, title, desc) {
let o = s.taboption('challenge_dns', form.Value, '_' + env, _(title),
_(desc));
Expand Down
Loading