ability to upload file (without unpacking) to arbitrary locations

This commit is contained in:
aj 2017-08-23 22:12:57 +00:00
parent 3ba63bc818
commit 16f44e72ae
2 changed files with 39 additions and 11 deletions

View File

@ -87,6 +87,14 @@ app.controller('websiteCtrl', [
if (!vm.domain) { if (!vm.domain) {
vm.domain = { domain: vm.newDomain }; vm.domain = { domain: vm.newDomain };
} }
if (!vm.domain.tld) {
var parts = vm.domain.domain.split('.');
vm.domain.sld = parts.shift();
vm.domain.tld = parts.join('.');
}
vm.setRecord();
}; };
vm.selectDomain = function (domain) { vm.selectDomain = function (domain) {
@ -110,6 +118,20 @@ app.controller('websiteCtrl', [
}); });
}; };
vm.setRecord = function () {
// TODO set record based on (record.host === sub + domain.domain)
var sub = vm.newRecord;
if ('@' === sub) {
sub = '';
}
vm.record = { sub: sub, host: (sub ? sub + '.' : '') + vm.domain.domain };
vm.currentHost = vm.record.host;
console.log('vm.record', vm.record);
console.log('vm.currentHost', vm.currentHost);
};
vm.selectRecord = function (record) { vm.selectRecord = function (record) {
vm.record = record; vm.record = record;
vm.newRecord = record.sub; vm.newRecord = record.sub;
@ -160,17 +182,15 @@ app.controller('websiteCtrl', [
return; return;
} }
// already validated
if (vm.sites.some(function (r) {
return -1 !== ('.' + vm.currentHost).indexOf(('.' + r.domain));
})) {
vm._createWebsite(pkg);
}
if (vm.domain) { if (vm.domain) {
parts = vm.domain.domain.split('.'); if (!vm.domain.tld || !vm.domain.sld) {
sld = parts.shift(); parts = vm.domain.domain.split('.');
tld = parts.join('.'); sld = parts.shift();
tld = parts.join('.');
} else {
sld = vm.domain.sld;
tld = vm.domain.tld;
}
} else { } else {
parts = vm.currentHost.split('.'); parts = vm.currentHost.split('.');
// TODO get list of tlds // TODO get list of tlds
@ -179,6 +199,14 @@ app.controller('websiteCtrl', [
sub = parts.join('.'); sub = parts.join('.');
} }
// already validated
if (vm.sites.some(function (r) {
return -1 !== ('.' + vm.currentHost).indexOf(('.' + r.domain));
})) {
vm._createWebsite(pkg);
return;
}
// We're making a request to claim a domain // We're making a request to claim a domain
// (because two users could both claim a single domain) // (because two users could both claim a single domain)
// We're claiming it at the top level (i.e. example.com) // We're claiming it at the top level (i.e. example.com)

View File

@ -7,7 +7,7 @@ OAUTH3._pkgs['www@daplie.com'] = {
add: function (opts) { add: function (opts) {
var providerUri = opts.audience; var providerUri = opts.audience;
var session = opts.session; var session = opts.session;
debugger;
return OAUTH3.request({ return OAUTH3.request({
method: 'POST' method: 'POST'
, url: OAUTH3.url.normalize(providerUri) , url: OAUTH3.url.normalize(providerUri)