Foundry Hub Technical Guide

Technical stuff ahead

This page contains technical information for developers and creators. If you are part of this target audience and still have questions, don’t hesitate to comment down below or to get in touch with JDW on Discord (JDW#6422).

Package viewer

This section will explore how the package viewer works and how you can get the most of it.

Packages data and updates

The first thing to know about the package viewer is where does the data come from. There are three sources of data. The Foundry database, The Forge database, and the Foundry Hub database. Foundry Hub takes its data from The Forge, which takes it from the Foundry VTT database. Along the way, the data is enriched and expanded with custom layers. For example, The Forge will add things like the percent of install, premium packages, etc. Foundry Hub will add endorsements and comments. Here is a diagram of the data layers.

Data are updated every five minutes, except for the full description available on the Foundry Website (every 24 hours).

Manifest file

The manifest file (module.json, system.json, etc.) is the primary source of information on a package. It is extensively used by every layer to format and generate readable data.

Foundry VTT defines manifest files on their website:

On top of this, the community came up with an extension to these files called Manifest+.
This format enhances the manifest specs with useful metadata on a package, the most important part of it being media items, like screenshots and videos. The complete specs of Manifest+ are available here:
➡ https://foundryvtt.wiki/en/development/manifest-plus

Example

Let’s take a look at the manifest file of the Dice So Nice module to illustrate what can be done.

{
	"name": "dice-so-nice",
	"title": "Dice So Nice!",
	"description": "Adds the ability to show a nice 3D dice simulation when a roll is made.",
	"version": "4.0.7",
	"minimumCoreVersion" : "0.8.4",
	"compatibleCoreVersion" : "0.8.8",
	"author": "Simone, JDW",
	"authors": [
		{
			"name": "Simone",
			"discord": "Simone [UTC +2]#6710"
		},
		{
			"name": "JDW",
			"discord": "JDW#6422",
			"reddit":"u/jidewe",
			"ko-fi":"jdwfvtt"
			//More fields are available for authors. Check the complete list in the M+ specs
		}
	],
	"esmodules": [
		"./main.js"
	],
	"scripts": [
		"./libs/cannon.min.js",
		"./libs/select2.min.js"
	],
	"socket": true,
	"styles": [
		"./css/style.css",
		"./css/select2.css"
	],
	"languages": [{
		"lang": "en",
		"name": "English",
		"path": "./lang/en.json"
	}, {
		"lang": "it",
		"name": "Italian",
		"path": "./lang/it.json"
	}, {
		"lang": "es",
		"name": "Español",
		"path": "./lang/es.json"
	}],
	"media":[
		{
			//The cover must be a static image, with a 2:1 ratio.
                        //It is recommended to use a JPG file of 1200px x 600px
			"type":"cover",
			"url":"https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/raw/master/cover.jpg"
		},
		{
			"type":"video",
			"url":"https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/raw/master/dsnloop-360.webm",
			//Videos can be used as a high quality gif by using the "loop" property
			"loop": true
		},
		{
			//Videos can either be in mp4, webm, or hosted on Youtube/Vimeo
			"type":"video",
			"url":"https://www.youtube.com/watch?v=4b_C5R3t6iw"
		},
		{
			"type":"screenshot",
			"url":"https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/raw/master/screenshot1.jpg"
		},
		{
			"type":"screenshot",
			"url":"https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/raw/master/screenshot2.jpg"
		},
		{
			"type":"screenshot",
			"url":"https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/raw/master/screenshot3.jpg"
		},
		{
			"type":"screenshot",
			"url":"https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/raw/master/screenshot4.jpg"
		}
	],
	"url": "https://gitlab.com/riccisi/foundryvtt-dice-so-nice",
	"manifest": "https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/raw/master/module/module.json",
	"download": "https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/jobs/artifacts/4.0.7/raw/dsn.zip?",
	"bugs": "https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/issues",
        "changelog": "https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/blob/master/CHANGELOG.md",
        "license": "https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/blob/master/LICENSE.md",
	"readme": "https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/blob/master/README.md",
	"flags": {
		"allowBugReporter": true
	}
}Code language: JSON / JSON with Comments (json)

Markdown: Readme, changelog and license

When you provide a link to your readme, changelog, or license written in Markdown, make sure to provide a link that ends in .md in your manifest file. Foundry Hub will automatically create a tab and format your markdown to show in the package view.

Notifications on new comments

You can subscribe to your own packages’ comments to get notified when someone posts a new comment. Log into your account, navigate to your package and click the Subscribe button in the Comments tab.

Tools and API

In this section, we’ll talk about the Foundry Hub API and the dev tools it provides.

Shield IO

Well known and beloved by many developers, shields are little badges you can embed into your repository or website. Foundry Hub provides you with two shields: Endorsements and Comments.

Do not forget to replace “YOUR-PACKAGE-NAME” with your (all low caps) package name twice.

Shield: Endorsements

[![Foundry Hub Endorsements](https://img.shields.io/endpoint?logoColor=white&url=https%3A%2F%2Fwww.foundryvtt-hub.com%2Fwp-json%2Fhubapi%2Fv1%2Fpackage%2FYOUR-PACKAGE-NAME%2Fshield%2Fendorsements)](https://www.foundryvtt-hub.com/package/YOUR-PACKAGE-NAME/)Code language: Markdown (markdown)

Shield: Comments

[![Foundry Hub Comments](https://img.shields.io/endpoint?logoColor=white&url=https%3A%2F%2Fwww.foundryvtt-hub.com%2Fwp-json%2Fhubapi%2Fv1%2Fpackage%2FYOUR-PACKAGE-NAME%2Fshield%2Fcomments)](https://www.foundryvtt-hub.com/package/YOUR-PACKAGE-NAME/)Code language: Markdown (markdown)

Foundry Hub API

We provide 3 public APIs.

WordPress REST API

Foundry Hub is built on WordPress. This comes with a public REST API you can use to get information about each website page from creators, packages, or articles. We won’t go into details here. However, you can learn more about this API on the WordPress website: https://developer.wordpress.org/rest-api/

Endpoint: https://www.foundryvtt-hub.com/wp-json/

Search API

You can use the API to search packages or any other post on the website with a keyword. This API is currently used by “Leo”, the awesome bot of the League of Extraordinary Foundry VTT Developers, on their Discord.

Endpoint: https://www.foundryvtt-hub.com/wp-json/relevanssi/v1/search?posts_per_page=1&paged=1&type=package&keyword=Your keywords

Package metadata API

You can get the number of endorsements, number of comments, and install percent from our API. You need to provide a valid package name.

Endpoint: https://www.foundryvtt-hub.com/wp-json/hubapi/v1/package/YOUR-PACKAGE-NAME

Foundry Hub code and contribution

The Foundry Hub website code is open source and open to contribution. It does require a heavy setup as you need a WordPress running to be able to test your code. If you wish to become a contributor, please contact JDW so he can help you to install your local environment.

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x