From 67fc0b9bd3eb0df020c3978526c0fc77cf68c1bb Mon Sep 17 00:00:00 2001 From: kennyboy55 Date: Fri, 12 Jun 2026 19:04:41 +0200 Subject: [PATCH] Fix authentik search engine --- engines/authentik-searchengine/index.js | 6 ++---- engines/authentik-searchengine/test/test-runner.js | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/engines/authentik-searchengine/index.js b/engines/authentik-searchengine/index.js index 08a633b..a028416 100644 --- a/engines/authentik-searchengine/index.js +++ b/engines/authentik-searchengine/index.js @@ -1,5 +1,5 @@ const DEFAULT_URL = ""; -const API_PATH = "/api/v3/core/applications"; +const API_PATH = "/api/v3/core/applications/"; function isValidUrl(string) { try { @@ -55,15 +55,13 @@ export default class AuthentikEngine { context ) { try { - configured = await this.isConfigured(); + const configured = await this.isConfigured(); if(!configured){ return []; } const doFetch = context?.fetch ?? fetch; - var headers = {}; - const response = await doFetch(`${this.authentikSearchUrl}?search=${encodeURIComponent(query)}&page_size=20&page=${encodeURIComponent(page)}`, {headers: {"Accept": "application/json", "Authorization": `Bearer ${this.authentikToken}` }}) context?.sentinel?.(response, this.name) const response_json = await response.json() diff --git a/engines/authentik-searchengine/test/test-runner.js b/engines/authentik-searchengine/test/test-runner.js index 57450d7..bd801ca 100644 --- a/engines/authentik-searchengine/test/test-runner.js +++ b/engines/authentik-searchengine/test/test-runner.js @@ -6,7 +6,7 @@ const AuthentikEngine = require('../index.js').default; // --- CONFIGURATION --- const TEST_AUTHENTIK_URL = "https://authentik.furb.it"; // Change to your local instance if testing real connections -const API_PATH = "/api/v3/core/applications"; +const API_PATH = "/api/v3/core/applications/"; // Mock Settings (Replace with your config or local instance URL) const settings = { @@ -106,7 +106,7 @@ async function runSearchTest() { // Note: For a local test without a real API, you would typically need a Mock Server // Here we will attempt a call to the real hosted Authentik to verify logic. // Replace 'query' with a term that exists on public authentik.com - const query = "esphome"; + const query = "plex"; console.log(`\nExecuting search for: ${query}`); diff --git a/package.json b/package.json index 8804661..6f6070f 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "path": "engines/authentik-searchengine", "name": "Authentik", "description": "Search your private authentik instance", - "version": "1.0.0", + "version": "1.0.1", "screenshots": [ "screenshots/1.png" ]