Difference between revisions of "Extensions:Embed Service"

From Lorekeeper Wiki
Jump to navigation Jump to search
(Added most of the instructions)
Tag: 2017 source edit
(Added instructions)
Tag: 2017 source edit
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{Extensioninfobox|title=Stacked Inventories|desc=Changes items on site to display in stacks instead of one by one|auth=Draginraptor|status=Stable|github={{Github|user=Draginraptor|branch=inventory_stacks}}|migration=yes|package=no}}</includeonly>
+
{{Extensioninfobox|title=Embed Service|desc=Uses packages to enable data retrieval using URLs|auth=Draginraptor|status=Stable|github={{Github|user=Draginraptor|branch=embed_service}}|migration=no|package=yes}}
Special thanks to [https://github.com/itinerare itinerare] for isolating and testing the changes.
+
This adds the EmbedController and EmbedService, which makes use of the [https://github.com/oscarotero/Embed oscarotero/Embed] library. Requires some familiarity with programming as the additions made had DeviantArt oEmbed in mind and will likely need customisation to suit your needs.
 +
Adds a simple setup for querying URLs in order to retrieve data, such as oEmbed data from DeviantArt, where you can get the image source url. Does not change the site at all.
  
This changes the default inventory in Lorekeeper from displaying each user_item row as a stack of 1, and instead condenses duplicate entries into stacks. This has affected Inventory, Trades, and Design Updates the most, though there could still be remnants of code that still aren't using the new system.
 
Inventory pages will open a modal that displays a table of all the item varieties owned by the user, where the user can select and act on the items. Inventory select widgets use tables that display all items and their variations in the user's inventory.
 
 
== Installation ==
 
== Installation ==
Once the changes are pulled, the database needs to be updated as well - this can be done with:
+
You will need to install the [https://github.com/oscarotero/Embed oscarotero/Embed] library and have at least one of these [https://github.com/middlewares/awesome-psr15-middlewares#psr-7-implementations PSR-7 libraries]. The composer.json has already been updated to include these libraries, so if you're not worried about customisation, just run <code>composer update</code> after pulling the branch.
<code>$ php artisan migrate</code>
 
The migrations will add 2 new columns to user_items: trade_count and update_count, for tracking items held in trades and updates respectively. It will also change the default value of count in user_items to 0.
 
 
== Configuration ==
 
== Configuration ==
There is no need for configuration.
+
The extension is pretty bare bones so you may want to edit some of the code yourself before using it.
== Usage ==
 
Note that existing data in the database will need to be edited such that duplicate entries (where the item_id, user_id, and data are the same) need to be combined separately.
 
  
You could just update each row's count column to reflect the total count at that point in time, leaving the duplicate entries alone. I'm unsure if it will break anything, but I don't think so.
+
The EmbedController currently filters out URLs that aren't related to DeviantArt. This is done using a list of regex patterns, so if you want to allow other URLs you'll just have to add the regex to the list. Alternatively, if you don't want to filter any links out, remove the regex checks.
  
You can also delete the duplicate rows once the count column is updated. However, this will probably require deleting the item logs associated with the affected stacks, unless you create your own workaround.
+
The EmbedService getEmbed function currently returns the oEmbed result specifically. However, not all URLs have an oEmbed result, so you may want to generalise. All relevant documentation can be found at the [https://github.com/oscarotero/Embed oscarotero/Embed] library.
 
+
== Usage ==
I have included some SQL that you can reference in creating a query, but it is unlikely to work out of the box. Alternatively, you can also edit the database manually. Either way, ALWAYS backup your database before making changes.
+
This does not affect the site at all and is intended as a quickstart for using the [https://github.com/oscarotero/Embed oscarotero/Embed] library, where a Service and Controller has been set up, along with a relevant route.
 
 
The migrations do not remove holding_type and holding_id, which are not used in this version of the inventory; these may be left in or removed on your own.
 
 
== Troubleshooting ==
 
== Troubleshooting ==
You can always find Draginraptor via the Lorekeeper Discord Server for help. Feel free to report bugs as well.
+
You can always find Draginraptor via the Lorekeeper Discord server for help. Feel free to report bugs as well.
 +
I can try to help you customise the extension to your needs, but I can't make promises.
 
== See Also ==
 
== See Also ==
-
+
* [https://github.com/oscarotero/Embed oscarotero/Embed]
<noinclude>{{Documentation}}</noinclude>
 

Latest revision as of 08:55, 27 June 2020

Embed Service
Description Uses packages to enable data retrieval using URLs
Author(s) Draginraptor
Status Stable
Github embed_service
LK Version Unspecified
Uses a Package






This adds the EmbedController and EmbedService, which makes use of the oscarotero/Embed library. Requires some familiarity with programming as the additions made had DeviantArt oEmbed in mind and will likely need customisation to suit your needs. Adds a simple setup for querying URLs in order to retrieve data, such as oEmbed data from DeviantArt, where you can get the image source url. Does not change the site at all.

Installation

You will need to install the oscarotero/Embed library and have at least one of these PSR-7 libraries. The composer.json has already been updated to include these libraries, so if you're not worried about customisation, just run composer update after pulling the branch.

Configuration

The extension is pretty bare bones so you may want to edit some of the code yourself before using it.

The EmbedController currently filters out URLs that aren't related to DeviantArt. This is done using a list of regex patterns, so if you want to allow other URLs you'll just have to add the regex to the list. Alternatively, if you don't want to filter any links out, remove the regex checks.

The EmbedService getEmbed function currently returns the oEmbed result specifically. However, not all URLs have an oEmbed result, so you may want to generalise. All relevant documentation can be found at the oscarotero/Embed library.

Usage

This does not affect the site at all and is intended as a quickstart for using the oscarotero/Embed library, where a Service and Controller has been set up, along with a relevant route.

Troubleshooting

You can always find Draginraptor via the Lorekeeper Discord server for help. Feel free to report bugs as well. I can try to help you customise the extension to your needs, but I can't make promises.

See Also