+
+
+
+ Only people I share with
+ Anyone with link
+
+
+ {{#if library.public}}
+
+ Share this link for others to subscribe to this library:
+
+
+ {{urlFor route='library' data=library}}
+
+ {{/if}}
+
+
Share Directly
+ icon="delete"
+ disabled="{{cantEdit}}">
diff --git a/app/client/views/library/itemLibrary/libraryItemDialog/libraryItemDialog.js b/app/client/views/library/libraryItemDialog/libraryItemDialog.js
similarity index 91%
rename from app/client/views/library/itemLibrary/libraryItemDialog/libraryItemDialog.js
rename to app/client/views/library/libraryItemDialog/libraryItemDialog.js
index c258705d..3f82c681 100644
--- a/app/client/views/library/itemLibrary/libraryItemDialog/libraryItemDialog.js
+++ b/app/client/views/library/libraryItemDialog/libraryItemDialog.js
@@ -1,3 +1,9 @@
+Template.libraryItemDialog.onCreated(function(){
+ this.autorun(() => {
+ this.subscribe('libraryItem', Template.currentData().itemId);
+ });
+});
+
Template.libraryItemDialog.helpers({
item(){
return LibraryItems.findOne(this.itemId);
@@ -55,6 +61,20 @@ Template.libraryItemDialog.helpers({
thunder: 12,
};
return ref[damageType];
+ },
+ ready(){
+ return Template.instance().subscriptionsReady();
+ },
+ cantEdit(){
+ let item = LibraryItems.findOne(this.itemId);
+ if (!item) return;
+ let library = Libraries.findOne(item.library);
+ if (!library) return;
+ let userId = Meteor.userId();
+ return !(
+ library.owner === userId ||
+ _.contains(library.writers, userId)
+ );
}
});
diff --git a/app/client/views/patreon/patronsOnly.html b/app/client/views/patreon/patronsOnly.html
new file mode 100644
index 00000000..27c55c05
--- /dev/null
+++ b/app/client/views/patreon/patronsOnly.html
@@ -0,0 +1,27 @@
+
+
+
+
+ This beta feature is available to Patreon Insiders who pledge $5 or more
+
+
+
+ With the Item Libraries beta you can create collections of items to use
+ across your characters, and share them with other players.
+
+
+ You can also subscribe to existing community libraries of items, saving
+ time and effort manually entering item details.
+
+
+
+
diff --git a/app/client/views/user/profile/profile.js b/app/client/views/user/profile/profile.js
index e0dcde84..f3df5f10 100644
--- a/app/client/views/user/profile/profile.js
+++ b/app/client/views/user/profile/profile.js
@@ -1,9 +1,5 @@
import { format as formatUrl } from 'url';
-const CLIENT_ID = Meteor.settings &&
- Meteor.settings.public.patreon &&
- Meteor.settings.public.patreon.clientId;
-
Template.profile.onCreated(function(){
this.showApiKey = new ReactiveVar(false);
this.loadingPatreon = new ReactiveVar(false);
@@ -19,21 +15,6 @@ Template.profile.helpers({
showApiKey: function(){
return Template.instance().showApiKey.get();
},
- patreonLoginUrl: function(){
- if (!CLIENT_ID) return;
- 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 || {};
diff --git a/app/public/custom_components/app-theme.html b/app/public/custom_components/app-theme.html
index e84c18cb..aff91794 100644
--- a/app/public/custom_components/app-theme.html
+++ b/app/public/custom_components/app-theme.html
@@ -70,4 +70,8 @@
--paper-diff-slider-knob-color: #00BCD4;
--paper-diff-slider-pin-color: #00BCD4;
}
+ .white-text paper-input {
+ /* Input foreground color */
+ --paper-input-container-input-color: rgba(255,255,255,0.87);
+ }
diff --git a/app/server/publications/library.js b/app/server/publications/library.js
index 3ab18ce3..94d9df78 100644
--- a/app/server/publications/library.js
+++ b/app/server/publications/library.js
@@ -25,16 +25,61 @@ Meteor.publish("standardLibrarySpells", function(level){
});
Meteor.publish("customLibraries", function(){
- userId = this.userId;
+ const userId = this.userId;
+ let user = Meteor.user()
+ let subs = user && user.profile && user.profile.librarySubscriptions;
return Libraries.find({
$or: [
{readers: userId},
{writers: userId},
{owner: userId},
+ {public: true, _id: {$in: subs || []}},
+ ],
+ });
+});
+
+Meteor.publish("singleLibrary", function(id){
+ const userId = this.userId;
+ return Libraries.find({
+ _id: id,
+ $or: [
+ {readers: userId},
+ {writers: userId},
+ {owner: userId},
+ {public: true},
],
});
});
Meteor.publish("libraryItems", function(libraryId){
- return LibraryItems.find({library: libraryId});
+ return LibraryItems.find({
+ library: libraryId
+ }, {
+ fields: {
+ name: 1,
+ libraryName: 1,
+ library: 1,
+ },
+ });
+});
+
+Meteor.publish("libraryItem", function(itemId){
+ let cursor = LibraryItems.find(itemId);
+ let item = cursor.fetch()[0];
+ let userId = Meteor.userId();
+ if (!item) return [];
+ let library = Libraries.findOne(item.library);
+ if (!library) {
+ throw new Meteor.Error("Library item " + item._id + " is an orphan");
+ }
+ if (
+ library.public ||
+ library.owner === userId ||
+ _.contains(library.readers, userId) ||
+ _.contains(library.writers, userId)
+ ) {
+ return cursor;
+ } else {
+ return [];
+ }
});