-
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-acme: improve UI for inexperienced users #7147
Draft
stokito
wants to merge
25
commits into
openwrt:master
Choose a base branch
from
stokito:luci-app-acme
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
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 28ec2b4
luci-app-acme: Move link out of translations
stokito 96495b6
luci-app-acme: introduction: remove LetsEncrypt mention
stokito b0d2426
luci-app-acme: introduction: clarify that ZeroSSL is by default
stokito abc07d5
luci-app-acme: acme_server: remove Let's Encrypt from title
stokito 6249c07
luci-app-acme: acme_server: add "See more" link
stokito 7706c6d
luci-app-acme: introduction: add link to OpenWrt Wiki
stokito 76ca13f
luci-app-acme: put validation_method above domains
stokito 99aea87
luci-app-acme: Validate domains
stokito 30f8b1b
luci-app-acme: show button "Install package acme-acmesh-dnsapi" if DN…
stokito 1e8a228
luci-app-acme: Guess the system domain and pre-fill it to domains.
stokito 8e86389
luci-app-acme: Import domains from DDNS
stokito 8ed4768
luci-app-acme: Add Log reader
stokito 30e8b84
luci-app-acme: Set default validation_method to standalone
stokito 86458bb
luci-app-acme: LetsEncrypt is default
stokito 94f551e
luci-app-acme: code style: Use <br />
stokito dc3c47d
luci-app-acme: ACL for /proc/sys/kernel/hostname
stokito ef59e3c
luci-app-acme: domains validate
stokito 35f4d1e
luci-app-acme: staging: show the flag only for letsencrypt
stokito c11d803
luci-app-acme: fix typo
stokito 3ff1564
luci-app-acme: fix _isFqdn() to not allow raw IPv4
stokito 6b4530d
luci-app-acme: remove the ZeroSSL mention
stokito c5a7289
luci-app-acme: DDNS import: check for duplicates
stokito faefaf1
luci-app-acme: DDNS import: also create a wildcard domain
stokito 7b3206d
luci-app-acme: wildcards * require Validation method: DNS
stokito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
}; | ||
} | ||
|
||
|
@@ -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, | ||
|
@@ -665,6 +657,45 @@ function _collectDdnsDomains() { | |
return ddnsDomains; | ||
} | ||
|
||
function _importDdns(ddnsDomains) { | ||
alert(_('After import check the added domain certificate configurations.')); | ||
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)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this |
||
} | ||
} | ||
} | ||
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)); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this
alert()