Support wildcard domains, instruct on CNAME value
This commit is contained in:
parent
2564b750e6
commit
bd15f45d1d
|
@ -27,17 +27,23 @@
|
||||||
<button type="submit">Next</button>
|
<button type="submit">Next</button>
|
||||||
</form>
|
</form>
|
||||||
<h3>Claims</h3>
|
<h3>Claims</h3>
|
||||||
|
<p>If your DNS host supports ANAME records, please use those instead of CNAMEs.</p>
|
||||||
|
<p>If CNAMEs are not supported, set an A record to {{ site.deviceDomainA }}.</p>
|
||||||
<ol>
|
<ol>
|
||||||
<li v-for="claim in claims">
|
<li v-for="claim in claims">
|
||||||
<span>{{ claim.value }}</span>
|
<span>{{ claim.value }}</span>
|
||||||
|
<br>
|
||||||
|
<span v-if="'dns' === claim.type">CNAME <span v-if="claim.wildcard">*.</span>{{ claim.value }}: {{ site.deviceDomain }}</span>
|
||||||
|
<br>
|
||||||
<span v-if="'dns' === claim.type">TXT _claim-challenge.{{ claim.value }}: {{ claim.challenge }}</span>
|
<span v-if="'dns' === claim.type">TXT _claim-challenge.{{ claim.value }}: {{ claim.challenge }}</span>
|
||||||
|
<br>
|
||||||
<button v-on:click.prevent="checkDns(claim)">Check</button>
|
<button v-on:click.prevent="checkDns(claim)">Check</button>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
<h3>Domains</h3>
|
<h3>Domains</h3>
|
||||||
<ol>
|
<ol>
|
||||||
<li v-for="domain in domains">
|
<li v-for="domain in domains">
|
||||||
{{ domain }}
|
<span v-if="domain.wildcard">*.</span>{{ domain.name }} <span v-if="domain.hostname">- {{domain.hostname}} ({{domain.os}} {{domain.arch}})</span>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
<pre><code v-text="token"></code></pre>
|
<pre><code v-text="token"></code></pre>
|
||||||
|
|
|
@ -17,6 +17,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var dnsRecords = {
|
||||||
|
"telebit.ppl.family": "178.128.3.196"
|
||||||
|
, "telebit.cloud": "46.101.97.218"
|
||||||
|
};
|
||||||
var vueData = {
|
var vueData = {
|
||||||
claims: []
|
claims: []
|
||||||
, domains: []
|
, domains: []
|
||||||
|
@ -25,17 +29,31 @@
|
||||||
, newEmail: null
|
, newEmail: null
|
||||||
, hasAccount: false
|
, hasAccount: false
|
||||||
, token: null
|
, token: null
|
||||||
|
, site: { deviceDomain: document.location.hostname, deviceDomainA: dnsRecords[document.location.hostname] }
|
||||||
};
|
};
|
||||||
var app = new Vue({
|
var app = new Vue({
|
||||||
el: '.v-app'
|
el: '.v-app'
|
||||||
, data: vueData
|
, data: vueData
|
||||||
, methods: {
|
, methods: {
|
||||||
challengeDns: function () {
|
challengeDns: function () {
|
||||||
|
// we could do a checkbox
|
||||||
|
var wildcard = vueData.newDomainWildcard || false;
|
||||||
|
if (!/(\*\.)?[a-z0-9][a-z0-9\.\-_]\.[a-z0-9]{2,}/.test(vueData.newDomain)) {
|
||||||
|
window.alert("invalid domain name '" + vueData.newDomain + "'");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// we can just detect by text
|
||||||
|
if ('*.' === vueData.newDomain.slice(0, 2)) {
|
||||||
|
vueData.newDomain = vueData.newDomain.slice(2);
|
||||||
|
wildcard = true;
|
||||||
|
}
|
||||||
return oauth3.request({
|
return oauth3.request({
|
||||||
url: 'https://api.' + location.hostname + '/api/telebit.cloud/account/authorizations/new'
|
url: 'https://api.' + location.hostname + '/api/telebit.cloud/account/authorizations/new'
|
||||||
, method: 'POST'
|
, method: 'POST'
|
||||||
, session: session
|
, session: session
|
||||||
, data: { type: 'dns', value: vueData.newDomain, wildcard: vueData.newDomainWildcard }
|
, data: { type: 'dns', value: vueData.newDomain, wildcard: wildcard }
|
||||||
|
}).then(function (resp) {
|
||||||
|
vueData.claims.unshift(resp.data.claim);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
, checkDns: function (claim) {
|
, checkDns: function (claim) {
|
||||||
|
|
Loading…
Reference in New Issue