inject_files
Field | Type | Required |
---|---|---|
inject_files | object array | Yes |
DEPRECATED FIELD - INJECTION IS NOT SUPPORTED ANYMORE!
This field is for spacelets only!
A list of inject files that are in the applications package. The files are injected to web pages defined by the inject hostnames (see inject_hostnames) after the inject identifier (see inject_identifier).
Edge nodes web server serves the inject files and it is therefore required that the files are listed accurately here. The files must be found from the applications package as defined in this array. The files are injected in the same order to the web page as they are in the array.
The inject files are always in the application/www/ directory or subdirectories of it as defined in the directory field of the inject objects.
Field | Type | Required | Description |
---|---|---|---|
directory | string | Optional | Directory name relative to spacelets www/ directory where the file is. Allowed characters are 0-9a-zA-Z/.-_. Directory name can not be empty, have leading or trailing whitespace, start with ., / or - or end with . or / and can not have consecutive /. |
file | string | Yes | Name of the inject file that is supplied with the applications package. Allowed characters are 0-9a-zA-Z.-_. Inject file name can not be empty, have leading or trailing whitespace, start with . or - or end with . |
type | string | Yes | Type of the injection. See the injection types below. |
The injection type field must be exactly one of the string below
Type | Description |
---|---|
javascript | Injects the file as a script tag to a web page. <script type="text/javascript" src="URL"></script>\n. |
css | Injects the file as a link tag to the web pages. <link rel="stylesheet" type="text/css" media="all" href="URL">\n. |
file | Injects the content of a file found from <unique_name>/volume/application/www/<directory/file> as text to the web page. |
The general format of a URL Spaceify generates for spacelets is:
- <protocol>://edge.spaceify.net/<unique_name>/[directory/]<file>
The fields in the URL are as follows:
- <protocol> is either http or https. Http is used on insecure web pages and https on secure (encrypted) web pages.
- <unique_name> is the unique identifier of the spacelet that is injecting the files.
- [directory] is optional and is added to the URL only if it is defined in an inject object.
- <file> is the actual JavaScript or CSS file to be injected.
Example | Description |
---|---|
[ { "directory": "javascript", "name": "pictureviewer.js", "type": "javascript" }, { "name": "styles.css", "type": "css } ] | Inject pictureviewer.js from spacelets www/javascript directory as a script tag. Inject styles.css from spacelets www/ directory as a link tag. |
The above example would inject the following text to a web page when unique_name is "spaceify/pictureviewer". <script type="text/javascript" src="http://edge.spaceify.net/spaceify/pictureviewer/javascript/pictureviewer.js"></script> <link rel="stylesheet" type="text/css" media="all" href="http://edge.spaceify.net/spaceify/pictureviewer/styles.css"> |