diff --git a/docs/configuration.md b/docs/configuration.md index e2b55060d..4e79567f1 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -141,6 +141,7 @@ services: tag: "other" url: "http://192.168.0.151/admin" type: "PiHole" # optional, loads a specific component that provides extra features. MUST MATCH a file name (without file extension) available in `src/components/services` + # fetchWithCredentials: true # optional adds cookies to fetch calls for external data. Useful for services running behind SSO clients e.g. Authelia target: "_blank" # optional html a tag target attribute # class: "green" # optional custom CSS class for card, useful with custom stylesheet # background: red # optional color for card to set color directly without custom stylesheet diff --git a/docs/customservices.md b/docs/customservices.md index 3b3320d92..6a886d14a 100644 --- a/docs/customservices.md +++ b/docs/customservices.md @@ -13,13 +13,10 @@ If you experiencing any issue, please have a look to the [troubleshooting](troub - name: "My Service" logo: "assets/tools/sample.png" url: "http://my-service-link" - endpoint: "http://my-service-endpoint" # Optional: alternative base URL used to fetch service data is necessary. useCredentials: false # Optional: Override global proxy.useCredentials configuration. type: "" ``` -⚠️🚧 `endpoint` & `useCredentials` new options are not yet supported by all custom services (but will be very soon). - ## PiHole Using the PiHole service you can display info about your local PiHole instance right on your Homer dashboard. diff --git a/docs/development.md b/docs/development.md index a22ae0b2b..346291e95 100644 --- a/docs/development.md +++ b/docs/development.md @@ -2,6 +2,12 @@ If you want to contribute to Homer, please read the [contributing guidelines](https://github.com/bastienwirtz/homer/blob/main/CONTRIBUTING.md) first. +## Local development config + +When developing locally, put your `config.yml` file at `public/assets/config.yml`. The config file is included in the `.gitignore` + +## Serve locally + ```sh # Using yarn (recommended) yarn install @@ -72,3 +78,24 @@ body #app.theme-my-awesome-theme. { ... } ... @import "./themes/my-awesome-theme.scss"; ``` + +## Fetching data with `this.fetch` + +Homer wraps the standard `fetch` with a mixin that allows us to added global and per service header options to standard fetch calls. This should be transparent to development as long as you use `this.fetch` instead of the standard `fetch`. + +### Basic example +```js +this.fetch( + `${this.item.url}/api/health?apikey=${this.item.apikey}` +) +``` + +### Example with other fetch options +```js +this.fetch( + `${this.item.url}/api/v2/config`, + { + headers: { "X-Api-Key": `${this.item.apikey}` }, + } +) +``` diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index ed1f85d58..33c9a8ece 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -17,3 +17,18 @@ To resolve this, you can either: * Host all your target service under the same domain & port. * Modify the target sever configuration so that the response of the server included following header- `Access-Control-Allow-Origin: *` (). It might be an option in the targeted service, otherwise depending on how the service is hosted, the proxy or web server can seamlessly add it. * Use a cors proxy sever like [`cors-container`](https://github.com/imjacobclark/cors-container), [`cors-anywhere`](https://github.com/Rob--W/cors-anywhere) or many others. + + +## I use a single sign on tool, like Authelia. How do I get the service calls to not hit the login page? + +All the services use the JS `fetch` function. By default, a `fetch` call doesn't include the browser cookies that store your SSO session credentials. If you want to include cookie info in the API calls, you can add the global `fetchWithCredentials` attribute to your service item. Here's an example below for PiHole. + +```yml +- name: "Pi-Hole" + logo: "assets/icons/pihole.svg" + url: "https://pihole.mydomain.com/admin" + type: "PiHole" + fetchWithCredentials: true +``` + +> **Note for developers:** Read the information in `docs/development.md` for how to make sure your service template works with `fetchWithCredentials` diff --git a/src/assets/app.scss b/src/assets/app.scss index c709282ec..d54de1102 100644 --- a/src/assets/app.scss +++ b/src/assets/app.scss @@ -13,7 +13,9 @@ text-overflow: ellipsis; } -html, body, body #app { +html, +body, +body #app { height: 100%; background-color: var(--background); } @@ -153,8 +155,8 @@ body { background-color: var(--highlight-hover); } } - .navbar-menu { - background-color: inherit; + .navbar-menu { + background-color: inherit; } } .navbar-end { diff --git a/src/components/services/AdGuardHome.vue b/src/components/services/AdGuardHome.vue index b01f0f49a..9a6eb1db9 100644 --- a/src/components/services/AdGuardHome.vue +++ b/src/components/services/AdGuardHome.vue @@ -20,12 +20,10 @@