Merge branch 'main' into dev
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
- [Document](#document)
|
||||
- [Branding](#branding)
|
||||
- [Theme](#theme)
|
||||
- [Themes](#themes)
|
||||
- [Available themes](#available-themes)
|
||||
- [Pages & Columns](#pages--columns)
|
||||
- [Widgets](#widgets)
|
||||
- [RSS](#rss)
|
||||
@@ -307,7 +307,7 @@ theme:
|
||||
contrast-multiplier: 1.1
|
||||
```
|
||||
|
||||
### Themes
|
||||
### Available themes
|
||||
If you don't want to spend time configuring your own theme, there are [several available themes](themes.md) which you can simply copy the values for.
|
||||
|
||||
### Properties
|
||||
@@ -1335,6 +1335,9 @@ Examples:
|
||||
| ---- | ---- | -------- | ------- |
|
||||
| url | string | yes | |
|
||||
| headers | key (string) & value (string) | no | |
|
||||
| method | string | no | GET |
|
||||
| body-type | string | no | json |
|
||||
| body | any | no | |
|
||||
| frameless | boolean | no | false |
|
||||
| allow-insecure | boolean | no | false |
|
||||
| template | string | yes | |
|
||||
@@ -1353,6 +1356,31 @@ headers:
|
||||
Accept: application/json
|
||||
```
|
||||
|
||||
##### `method`
|
||||
The HTTP method to use when making the request. Possible values are `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS` and `HEAD`.
|
||||
|
||||
##### `body-type`
|
||||
The type of the body that will be sent with the request. Possible values are `json`, and `string`.
|
||||
|
||||
##### `body`
|
||||
The body that will be sent with the request. It can be a string or a map. Example:
|
||||
|
||||
```yaml
|
||||
body-type: json
|
||||
body:
|
||||
key1: value1
|
||||
key2: value2
|
||||
multiple-items:
|
||||
- item1
|
||||
- item2
|
||||
```
|
||||
|
||||
```yaml
|
||||
body-type: string
|
||||
body: |
|
||||
key1=value1&key2=value2
|
||||
```
|
||||
|
||||
##### `frameless`
|
||||
When set to `true`, removes the border and padding around the widget.
|
||||
|
||||
@@ -1428,6 +1456,7 @@ Display a widget provided by an external source (3rd party). If you want to lear
|
||||
| url | string | yes | |
|
||||
| fallback-content-type | string | no | |
|
||||
| allow-potentially-dangerous-html | boolean | no | false |
|
||||
| headers | key & value | no | |
|
||||
| parameters | key & value | no | |
|
||||
|
||||
##### `url`
|
||||
@@ -1436,6 +1465,14 @@ The URL of the extension. **Note that the query gets stripped from this URL and
|
||||
##### `fallback-content-type`
|
||||
Optionally specify the fallback content type of the extension if the URL does not return a valid `Widget-Content-Type` header. Currently the only supported value for this property is `html`.
|
||||
|
||||
##### `headers`
|
||||
Optionally specify the headers that will be sent with the request. Example:
|
||||
|
||||
```yaml
|
||||
headers:
|
||||
x-api-key: ${SECRET_KEY}
|
||||
```
|
||||
|
||||
##### `allow-potentially-dangerous-html`
|
||||
Whether to allow the extension to display HTML.
|
||||
|
||||
|
||||
@@ -325,13 +325,24 @@ The following helper functions provided by Glance are available:
|
||||
- `toFloat(i int) float`: Converts an integer to a float.
|
||||
- `toInt(f float) int`: Converts a float to an integer.
|
||||
- `toRelativeTime(t time.Time) template.HTMLAttr`: Converts Time to a relative time such as 2h, 1d, etc which dynamically updates. **NOTE:** the value of this function should be used as an attribute in an HTML tag, e.g. `<span {{ toRelativeTime .Time }}></span>`.
|
||||
- `parseTime(layout string, s string) time.Time`: Parses a string into time.Time. The layout must be provided in Go's [date format](https://pkg.go.dev/time#pkg-constants). You can alternatively use these values instead of the literal format: "RFC3339", "RFC3339Nano", "DateTime", "DateOnly", "TimeOnly".
|
||||
- `parseTime(layout string, s string) time.Time`: Parses a string into time.Time. The layout must be provided in Go's [date format](https://pkg.go.dev/time#pkg-constants). You can alternatively use these values instead of the literal format: "unix", "RFC3339", "RFC3339Nano", "DateTime", "DateOnly".
|
||||
- `parseRelativeTime(layout string, s string) time.Time`: A shorthand for `{{ .String "date" | parseTime "rfc3339" | toRelativeTime }}`.
|
||||
- `add(a, b float) float`: Adds two numbers.
|
||||
- `sub(a, b float) float`: Subtracts two numbers.
|
||||
- `mul(a, b float) float`: Multiplies two numbers.
|
||||
- `div(a, b float) float`: Divides two numbers.
|
||||
- `formatApproxNumber(n int) string`: Formats a number to be more human-readable, e.g. 1000 -> 1k.
|
||||
- `formatNumber(n float|int) string`: Formats a number with commas, e.g. 1000 -> 1,000.
|
||||
- `trimPrefix(prefix string, str string) string`: Trims the prefix from a string.
|
||||
- `trimSuffix(suffix string, str string) string`: Trims the suffix from a string.
|
||||
- `trimSpace(str string) string`: Trims whitespace from a string on both ends.
|
||||
- `replaceAll(old string, new string, str string) string`: Replaces all occurrences of a string in a string.
|
||||
- `findMatch(pattern string, str string) string`: Finds the first match of a regular expression in a string.
|
||||
- `findSubmatch(pattern string, str string) string`: Finds the first submatch of a regular expression in a string.
|
||||
- `sortByString(key string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by a string key in either ascending or descending order.
|
||||
- `sortByInt(key string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by an integer key in either ascending or descending order.
|
||||
- `sortByFloat(key string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by a float key in either ascending or descending order.
|
||||
- `sortByTime(key string, layout string, order string, arr []JSON): []JSON`: Sorts an array of JSON objects by a time key in either ascending or descending order. The format must be provided in Go's [date format](https://pkg.go.dev/time#pkg-constants).
|
||||
|
||||
The following helper functions provided by Go's `text/template` are available:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user