can share a site with others
This commit is contained in:
parent
f33ea552b4
commit
3a36bd1f61
|
@ -1 +1 @@
|
|||
Subproject commit 1fe8733a064c55024bc384691813772d4c94665d
|
||||
Subproject commit db284fbf911dc4f9d0cb99bb512d9663dcfd0ece
|
|
@ -27,6 +27,7 @@
|
|||
<script src="/assets/oauth3.org/oauth3.dns.js" charset="utf-8"></script>
|
||||
<script src="/assets/oauth3.org/oauth3.domains.js" charset="utf-8"></script>
|
||||
<script src="/js/www@daplie.com.js" charset="utf-8"></script>
|
||||
<script src="/js/email@daplie.com.js" charset="utf-8"></script>
|
||||
<!-- Angular Modules -->
|
||||
<script src="/js/lib/angular/angular.min.js" charset="utf-8"></script>
|
||||
<script src="/js/lib/angular/angular-local-storage.js" charset="utf-8"></script>
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
app.controller('emailCtrl', [
|
||||
'$scope',
|
||||
function($scope) {
|
||||
'$scope', '$q', 'Auth', 'azp@oauth3.org', '$timeout'
|
||||
, function ($scope, $q, Auth, Oauth3, $timeout) {
|
||||
var vm = this;
|
||||
}]);
|
||||
|
||||
vm.getSettings = function () {
|
||||
var pkg = Auth.oauth3.pkg('email@daplie.com');
|
||||
return pkg.settings().then(function (resp) {
|
||||
vm.settings.service = 'mailgun.org';
|
||||
vm.settings = resp.data;
|
||||
});
|
||||
};
|
||||
|
||||
vm.getSettings();
|
||||
}
|
||||
]);
|
||||
|
|
|
@ -303,13 +303,38 @@ app.controller('websiteCtrl', [
|
|||
, domain: r.domain
|
||||
, tld: r.tld
|
||||
, sld: r.sld
|
||||
//, sub: vm.record.sub
|
||||
//, sub: r.sub
|
||||
, path: r.newPath
|
||||
}).then(function (result) {
|
||||
window.alert(JSON.stringify(result));
|
||||
});
|
||||
};
|
||||
|
||||
vm.Shares = {};
|
||||
vm.Shares.invite = function (r) {
|
||||
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||
return pkg.invite({
|
||||
email: r.shareEmail
|
||||
, domain: r.domain
|
||||
, tld: r.tld
|
||||
, sld: r.sld
|
||||
//, sub: r.sub
|
||||
, path: r.sharePath
|
||||
, mode: r.shareMode
|
||||
}).then(function (result) {
|
||||
window.alert(JSON.stringify(result));
|
||||
});
|
||||
};
|
||||
vm.Shares.accept = function () {
|
||||
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||
return pkg.acceptInvite({
|
||||
token: vm.Shares.inviteToken
|
||||
}).then(function (result) {
|
||||
window.alert(JSON.stringify(result));
|
||||
vm.listSites();
|
||||
});
|
||||
};
|
||||
|
||||
vm.listSites = function () {
|
||||
var sites = [];
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
;(function (exports) {
|
||||
'use strict';
|
||||
|
||||
var OAUTH3 = exports.OAUTH3 = exports.OAUTH3 || require('./oauth3.core.js').OAUTH3;
|
||||
|
||||
OAUTH3._pkgs['email@daplie.com'] = {
|
||||
settings: function (opts) {
|
||||
var providerUri = opts.audience;
|
||||
var session = opts.session;
|
||||
|
||||
return OAUTH3.request({
|
||||
method: 'GET'
|
||||
, url: OAUTH3.url.normalize(providerUri)
|
||||
+ '/api/email@daplie.com/acl/settings/'
|
||||
, session: session
|
||||
}).then(function (result) {
|
||||
return result;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
}('undefined' !== typeof exports ? exports : window));
|
|
@ -28,6 +28,36 @@ OAUTH3._pkgs['www@daplie.com'] = {
|
|||
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, strip: opts.strip, path: opts.path })
|
||||
;
|
||||
}
|
||||
, invite: function (opts) {
|
||||
var providerUri = opts.audience;
|
||||
var session = opts.session;
|
||||
|
||||
// TODO needs a way to have api and assets for audience
|
||||
return OAUTH3.request({
|
||||
method: 'POST'
|
||||
, 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*/, mode: opts.mode, path: opts.path })
|
||||
, session: session
|
||||
}).then(function (result) {
|
||||
return result;
|
||||
});
|
||||
}
|
||||
, acceptInvite: function (opts) {
|
||||
var providerUri = opts.audience;
|
||||
var session = opts.session;
|
||||
|
||||
// TODO needs a way to have api and assets for audience
|
||||
return OAUTH3.request({
|
||||
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*/ })
|
||||
, session: session
|
||||
}).then(function (result) {
|
||||
return result;
|
||||
});
|
||||
}
|
||||
, download: function (opts) {
|
||||
var session = opts.session;
|
||||
var me = this;
|
||||
|
|
|
@ -66,6 +66,19 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button ng-click="vm.showSettings = !vm.showSettings">Settings</button>
|
||||
<div ng-if="vm.showSettings">
|
||||
<label>Service:</label> <input type="text" ng-model="vm.settings.service" placeholder="ex: mailgun.org">
|
||||
<br>
|
||||
<label>API Key:</label> <input type="text" ng-model="vm.settings.apiKey" placeholder="ex: key-xxxxxxxxxxxx">
|
||||
<br>
|
||||
<label>SMTP Username:</label> <input type="text" ng-model="vm.settings.auth.user" placeholder="ex: johndoe">
|
||||
<br>
|
||||
<label>SMTP Password:</label> <input type="text" ng-model="vm.settings.auth.pass" placeholder="ex: ************">
|
||||
<br>
|
||||
<label>SMTP Domain:</label> <input type="text" ng-model="vm.settings.auth.domain" placeholder="ex: example.com">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="white-well">
|
||||
|
|
|
@ -78,6 +78,10 @@
|
|||
<button ng-click="vm.createWebsite()" type="button" name="button" class="btn btn-default">Create Website</button>
|
||||
<!-- </div>
|
||||
</div> -->
|
||||
<div class="input-group">
|
||||
<div><label>Invite Code</label> <input type="text" ng-model="vm.Shares.inviteToken" /></div>
|
||||
<button ng-click="vm.Shares.accept()" type="button" name="button" class="btn btn-default">Accept Invite</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="white-well">
|
||||
<h1>Your Websites</h1>
|
||||
|
@ -85,13 +89,21 @@
|
|||
<tbody>
|
||||
<tr ng-repeat="r in vm.sites">
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<input type="text" ng-model="r.newPath" placeholder="/" />
|
||||
<button class="btn btn-default" ng-click="vm.Sites.contents(r)">List Files</button>
|
||||
</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>
|
||||
<input type="text" ng-model="r.shareEmail" placeholder="ex: john@example.com" />
|
||||
<input type="text" ng-model="r.sharePath" placeholder="/" />
|
||||
<input type="text" ng-model="r.shareMode" placeholder="rwx (read, write, invite)" />
|
||||
<button class="btn btn-default" ng-click="vm.Shares.invite(r)">Invite</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue