mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 09:35:54 -08:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d94b3e829d | ||
|
|
10c63939dc | ||
|
|
972ede9249 | ||
|
|
8f001ad88a | ||
|
|
229c5dac59 | ||
|
|
0622395ec7 | ||
|
|
66073ed460 | ||
|
|
533f40b536 | ||
|
|
13afe82fa5 | ||
|
|
10c27dfd84 | ||
|
|
057d5eca8f | ||
|
|
e89f3668a9 | ||
|
|
76d534583b | ||
|
|
7b4f360a5e | ||
|
|
992b18c9de | ||
|
|
6291a5422a | ||
|
|
4581c4eeb0 |
@@ -9,11 +9,12 @@
|
|||||||
- Docker Integration
|
- Docker Integration
|
||||||
- Status light + CPU, Memory & Network Reporting *(click on the status light)*
|
- Status light + CPU, Memory & Network Reporting *(click on the status light)*
|
||||||
- Service Integration
|
- Service Integration
|
||||||
- Currently supports Sonarr, Radarr, Ombi, Emby, Jellyfin, Jellyseerr ([thanks to ilusi0n](https://github.com/benphelps/homepage/pull/34)), NZBGet, ruTorrent
|
- Currently supports Sonarr, Radarr, Ombi, Emby, Jellyfin, Jellyseerr ([by ilusi0n](https://github.com/benphelps/homepage/pull/34)), NZBGet, ruTorrent
|
||||||
- Portainer, Traefik, Speedtest Tracker, PiHole
|
- Portainer, Traefik, Speedtest Tracker, PiHole, Nginx Proxy Manager ([by aidenpwnz](https://github.com/benphelps/homepage/pull/45))
|
||||||
* Homepage Widgets
|
* Homepage Widgets
|
||||||
- System Stats (Disk, CPU, Memory)
|
- System Stats (Disk, CPU, Memory)
|
||||||
- Weather via WeatherAPI.com or OpenWeatherMap ([thanks to AlexFullmoon](https://github.com/benphelps/homepage/pull/25))
|
- Weather via WeatherAPI.com or OpenWeatherMap ([by AlexFullmoon](https://github.com/benphelps/homepage/pull/25))
|
||||||
|
- Search Bar ([by aidenpwnz](https://github.com/benphelps/homepage/pull/45))
|
||||||
* Customizable
|
* Customizable
|
||||||
- 21 theme colors with light and dark mode support
|
- 21 theme colors with light and dark mode support
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import Jellyfin from "./widgets/service/jellyfin";
|
|||||||
import Speedtest from "./widgets/service/speedtest";
|
import Speedtest from "./widgets/service/speedtest";
|
||||||
import Traefik from "./widgets/service/traefik";
|
import Traefik from "./widgets/service/traefik";
|
||||||
import Jellyseerr from "./widgets/service/jellyseerr";
|
import Jellyseerr from "./widgets/service/jellyseerr";
|
||||||
|
import Npm from "./widgets/service/npm";
|
||||||
|
|
||||||
const widgetMappings = {
|
const widgetMappings = {
|
||||||
docker: Docker,
|
docker: Docker,
|
||||||
@@ -25,7 +26,8 @@ const widgetMappings = {
|
|||||||
rutorrent: Rutorrent,
|
rutorrent: Rutorrent,
|
||||||
speedtest: Speedtest,
|
speedtest: Speedtest,
|
||||||
traefik: Traefik,
|
traefik: Traefik,
|
||||||
jellyseerr: Jellyseerr
|
jellyseerr: Jellyseerr,
|
||||||
|
npm: Npm,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Widget({ service }) {
|
export default function Widget({ service }) {
|
||||||
|
|||||||
65
src/components/services/widgets/service/npm.jsx
Normal file
65
src/components/services/widgets/service/npm.jsx
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
import useSWR from "swr";
|
||||||
|
|
||||||
|
import Widget from "../widget";
|
||||||
|
import Block from "../block";
|
||||||
|
|
||||||
|
export default function Npm({ service }) {
|
||||||
|
const config = service.widget;
|
||||||
|
const { url } = config;
|
||||||
|
|
||||||
|
const fetcher = async (reqUrl) => {
|
||||||
|
const { url, username, password } = config;
|
||||||
|
const loginUrl = `${url}/api/tokens`;
|
||||||
|
const body = { identity: username, secret: password };
|
||||||
|
|
||||||
|
const res = await fetch(loginUrl, {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(body),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then(
|
||||||
|
async (data) =>
|
||||||
|
await fetch(reqUrl, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Authorization: "Bearer " + data.token,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
return res.json();
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data: infoData, error: infoError } = useSWR(`${url}/api/nginx/proxy-hosts`, fetcher);
|
||||||
|
|
||||||
|
console.log(infoData);
|
||||||
|
|
||||||
|
if (infoError) {
|
||||||
|
return <Widget error="NGINX Proxy Manager API Error" />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!infoData) {
|
||||||
|
return (
|
||||||
|
<Widget>
|
||||||
|
<Block label="Enabled" />
|
||||||
|
<Block label="Disabled" />
|
||||||
|
<Block label="Total" />
|
||||||
|
</Widget>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const enabled = infoData.filter((c) => c.enabled === 1).length;
|
||||||
|
const disabled = infoData.filter((c) => c.enabled === 0).length;
|
||||||
|
const total = infoData.length;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Widget>
|
||||||
|
<Block label="Enabled" value={enabled} />
|
||||||
|
<Block label="Disabled" value={disabled} />
|
||||||
|
<Block label="Total" value={total} />
|
||||||
|
</Widget>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
import WeatherApi from "components/widgets/weather/weather";
|
import WeatherApi from "components/widgets/weather/weather";
|
||||||
import OpenWeatherMap from "components/widgets/openweathermap/weather";
|
import OpenWeatherMap from "components/widgets/openweathermap/weather";
|
||||||
import Resources from "components/widgets/resources/resources";
|
import Resources from "components/widgets/resources/resources";
|
||||||
|
import Search from "components/widgets/search/search";
|
||||||
|
|
||||||
const widgetMappings = {
|
const widgetMappings = {
|
||||||
weather: WeatherApi, // This key will be deprecated in the future
|
weather: WeatherApi, // This key will be deprecated in the future
|
||||||
weatherapi: WeatherApi,
|
weatherapi: WeatherApi,
|
||||||
openweathermap: OpenWeatherMap,
|
openweathermap: OpenWeatherMap,
|
||||||
resources: Resources,
|
resources: Resources,
|
||||||
|
search: Search,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Widget({ widget }) {
|
export default function Widget({ widget }) {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default function OpenWeatherMap({ options }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col justify-center">
|
||||||
<div className="flex flex-row items-center justify-end">
|
<div className="flex flex-row items-center justify-end">
|
||||||
<div className="flex flex-col items-center">
|
<div className="flex flex-col items-center">
|
||||||
<Icon
|
<Icon
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import Memory from "./memory";
|
|||||||
export default function Resources({ options }) {
|
export default function Resources({ options }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="pr-2 flex flex-col">
|
<div className="flex flex-col max-w:full basis-1/2 sm:basis-auto self-center">
|
||||||
<div className="flex flex-row space-x-4">
|
<div className="flex flex-row space-x-4 self-center">
|
||||||
{options.disk && <Disk options={options} />}
|
|
||||||
{options.cpu && <Cpu />}
|
{options.cpu && <Cpu />}
|
||||||
{options.memory && <Memory />}
|
{options.memory && <Memory />}
|
||||||
|
{options.disk && <Disk options={options} />}
|
||||||
</div>
|
</div>
|
||||||
{options.label && (
|
{options.label && (
|
||||||
<div className="border-t-2 border-theme-800 dark:border-theme-200 mt-1 pt-1 text-center text-theme-800 dark:text-theme-200 text-xs">
|
<div className="border-t-2 border-theme-800 dark:border-theme-200 mt-1 pt-1 text-center text-theme-800 dark:text-theme-200 text-xs">
|
||||||
|
|||||||
69
src/components/widgets/search/search.jsx
Normal file
69
src/components/widgets/search/search.jsx
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import { useState } from "react";
|
||||||
|
import { FiSearch } from "react-icons/fi";
|
||||||
|
import { SiDuckduckgo, SiMicrosoftbing, SiGoogle } from "react-icons/si";
|
||||||
|
|
||||||
|
const providers = {
|
||||||
|
google: {
|
||||||
|
name: "Google",
|
||||||
|
url: "https://www.google.com/search?q=",
|
||||||
|
icon: SiGoogle,
|
||||||
|
},
|
||||||
|
duckduckgo: {
|
||||||
|
name: "DuckDuckGo",
|
||||||
|
url: "https://duckduckgo.com/?q=",
|
||||||
|
icon: SiDuckduckgo,
|
||||||
|
},
|
||||||
|
bing: {
|
||||||
|
name: "Bing",
|
||||||
|
url: "https://www.bing.com/search?q=",
|
||||||
|
icon: SiMicrosoftbing,
|
||||||
|
},
|
||||||
|
custom: {
|
||||||
|
name: "Custom",
|
||||||
|
url: false,
|
||||||
|
icon: FiSearch,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function Search({ options }) {
|
||||||
|
const provider = providers[options.provider];
|
||||||
|
const [query, setQuery] = useState("");
|
||||||
|
|
||||||
|
if (!provider) {
|
||||||
|
return <></>;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSubmit(event) {
|
||||||
|
const q = encodeURIComponent(query);
|
||||||
|
|
||||||
|
if (provider.url) {
|
||||||
|
window.open(`${provider.url}${q}`, options.target || "_blank");
|
||||||
|
} else {
|
||||||
|
window.open(`${options.url}${q}`, options.target || "_blank");
|
||||||
|
}
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
event.target.reset();
|
||||||
|
setQuery("");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<form className="flex-col relative h-8 my-4 min-w-full md:min-w-fit grow" onSubmit={handleSubmit}>
|
||||||
|
<div className="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none w-full text-theme-800 dark:text-theme-200"></div>
|
||||||
|
<input
|
||||||
|
type="search"
|
||||||
|
autoFocus
|
||||||
|
className={`overflow-hidden w-full placeholder-theme-900 text-xs text-theme-900 bg-theme-50 rounded-md border border-theme-300 focus:ring-theme-500 focus:border-theme-500 dark:bg-theme-800 dark:border-theme-600 dark:placeholder-theme-400 dark:text-white dark:focus:ring-theme-500 dark:focus:border-theme-500 h-full`}
|
||||||
|
placeholder="Search..."
|
||||||
|
onChange={(s) => setQuery(s.currentTarget.value)}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
className="text-white absolute right-0.5 bottom-0.5 bg-theme-700 hover:bg-theme-800 border-1 focus:ring-2 focus:ring-theme-300 font-medium rounded-r-md text-sm px-4 py-2 dark:bg-theme-600 dark:hover:bg-theme-700 dark:focus:ring-theme-500"
|
||||||
|
>
|
||||||
|
<provider.icon className="text-theme-800 dark:text-theme-200 w-3 h-3" />
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -33,7 +33,7 @@ export default function WeatherApi({ options }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col justify-center">
|
||||||
<div className="flex flex-row items-center justify-end">
|
<div className="flex flex-row items-center justify-end">
|
||||||
<div className="flex flex-col items-center">
|
<div className="flex flex-col items-center">
|
||||||
<Icon condition={data.current.condition.code} timeOfDay={data.current.is_day ? "day" : "night"} />
|
<Icon condition={data.current.condition.code} timeOfDay={data.current.is_day ? "day" : "night"} />
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import ServicesGroup from "components/services/group";
|
|||||||
import BookmarksGroup from "components/bookmarks/group";
|
import BookmarksGroup from "components/bookmarks/group";
|
||||||
import Widget from "components/widget";
|
import Widget from "components/widget";
|
||||||
import { ColorProvider } from "utils/color-context";
|
import { ColorProvider } from "utils/color-context";
|
||||||
|
import Search from "components/widgets/search/search";
|
||||||
|
|
||||||
const ThemeToggle = dynamic(() => import("components/theme-toggle"), {
|
const ThemeToggle = dynamic(() => import("components/theme-toggle"), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
@@ -17,7 +18,8 @@ const ColorToggle = dynamic(() => import("components/color-toggle"), {
|
|||||||
ssr: false,
|
ssr: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const rightAlignedWidgets = ["weatherapi", "openweathermap", "weather"];
|
const rightAlignedWidgets = ["weatherapi", "openweathermap", "weather", "search"];
|
||||||
|
const expandedWidgets = ["search"];
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const { data: services, error: servicesError } = useSWR("/api/services");
|
const { data: services, error: servicesError } = useSWR("/api/services");
|
||||||
@@ -31,7 +33,7 @@ export default function Home() {
|
|||||||
<title>Welcome</title>
|
<title>Welcome</title>
|
||||||
</Head>
|
</Head>
|
||||||
<div className="w-full container m-auto flex flex-col h-screen justify-between">
|
<div className="w-full container m-auto flex flex-col h-screen justify-between">
|
||||||
<div className="flex flex-wrap space-x-4 m-8 pb-4 mt-10 border-b-2 border-theme-800 dark:border-theme-200">
|
<div className="flex flex-row flex-wrap space-x-0 sm:space-x-4 m-8 pb-4 mt-10 border-b-2 border-theme-800 dark:border-theme-200 justify-between md:justify-start">
|
||||||
{widgets && (
|
{widgets && (
|
||||||
<>
|
<>
|
||||||
{widgets
|
{widgets
|
||||||
@@ -39,12 +41,14 @@ export default function Home() {
|
|||||||
.map((widget, i) => (
|
.map((widget, i) => (
|
||||||
<Widget key={i} widget={widget} />
|
<Widget key={i} widget={widget} />
|
||||||
))}
|
))}
|
||||||
<div className="grow"></div>
|
|
||||||
{widgets
|
<div className="flex flex-wrap basis-full space-x-0 sm:space-x-4 grow sm:basis-auto justify-between md:justify-end mt-2 md:mt-0">
|
||||||
.filter((widget) => rightAlignedWidgets.includes(widget.type))
|
{widgets
|
||||||
.map((widget, i) => (
|
.filter((widget) => rightAlignedWidgets.includes(widget.type))
|
||||||
<Widget key={i} widget={widget} />
|
.map((widget, i) => (
|
||||||
))}
|
<Widget key={i} widget={widget} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,15 +3,20 @@
|
|||||||
|
|
||||||
- My First Group:
|
- My First Group:
|
||||||
- My First Service:
|
- My First Service:
|
||||||
href: http://localhosdt/
|
href: http://localhost/
|
||||||
description: Homepage is awesome
|
description: Homepage is awesome
|
||||||
|
# widget:
|
||||||
|
# type: npm # npm for NGINX Proxy Manager
|
||||||
|
# url: http://localhost # no slash at the end
|
||||||
|
# username: email@example.com # your email
|
||||||
|
# password: secretpassword # your password
|
||||||
|
|
||||||
- My Second Group:
|
- My Second Group:
|
||||||
- My Second Service:
|
- My Second Service:
|
||||||
href: http://localhosdt/
|
href: http://localhost/
|
||||||
description: Homepage is the best
|
description: Homepage is the best
|
||||||
|
|
||||||
- My Third Group:
|
- My Third Group:
|
||||||
- My Third Service:
|
- My Third Service:
|
||||||
href: http://localhosdt/
|
href: http://localhost/
|
||||||
description: Homepage is 😎
|
description: Homepage is 😎
|
||||||
|
|||||||
@@ -5,3 +5,9 @@
|
|||||||
cpu: true
|
cpu: true
|
||||||
memory: true
|
memory: true
|
||||||
disk: /
|
disk: /
|
||||||
|
# - search: # Searchbar in widgets area
|
||||||
|
# provider: custom # Can be google, duckduckgo, bing or custom.
|
||||||
|
# target: _blank # Can be _blank, _top, _self or _parent.
|
||||||
|
# customdata:
|
||||||
|
# url: https://startpage.com/search?q= # Required for custom provider. Remember to add the q param as per your provider.
|
||||||
|
# abbr: G # Can be omitted. Only the first 2 characters will be considered.
|
||||||
|
|||||||
Reference in New Issue
Block a user