Stores configuration options and literals that are used throughout the system. Also loads and saves the configuration of changeable values (only those as "user-configurable") in the storage object.

Implements

Constructors

Properties

ajaxUrl: string = '/ajax'

URL prefix for all AJAX requests

baseUrl: string = '/h5p'

The prefix that is added to all URLs.

contentFilesUrl: string = '/content'

Base path for content files (e.g. images). Used in the player and in the editor.

contentFilesUrlPlayerOverride: string

Base path for content files (e.g. images) IN THE PLAYER. It MUST direct to a URL at which the content files for THE CONTENT BEING DISPLAYED must be accessible. This means it must include the contentId of the object! You can insert the contentId using the placeholder {{contentId}}.

Example: http://127.0.0.1:9000/s3bucket/{{contentId}}`

You can use this URL to load content files from a different server, e.g. S3 storage. Note that this only work for the player and not the editor.

contentHubContentEndpoint: string = 'https://hub-api.h5p.org/v1/contents'

The URL of the Content Hub that is used to query content.

contentHubEnabled: boolean = false

If true, the content hub is enabled.

contentHubMetadataEndpoint: string = 'https://hub-api.h5p.org/v1/metadata'

The URL of the Content Hub at which you can retrieve metadata

contentHubMetadataRefreshInterval: number = ...

Time after which the content hub metadata is considered to be outdated in milliseconds. User-configurable.

contentTypeCacheRefreshInterval: number = ...

Time after which the content type cache is considered to be outdated in milliseconds. User-configurable.

contentUserDataUrl: string = '/contentUserData'

URL prefix for content user data (e.g. the user state where a user left off displaying H5P content)

contentUserStateSaveInterval: number | false = ...
contentWhitelist: string = 'json png jpg jpeg gif bmp tif tiff eot ttf woff woff2 otf webm mp4 ogg mp3 m4a wav txt pdf rtf doc docx xls xlsx ppt pptx odt ods odp xml csv diff patch swf md textile vtt webvtt gltf glb'

A list of file extensions allowed for content files. Contains file extensions (without .) separated by whitespaces.

coreApiVersion: { major: number; minor: number } = ...

This is the version of the H5P Core (JS + CSS) that is used by this implementation. It is sent to the H5P Hub when registering there. Not user-configurable and should not be changed by custom implementations.

coreUrl: string = '/core'

Path to the H5P core files directory.

customization: {
    global: {
        editor?: { scripts?: string[]; styles?: string[] };
        player?: { scripts?: string[]; styles?: string[] };
    };
} = ...

Options that change the looks and behavior of H5P.

disableFullscreen: boolean = false

If true, the fullscreen button will not be shown to the user.

downloadUrl: string = '/download'

Path to the downloadable H5P packages.

editorAddons?: { [machineName: string]: string[] }

You can specify which addons should be added to which library here.

editorLibraryUrl: string = '/editor'

Path to editor "core files"

enableLrsContentTypes: boolean = true

If set to true, the content types that require a Learning Record Store to make sense are offered as a choice when the user creates new content. User-configurable.

exportMaxContentPathLength: number = 255

The maximum character count of paths of content files allowed when exporting h5p packages. If files would be longer, paths are shortened.

fetchingDisabled: 0 | 1 = 0

Unclear. Taken over from PHP implementation and sent to the H5P Hub when registering the site. User-configurable.

h5pVersion: string = '1.27.0'

This is the version of the PHP implementation that the NodeJS implementation imitates. Can be anything like 1.22.1 It is sent to the H5P Hub when registering there. Not user-configurable and should not be changed by custom implementations.

hubContentTypesEndpoint: string = 'https://api.h5p.org/v1/content-types/'

The URL called to fetch information about the content types available at the H5P Hub. User-configurable.

hubRegistrationEndpoint: string = 'https://api.h5p.org/v1/sites'

The URL called to register the running instance at the H5P Hub. User-configurable.

installLibraryLockMaxOccupationTime: number = 10000

The number of milliseconds that code has until a single library is installed. If this time is exceeded the lock will be freed and the library installation has failed.

installLibraryLockTimeout: number = 20000

How long to wait until a lock is acquired when installing a single library.

librariesUrl: string = '/libraries'

The URL of the library files (= content types).

libraryConfig: { [machineName: string]: any }

(optional) You can set server-wide custom settings for some libraries by setting the values here. As far as we know, this is currently only supported by H5P.MathDisplay. See https://h5p.org/mathematical-expressions for more information.

libraryWhitelist: string = 'js css svg'

A list of file extensions allowed for library files. (File extensions without . and separated by whitespaces.) (All extensions allowed for content files are also automatically allowed for libraries).

lrsContentTypes: string[] = ...

The list of content types that are enabled when enableLrsContentTypes is set to true. Not user-configurable.

maxFileSize: number = ...

The maximum allowed file size of content and library files (in bytes).

maxTotalSize: number = ...

The maximum allowed file size of all content and library files in an uploaded h5p package (in bytes).

paramsUrl: string = '/params'

The Url at which the parameters of a piece of content can be retrieved

platformName: string = 'H5P-Editor-NodeJs'

This is the name of the H5P implementation sent to the H5P for statistical reasons. Not user-configurable but should be overridden by custom custom implementations.

platformVersion: string = '0.10'

This is the version of the H5P implementation sent to the H5P when registering the site. Not user-configurable but should be overridden by custom custom implementations.

playerAddons?: { [machineName: string]: string[] }

You can specify which addons should be added to which library in the player here.

playUrl: string = '/play'

The Url at which content can be displayed.

proxy?: { host: string; port: number; protocol?: "http" | "https" }

Allows settings a http(s) proxy for outgoing requests. No proxy will be used if left undefined (or the one specified in the HTTPS_PROXY environment variable).

sendUsageStatistics: boolean = false

If true, the instance will send usage statistics to the H5P Hub whenever it looks for new content types or updates. User-configurable.

setFinishedEnabled: boolean = true

If true, the H5P client is told to send data about users finished a content object to the server. (This is the custom H5P setFinished report, not an xAPI statement)

setFinishedUrl: string = '/finishedData'

URL prefix for the finished URL (the URL to which requests are sent when the user has finished content)

siteType: "network" | "local" | "internet" = 'local'

Indicates on what kind of network the site is running. Can be "local", "network" or "internet". TODO: This value should not be user-configurable, but has to be determined by the system on startup. (If possible.)

temporaryFileLifetime: number = ...
temporaryFilesUrl: string = '/temp-files'

The URL path of temporary file storage (used for image, video etc. uploads of unsaved content).

uuid: string = ''

Methods