can download website
This commit is contained in:
parent
16f44e72ae
commit
65cbb5dae4
|
@ -158,7 +158,8 @@ app.controller('websiteCtrl', [
|
||||||
return -1 !== ('.' + sub).indexOf(('.' + domain));
|
return -1 !== ('.' + sub).indexOf(('.' + domain));
|
||||||
};
|
};
|
||||||
|
|
||||||
vm.createWebsite = function () {
|
vm.Sites = {};
|
||||||
|
vm.Sites.create = function () {
|
||||||
console.log('##### Auth.oauth3');
|
console.log('##### Auth.oauth3');
|
||||||
console.log(Auth.oauth3);
|
console.log(Auth.oauth3);
|
||||||
|
|
||||||
|
@ -269,6 +270,40 @@ app.controller('websiteCtrl', [
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
vm.createWebsite = vm.Sites.create;
|
||||||
|
vm.Sites.archive = function (r) {
|
||||||
|
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||||
|
|
||||||
|
return pkg.archive({
|
||||||
|
hostname: r.domain
|
||||||
|
, domain: r.domain
|
||||||
|
, tld: r.tld
|
||||||
|
, sld: r.sld
|
||||||
|
//, sub: vm.record.sub
|
||||||
|
//, path: vm.webPath
|
||||||
|
}).then(function (result) {
|
||||||
|
window.alert(JSON.stringify(result));
|
||||||
|
// TODO use iframe to initiate download?
|
||||||
|
window.open(result.data.url);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
vm.Sites.remove = function (r) {
|
||||||
|
if (!window.confirm("Delete files for this site?")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||||
|
return pkg.remove({
|
||||||
|
hostname: r.domain
|
||||||
|
, domain: r.domain
|
||||||
|
, tld: r.tld
|
||||||
|
, sld: r.sld
|
||||||
|
//, sub: vm.record.sub
|
||||||
|
//, path: vm.webPath
|
||||||
|
}).then(function (result) {
|
||||||
|
window.alert(JSON.stringify(result));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
vm.listSites = function () {
|
vm.listSites = function () {
|
||||||
var sites = [];
|
var sites = [];
|
||||||
|
@ -295,6 +330,8 @@ app.controller('websiteCtrl', [
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})).then(function () {
|
})).then(function () {
|
||||||
|
console.log('[www] sites');
|
||||||
|
console.log(sites);
|
||||||
vm.sites = sites;
|
vm.sites = sites;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,7 +11,7 @@ OAUTH3._pkgs['www@daplie.com'] = {
|
||||||
return OAUTH3.request({
|
return OAUTH3.request({
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
, url: OAUTH3.url.normalize(providerUri)
|
, url: OAUTH3.url.normalize(providerUri)
|
||||||
+ '/api/www@daplie.com/acl/add/' + opts.hostname
|
+ '/api/www@daplie.com/acl/sites/' + opts.hostname
|
||||||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, unzip: opts.unzip, strip: opts.strip, path: opts.path })
|
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, unzip: opts.unzip, strip: opts.strip, path: opts.path })
|
||||||
, session: session
|
, session: session
|
||||||
, multipart: opts.multipart // special property to be figured out by browser request code
|
, multipart: opts.multipart // special property to be figured out by browser request code
|
||||||
|
@ -19,6 +19,35 @@ OAUTH3._pkgs['www@daplie.com'] = {
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
, archive: function (opts) {
|
||||||
|
var providerUri = opts.audience;
|
||||||
|
var session = opts.session;
|
||||||
|
|
||||||
|
return OAUTH3.request({
|
||||||
|
method: 'POST'
|
||||||
|
, url: OAUTH3.url.normalize(providerUri)
|
||||||
|
+ '/api/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 })
|
||||||
|
, session: session
|
||||||
|
}).then(function (result) {
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
, remove: function (opts) {
|
||||||
|
var providerUri = opts.audience;
|
||||||
|
var session = opts.session;
|
||||||
|
|
||||||
|
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*/, path: opts.path })
|
||||||
|
, session: session
|
||||||
|
, multipart: opts.multipart // special property to be figured out by browser request code
|
||||||
|
}).then(function (result) {
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
}
|
||||||
, list: function (opts) {
|
, list: function (opts) {
|
||||||
var providerUri = opts.audience;
|
var providerUri = opts.audience;
|
||||||
var session = opts.session;
|
var session = opts.session;
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="r in vm.sites">
|
<tr ng-repeat="r in vm.sites">
|
||||||
<td><a ng-href="https://{{r.domain}}" target="_blank" ng-bind="r.domain">example.com</a></td>
|
<td><a ng-href="https://{{r.domain}}" target="_blank" ng-bind="r.domain">example.com</a> <button class="btn btn-link" ng-click="vm.Sites.archive(r)">download</button> <button class="btn btn-link" ng-click="vm.Sites.remove(r)">clear</button></td>
|
||||||
<td ng-bind="r.path">Sites > blogs > blog.jane.smith.net</td>
|
<td ng-bind="r.path">Sites > blogs > blog.jane.smith.net</td>
|
||||||
<td ng-bind="r.users">jane@smith.net, jack@smith.net, friend@gmail.com</td>
|
<td ng-bind="r.users">jane@smith.net, jack@smith.net, friend@gmail.com</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue