Tile
Users can control the Tile panel on the Stash homepage through JavaScript scripts.
Configuration Format
tiles:
- name: your-fancy-script
interval: 600
title: 'Awesome Tile'
content: 'This is Super Cool'
icon: 'theatermasks.circle.fill' # or https://stash.ws/amazing.png
backgroundColor: '#663399'
script-providers:
your-fancy-script:
url: https://your-fancy-script.com/your-fancy-script.js
interval: 86400
Parameters:
argument
: Optional. The argument passed to the script when executed, typestring
.title
: Optional. The default title before the script runs for the first time.content
: Optional. The default content before the script runs for the first time.icon
: Optional. The default icon before the script runs for the first time. The icon supportsSF Symbols
or remote images starting withhttp
.backgroundColor
: Optional. The default background color before the script runs for the first time.url
: Optional. The default jump URL before the script runs for the first time.
The above fields can be overridden and updated by $done(object)
.
⚠️
For more information about SF Symbols
, please refer to Apple Developer (opens in a new tab).
Syntax and Interface
Please refer to JavaScript Script Syntax and Interface.
Example
$httpClient.get('https://api.my-ip.io/ip', function (error, response, data) {
$done({
title: 'Current IP Address',
content: data,
backgroundColor: '#663399',
icon: 'network',
})
})
$done(value)
⚠️
For all scripts, you must call the $done(value)
method to release resources when finished.
For Tile type scripts, calling $done(object)
can update the Tile panel content, and object
can contain the following fields:
title
: Optional. The new Tile title.content
: Optional. The new Tile content.icon
: Optional. The new Tile icon.backgroundColor
: Optional. The new Tile background color.url
: Optional. The new jump URL.
If the above fields are empty, they will not be updated. You can directly call $done({})
without modifying any content.