Added fetching User data from patreon and writing it to the DiceCloud user database
This commit is contained in:
@@ -66,6 +66,12 @@
|
||||
<div style="max-width: 250px">
|
||||
{{> atForm state="signIn"}}
|
||||
</div>
|
||||
<div style="max-width: 250px; margin: 8px;">
|
||||
Tier: {{tier}}
|
||||
<a href="{{patreonLoginUrl}}">
|
||||
Connect Patreon Account
|
||||
</a>
|
||||
</div>
|
||||
{{> atNavButton }}
|
||||
</paper-material>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import { format as formatUrl } from 'url';
|
||||
|
||||
const CLIENT_ID = "zv38izfGZDf8s_Z9BI5kICjGGnvs45PawHYu6cqsTqftwZ_5DZFqEGKZfdP8Q6I2";
|
||||
|
||||
Template.profile.onCreated(function(){
|
||||
this.showApiKey = new ReactiveVar(false);
|
||||
});
|
||||
@@ -12,6 +16,33 @@ Template.profile.helpers({
|
||||
showApiKey: function(){
|
||||
return Template.instance().showApiKey.get();
|
||||
},
|
||||
patreonLoginUrl: function(){
|
||||
return formatUrl({
|
||||
protocol: 'https',
|
||||
host: 'patreon.com',
|
||||
pathname: '/oauth2/authorize',
|
||||
query: {
|
||||
response_type: 'code',
|
||||
client_id: CLIENT_ID,
|
||||
redirect_uri: Meteor.absoluteUrl() + 'patreon-redirect',
|
||||
state: Meteor.userId(),
|
||||
scope: 'identity',
|
||||
},
|
||||
});
|
||||
},
|
||||
patreon: function(){
|
||||
let user = Meteor.user();
|
||||
return user && user.patreon || {};
|
||||
},
|
||||
tier: function(){
|
||||
let user = Meteor.user();
|
||||
if (!user) return;
|
||||
patreon = user.patreon;
|
||||
if (!patreon) return;
|
||||
let tier = patreon.entitledCents || 0;
|
||||
if (patreon.entitledCentsOverride > tier) tier = patreon.entitledCentsOverride;
|
||||
return tier;
|
||||
}
|
||||
});
|
||||
|
||||
Template.profile.events({
|
||||
|
||||
Reference in New Issue
Block a user