mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-06 20:28:48 +00:00
Compatible with quicklaunch internet search
This commit is contained in:
parent
87dbbcb1e0
commit
7a5a3a6608
2 changed files with 29 additions and 21 deletions
|
@ -22,7 +22,7 @@ import { bookmarksResponse, servicesResponse, widgetsResponse } from "utils/conf
|
|||
import ErrorBoundary from "components/errorboundry";
|
||||
import themes from "utils/styles/themes";
|
||||
import QuickLaunch from "components/quicklaunch";
|
||||
import { searchProviders } from "components/widgets/search/search";
|
||||
import { getStoredProvider, searchProviders } from "components/widgets/search/search";
|
||||
|
||||
const ThemeToggle = dynamic(() => import("components/toggles/theme"), {
|
||||
ssr: false,
|
||||
|
@ -197,12 +197,17 @@ function Home({ initialSettings }) {
|
|||
let searchProvider = null;
|
||||
const searchWidget = Object.values(widgets).find(w => w.type === "search");
|
||||
if (searchWidget) {
|
||||
if (searchWidget.options?.provider === 'custom') {
|
||||
searchProvider = {
|
||||
url: searchWidget.options.url
|
||||
}
|
||||
if (Array.isArray(searchWidget.options?.provider)) {
|
||||
// if search provider is a list, try to retrieve from localstorage, fall back to the first
|
||||
searchProvider = getStoredProvider() ?? searchProviders[searchWidget.options.provider[0]];
|
||||
} else {
|
||||
searchProvider = searchProviders[searchWidget.options?.provider];
|
||||
if (searchWidget.options?.provider === 'custom') {
|
||||
searchProvider = {
|
||||
url: searchWidget.options.url
|
||||
}
|
||||
} else {
|
||||
searchProvider = searchProviders[searchWidget.options?.provider];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue