list contents of site

This commit is contained in:
aj 2017-08-31 07:42:59 +00:00
parent a0b5076dc5
commit f33ea552b4
4 changed files with 55 additions and 2 deletions

@ -1 +1 @@
Subproject commit 7bb0fca116e8bce239be5e3a5b99eac9e3c1cf8b Subproject commit 1fe8733a064c55024bc384691813772d4c94665d

View File

@ -296,6 +296,19 @@ app.controller('websiteCtrl', [
window.alert(JSON.stringify(result)); window.alert(JSON.stringify(result));
}); });
}; };
vm.Sites.contents = function (r) {
var pkg = Auth.oauth3.pkg('www@daplie.com');
return pkg.contents({
hostname: r.domain
, domain: r.domain
, tld: r.tld
, sld: r.sld
//, sub: vm.record.sub
, path: r.newPath
}).then(function (result) {
window.alert(JSON.stringify(result));
});
};
vm.listSites = function () { vm.listSites = function () {
var sites = []; var sites = [];

View File

@ -20,6 +20,27 @@ OAUTH3._pkgs['www@daplie.com'] = {
return result; return result;
}); });
} }
, archiveUrl: function (opts) {
var providerUri = opts.audience;
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 })
;
}
, download: function (opts) {
var session = opts.session;
var me = this;
// TODO needs a way to have api and assets for audience
return OAUTH3.request({
method: 'GET'
, url: me.archiveUrl
, session: session
}).then(function (result) {
return result;
});
}
, archive: function (opts) { , archive: function (opts) {
var providerUri = opts.audience; var providerUri = opts.audience;
var session = opts.session; var session = opts.session;
@ -34,6 +55,20 @@ OAUTH3._pkgs['www@daplie.com'] = {
return result; return result;
}); });
} }
, contents: function (opts) {
var providerUri = opts.audience;
var session = opts.session;
return OAUTH3.request({
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 })
, session: session
}).then(function (result) {
return result;
});
}
, remove: function (opts) { , remove: function (opts) {
var providerUri = opts.audience; var providerUri = opts.audience;
var session = opts.session; var session = opts.session;

View File

@ -84,7 +84,12 @@
<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> <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><a ng-href="https://{{r.domain}}" target="_blank" ng-bind="r.domain">example.com</a>
<a ng-href="{{r.download}}" target="_blank">download</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>
<input type="text" ng-model="r.newPath" /> <button class="btn btn-link" ng-click="vm.Sites.contents(r)">show</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>