A self-hosted dashboard that puts all your feeds in one place
Go aggregatordashboarddockerfeed-readergohomelabhomepagemonitoringredditrssrss-readerself-hostedstartpageyoutube
Add docs for basic auth in custom-api
Svilen Markov7977a3f6168c
diff --git a/docs/configuration.md b/docs/configuration.mdindex 4362df8..089c6fb 100644--- a/docs/configuration.md+++ b/docs/configuration.md@@ -1574,6 +1574,7 @@ Examples:| method | string | no | GET || body-type | string | no | json || body | any | no | |+| basic-auth | map | no | || frameless | boolean | no | false || allow-insecure | boolean | no | false || skip-json-validation | boolean | no | false |@@ -1619,6 +1620,15 @@ body: |key1=value1&key2=value2```+##### `basic-auth`+Optionally specify credentials to be sent with the request using HTTP basic authentication. Example:++```yaml+basic-auth:+ username: your-username+ password: your-password+```+##### `frameless`When set to `true`, removes the border and padding around the widget.diff --git a/docs/custom-api.md b/docs/custom-api.mdindex 5cc763a..6159b62 100644--- a/docs/custom-api.md+++ b/docs/custom-api.md@@ -378,7 +378,7 @@ In some instances, you may need to make two consecutive API calls, where you use{{ $something.JSON.String "title" }}```-Here, `$theID` gets retrieved from the result of the first API call and used in the second API call. The `newRequest` function creates a new request, and the `getResponse` function executes it. You can also use `withParameter` and `withHeader` to optionally add parameters and headers to the request, or `withAllowInsecure` to skip TLS certificate verification, e.g. `newRequest "https://self-signed.example.com" | withAllowInsecure true | getResponse`.+Here, `$theID` gets retrieved from the result of the first API call and used in the second API call. The `newRequest` function creates a new request, and the `getResponse` function executes it. You can also use `withParameter` and `withHeader` to optionally add parameters and headers to the request, `withBasicAuth` to add HTTP basic authentication credentials, e.g. `newRequest "https://api.example.com" | withBasicAuth "username" "password" | getResponse`, or `withAllowInsecure` to skip TLS certificate verification, e.g. `newRequest "https://self-signed.example.com" | withAllowInsecure true | getResponse`.If you need to make a request to a URL that requires dynamic parameters, you can omit the `url` property in the YAML and run the request entirely from within the template itself:@@ -459,6 +459,18 @@ The following helper functions provided by Glance are available:- `startOfDay(t time.Time) time.Time`: Returns the start of the day for a given time.- `endOfDay(t time.Time) time.Time`: Returns the end of the day for a given time.+The following functions are available for making additional requests from within a template:++| Function | Description |+| -------- | ----------- |+| `newRequest url` | Creates a new request for the given URL. |+| `withHeader key value` | Adds a header to the request. |+| `withParameter key value` | Adds a query parameter to the request. |+| `withStringBody body` | Sets the request body to the given string and its method to `POST`. |+| `withBasicAuth username password` | Sets the username and password to be used for HTTP basic authentication. |+| `withAllowInsecure bool` | Whether to ignore invalid/self-signed certificates. |+| `getResponse` | Executes the request and returns the response. |+The following helper functions provided by Go's `text/template` are available:- `eq(a, b any) bool`: Compares two values for equality.