almost got it.
This commit is contained in:
parent
d0ea91c0bb
commit
3bcc504ab2
|
@ -129,7 +129,6 @@ app.controller('websiteCtrl', [
|
|||
};
|
||||
|
||||
vm.setDomain = function () {
|
||||
debugger;
|
||||
if (!vm.domains || !vm.domains.length) {
|
||||
vm.domain = { domain: vm.newDomain };
|
||||
return;
|
||||
|
@ -180,7 +179,6 @@ app.controller('websiteCtrl', [
|
|||
vm.setRecordDomain = function(domain) {
|
||||
vm.domain.sub = vm.newRecord || '';
|
||||
if (vm.record !== undefined) {
|
||||
debugger;
|
||||
domain.title = vm.record.host;
|
||||
domain.description.domain = vm.record.host;
|
||||
domain.originalObject.domain = vm.record.host;
|
||||
|
@ -245,7 +243,7 @@ app.controller('websiteCtrl', [
|
|||
, domain: opts.domain
|
||||
, tld: opts.tld
|
||||
, sld: opts.sld
|
||||
//, sub: opts.record.sub
|
||||
, sub: opts.sub
|
||||
, multipart: { site: opts.newFile }
|
||||
, progress: function (ev) {
|
||||
// TODO must digest
|
||||
|
@ -299,6 +297,7 @@ app.controller('websiteCtrl', [
|
|||
return;
|
||||
}
|
||||
*/
|
||||
debugger;
|
||||
if (!vm.newFile) {
|
||||
window.alert('No file chosen.');
|
||||
return;
|
||||
|
@ -324,6 +323,7 @@ app.controller('websiteCtrl', [
|
|||
sld = parts.pop();
|
||||
sub = parts.join('.');
|
||||
}
|
||||
|
||||
if (vm.sites.some(function (r) {
|
||||
return (-1 !== ('.' + vm.currentHost).indexOf(('.' + r.domain))) && domainIsVerified(r);
|
||||
})) {
|
||||
|
@ -336,10 +336,12 @@ app.controller('websiteCtrl', [
|
|||
// We're claiming it at the top level (i.e. example.com)
|
||||
// but we could also claim it at the subdomain level (needs UI update)
|
||||
var domainReq = { sld: sld, tld: tld, sub: sub };
|
||||
debugger;
|
||||
return pkg.request(domainReq).then(function (result) {
|
||||
var sess;
|
||||
var prom;
|
||||
var def;
|
||||
var sub;
|
||||
|
||||
// can validate automatically
|
||||
if (vm.domain.session && vm._isSubDomain(vm.currentHost, vm.domain.domain)) {
|
||||
|
@ -353,7 +355,11 @@ app.controller('websiteCtrl', [
|
|||
|
||||
if (sess) {
|
||||
prom = Auth.get(sess).then(function (oauth3) {
|
||||
return oauth3.api('dns.set', { sld: sld, tld: tld, sub: ('' + result.data.prefix), type: 'TXT', ttl: 300, value: result.data.challenge });
|
||||
sub = result.data.prefix;
|
||||
if (result.data.sub) {
|
||||
sub = result.data.sub + '.' + result.data.prefix;
|
||||
}
|
||||
return oauth3.api('dns.set', { sld: sld, tld: tld, sub: sub, type: 'TXT', ttl: 5, value: result.data.challenge });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -715,18 +721,18 @@ app.controller('websiteCtrl', [
|
|||
if (!window.confirm("Delete this site?")) {
|
||||
return;
|
||||
}
|
||||
s.sharePath = '/';
|
||||
vm.Shares.remove(r, s);
|
||||
};
|
||||
|
||||
vm.Shares.remove = function (r, s) {
|
||||
console.log('Shares.remove');
|
||||
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||
return pkg.removeShare({
|
||||
domain: s.domain
|
||||
, hostname: s.domain
|
||||
, tld: s.tld
|
||||
, sld: s.sld
|
||||
//, sub: r.sub
|
||||
, sub: r.sub
|
||||
, path: s.sharePath
|
||||
, challenge: s.challenge
|
||||
}).then(function (result) {
|
||||
|
@ -737,6 +743,7 @@ app.controller('websiteCtrl', [
|
|||
console.log(result);
|
||||
var index;
|
||||
|
||||
if (r.sharedWith !== undefined) {
|
||||
r.sharedWith.forEach(function (_s, i) {
|
||||
if (s.challenge === _s.challenge) {
|
||||
index = i;
|
||||
|
@ -745,6 +752,7 @@ app.controller('websiteCtrl', [
|
|||
|
||||
r.sharedWith.splice(index, 1);
|
||||
//r.usersnames = r.sharedWith.map().join(',');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ OAUTH3._pkgs['www@daplie.com'] = {
|
|||
, url: OAUTH3.url.normalize(providerUri)
|
||||
+ '/api/www@daplie.com/acl/sites/' + opts.hostname
|
||||
+ '?' + OAUTH3.utils.query.stringify({
|
||||
tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, unzip: opts.unzip
|
||||
tld: opts.tld, sld: opts.sld, sub: opts.sub, unzip: opts.unzip
|
||||
, strip: opts.strip, path: opts.path
|
||||
})
|
||||
, session: session
|
||||
|
@ -28,7 +28,7 @@ OAUTH3._pkgs['www@daplie.com'] = {
|
|||
|
||||
return OAUTH3.url.normalize(providerUri.replace(/api\./, 'assets.'))
|
||||
+ '/assets/www@daplie.com/acl/archives/' + opts.hostname
|
||||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, strip: opts.strip, path: opts.path })
|
||||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld, sub: opts.sub, strip: opts.strip, path: opts.path })
|
||||
;
|
||||
}
|
||||
, listShares: function (opts) {
|
||||
|
@ -40,7 +40,7 @@ OAUTH3._pkgs['www@daplie.com'] = {
|
|||
method: 'GET'
|
||||
, url: OAUTH3.url.normalize(providerUri)
|
||||
+ '/api/www@daplie.com/acl/shares/' + (opts.domain || opts.hostname)
|
||||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, path: opts.path })
|
||||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld, sub: opts.sub, path: opts.path })
|
||||
, session: session
|
||||
}).then(function (result) {
|
||||
return result;
|
||||
|
@ -49,13 +49,14 @@ OAUTH3._pkgs['www@daplie.com'] = {
|
|||
, removeShare: function (opts) {
|
||||
var providerUri = opts.audience;
|
||||
var session = opts.session;
|
||||
debugger;
|
||||
|
||||
// TODO needs a way to have api and assets for audience
|
||||
return OAUTH3.request({
|
||||
method: 'DELETE'
|
||||
, url: OAUTH3.url.normalize(providerUri)
|
||||
+ '/api/www@daplie.com/acl/shares/' + (opts.domain || opts.hostname) + '/' + (opts.challenge || opts.token)
|
||||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, path: opts.path })
|
||||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld, sub: opts.sub, path: opts.path })
|
||||
, session: session
|
||||
}).then(function (result) {
|
||||
return result;
|
||||
|
@ -93,7 +94,7 @@ OAUTH3._pkgs['www@daplie.com'] = {
|
|||
method: 'POST'
|
||||
, url: OAUTH3.url.normalize(providerUri)
|
||||
+ '/api/www@daplie.com/acl/shares/accept/' + opts.token
|
||||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/ })
|
||||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld, sub: opts.sub })
|
||||
, session: session
|
||||
}).then(function (result) {
|
||||
return result;
|
||||
|
@ -134,7 +135,7 @@ OAUTH3._pkgs['www@daplie.com'] = {
|
|||
method: 'GET'
|
||||
, url: OAUTH3.url.normalize(providerUri)
|
||||
+ '/api/www@daplie.com/acl/fs/' + opts.hostname
|
||||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, path: opts.path })
|
||||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld, sub: opts.sub, path: opts.path })
|
||||
, session: session
|
||||
}).then(function (result) {
|
||||
return result;
|
||||
|
@ -148,7 +149,7 @@ OAUTH3._pkgs['www@daplie.com'] = {
|
|||
method: 'GET'
|
||||
, url: OAUTH3.url.normalize(providerUri)
|
||||
+ '/api/www@daplie.com/acl/fs/' + opts.hostname
|
||||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, path: opts.path
|
||||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld, sub: opts.sub, path: opts.path
|
||||
, offset: opts.offset, length: opts.length, json: true })
|
||||
, session: session
|
||||
}).then(function (result) {
|
||||
|
@ -158,13 +159,14 @@ OAUTH3._pkgs['www@daplie.com'] = {
|
|||
, remove: function (opts) {
|
||||
var providerUri = opts.audience;
|
||||
var session = opts.session;
|
||||
debugger;
|
||||
|
||||
return OAUTH3.request({
|
||||
method: 'DELETE'
|
||||
, url: OAUTH3.url.normalize(providerUri)
|
||||
+ '/api/www@daplie.com/acl/sites/' + opts.hostname
|
||||
+ '?' + OAUTH3.utils.query.stringify({
|
||||
tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/
|
||||
tld: opts.tld, sld: opts.sld, sub: opts.sub
|
||||
, path: opts.path, confirm: opts.confirm
|
||||
})
|
||||
, session: session
|
||||
|
@ -202,7 +204,6 @@ OAUTH3._pkgs['www@daplie.com'] = {
|
|||
, session: session
|
||||
}).then(function (result) {
|
||||
// result.data
|
||||
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue