mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-04 22:48:40 +08:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0fa6367ca | ||
|
|
8378066bd4 | ||
|
|
db85193bbf | ||
|
|
364c7ce183 | ||
|
|
48180604f9 | ||
|
|
88089a8a11 | ||
|
|
2829f0b649 | ||
|
|
0d5856db1e | ||
|
|
f3ec238a2c | ||
|
|
df714c7556 |
6
package-lock.json
generated
6
package-lock.json
generated
@@ -21,7 +21,7 @@
|
|||||||
"minecraft-ping-js": "^1.0.2",
|
"minecraft-ping-js": "^1.0.2",
|
||||||
"next": "^12.3.1",
|
"next": "^12.3.1",
|
||||||
"next-i18next": "^12.0.1",
|
"next-i18next": "^12.0.1",
|
||||||
"osx-temperature-sensor": "^1.0.8",
|
"osx-temperature-sensor": "*",
|
||||||
"pretty-bytes": "^6.0.0",
|
"pretty-bytes": "^6.0.0",
|
||||||
"raw-body": "^2.5.1",
|
"raw-body": "^2.5.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
@@ -52,6 +52,9 @@
|
|||||||
"tailwind-scrollbar": "^2.0.1",
|
"tailwind-scrollbar": "^2.0.1",
|
||||||
"tailwindcss": "^3.1.8",
|
"tailwindcss": "^3.1.8",
|
||||||
"typescript": "^4.8.3"
|
"typescript": "^4.8.3"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"osx-temperature-sensor": "^1.0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/runtime": {
|
"node_modules/@babel/runtime": {
|
||||||
@@ -4034,6 +4037,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/osx-temperature-sensor/-/osx-temperature-sensor-1.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/osx-temperature-sensor/-/osx-temperature-sensor-1.0.8.tgz",
|
||||||
"integrity": "sha512-Gl3b+bn7+oDDnqPa+4v/cg3yg9lnE8ppS7ivL3opBZh4i7h99JNmkm6zWmo0m2a83UUJu+C9D7lGP0OS8IlehA==",
|
"integrity": "sha512-Gl3b+bn7+oDDnqPa+4v/cg3yg9lnE8ppS7ivL3opBZh4i7h99JNmkm6zWmo0m2a83UUJu+C9D7lGP0OS8IlehA==",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
"darwin"
|
"darwin"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
"minecraft-ping-js": "^1.0.2",
|
"minecraft-ping-js": "^1.0.2",
|
||||||
"next": "^12.3.1",
|
"next": "^12.3.1",
|
||||||
"next-i18next": "^12.0.1",
|
"next-i18next": "^12.0.1",
|
||||||
"osx-temperature-sensor": "^1.0.8",
|
|
||||||
"pretty-bytes": "^6.0.0",
|
"pretty-bytes": "^6.0.0",
|
||||||
"raw-body": "^2.5.1",
|
"raw-body": "^2.5.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
@@ -54,5 +53,8 @@
|
|||||||
"tailwind-scrollbar": "^2.0.1",
|
"tailwind-scrollbar": "^2.0.1",
|
||||||
"tailwindcss": "^3.1.8",
|
"tailwindcss": "^3.1.8",
|
||||||
"typescript": "^4.8.3"
|
"typescript": "^4.8.3"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"osx-temperature-sensor": "^1.0.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
pnpm-lock.yaml
generated
14
pnpm-lock.yaml
generated
@@ -40,9 +40,6 @@ dependencies:
|
|||||||
next-i18next:
|
next-i18next:
|
||||||
specifier: ^12.0.1
|
specifier: ^12.0.1
|
||||||
version: 12.1.0(next@12.3.4)(react-dom@18.2.0)(react@18.2.0)
|
version: 12.1.0(next@12.3.4)(react-dom@18.2.0)(react@18.2.0)
|
||||||
osx-temperature-sensor:
|
|
||||||
specifier: ^1.0.8
|
|
||||||
version: 1.0.8
|
|
||||||
pretty-bytes:
|
pretty-bytes:
|
||||||
specifier: ^6.0.0
|
specifier: ^6.0.0
|
||||||
version: 6.1.0
|
version: 6.1.0
|
||||||
@@ -80,6 +77,11 @@ dependencies:
|
|||||||
specifier: ^1.6.11
|
specifier: ^1.6.11
|
||||||
version: 1.6.11
|
version: 1.6.11
|
||||||
|
|
||||||
|
optionalDependencies:
|
||||||
|
osx-temperature-sensor:
|
||||||
|
specifier: ^1.0.8
|
||||||
|
version: 1.0.8
|
||||||
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@tailwindcss/forms':
|
'@tailwindcss/forms':
|
||||||
specifier: ^0.5.3
|
specifier: ^0.5.3
|
||||||
@@ -645,6 +647,7 @@ packages:
|
|||||||
/autoprefixer@10.4.14(postcss@8.4.21):
|
/autoprefixer@10.4.14(postcss@8.4.21):
|
||||||
resolution: {integrity: sha512-FQzyfOsTlwVzjHxKEqRIAdJx9niO6VCBCoEwax/VLSoQF29ggECcPuBqUMZ+u8jCZOPSy8b8/8KnuFbp0SaFZQ==}
|
resolution: {integrity: sha512-FQzyfOsTlwVzjHxKEqRIAdJx9niO6VCBCoEwax/VLSoQF29ggECcPuBqUMZ+u8jCZOPSy8b8/8KnuFbp0SaFZQ==}
|
||||||
engines: {node: ^10 || ^12 || >=14}
|
engines: {node: ^10 || ^12 || >=14}
|
||||||
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
postcss: ^8.1.0
|
postcss: ^8.1.0
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -1221,6 +1224,7 @@ packages:
|
|||||||
|
|
||||||
/eslint-config-prettier@8.8.0(eslint@8.37.0):
|
/eslint-config-prettier@8.8.0(eslint@8.37.0):
|
||||||
resolution: {integrity: sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==}
|
resolution: {integrity: sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==}
|
||||||
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
eslint: '>=7.0.0'
|
eslint: '>=7.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -2374,6 +2378,7 @@ packages:
|
|||||||
/next@12.3.4(react-dom@18.2.0)(react@18.2.0):
|
/next@12.3.4(react-dom@18.2.0)(react@18.2.0):
|
||||||
resolution: {integrity: sha512-VcyMJUtLZBGzLKo3oMxrEF0stxh8HwuW976pAzlHhI3t8qJ4SROjCrSh1T24bhrbjw55wfZXAbXPGwPt5FLRfQ==}
|
resolution: {integrity: sha512-VcyMJUtLZBGzLKo3oMxrEF0stxh8HwuW976pAzlHhI3t8qJ4SROjCrSh1T24bhrbjw55wfZXAbXPGwPt5FLRfQ==}
|
||||||
engines: {node: '>=12.22.0'}
|
engines: {node: '>=12.22.0'}
|
||||||
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
fibers: '>= 3.1.0'
|
fibers: '>= 3.1.0'
|
||||||
node-sass: ^6.0.0 || ^7.0.0
|
node-sass: ^6.0.0 || ^7.0.0
|
||||||
@@ -2574,6 +2579,7 @@ packages:
|
|||||||
os: [darwin]
|
os: [darwin]
|
||||||
requiresBuild: true
|
requiresBuild: true
|
||||||
dev: false
|
dev: false
|
||||||
|
optional: true
|
||||||
|
|
||||||
/p-limit@3.1.0:
|
/p-limit@3.1.0:
|
||||||
resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
|
resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
|
||||||
@@ -3229,6 +3235,7 @@ packages:
|
|||||||
/tailwindcss@3.3.0(postcss@8.4.21):
|
/tailwindcss@3.3.0(postcss@8.4.21):
|
||||||
resolution: {integrity: sha512-hOXlFx+YcklJ8kXiCAfk/FMyr4Pm9ck477G0m/us2344Vuj355IpoEDB5UmGAsSpTBmr+4ZhjzW04JuFXkb/fw==}
|
resolution: {integrity: sha512-hOXlFx+YcklJ8kXiCAfk/FMyr4Pm9ck477G0m/us2344Vuj355IpoEDB5UmGAsSpTBmr+4ZhjzW04JuFXkb/fw==}
|
||||||
engines: {node: '>=12.13.0'}
|
engines: {node: '>=12.13.0'}
|
||||||
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
postcss: ^8.0.9
|
postcss: ^8.0.9
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -3450,6 +3457,7 @@ packages:
|
|||||||
|
|
||||||
/update-browserslist-db@1.0.10(browserslist@4.21.5):
|
/update-browserslist-db@1.0.10(browserslist@4.21.5):
|
||||||
resolution: {integrity: sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==}
|
resolution: {integrity: sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==}
|
||||||
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
browserslist: '>= 4.21.0'
|
browserslist: '>= 4.21.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ import { useTranslation } from "next-i18next";
|
|||||||
|
|
||||||
import UsageBar from "../resources/usage-bar";
|
import UsageBar from "../resources/usage-bar";
|
||||||
|
|
||||||
|
const cpuSensorLabels = ["cpu_thermal", "Core"];
|
||||||
|
|
||||||
|
function convertToFahrenheit(t) {
|
||||||
|
return t * 9/5 + 32
|
||||||
|
}
|
||||||
|
|
||||||
export default function Widget({ options }) {
|
export default function Widget({ options }) {
|
||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
|
|
||||||
@@ -65,11 +71,20 @@ export default function Widget({ options }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const unit = options.units === "imperial" ? "fahrenheit" : "celsius";
|
const unit = options.units === "imperial" ? "fahrenheit" : "celsius";
|
||||||
let mainTemp;
|
let mainTemp = 0;
|
||||||
let maxTemp = 80;
|
let maxTemp = 80;
|
||||||
if (options.cputemp && data.sensors) {
|
const cpuSensors = data.sensors?.filter(s => cpuSensorLabels.some(label => s.label.startsWith(label)) && s.type === "temperature_core");
|
||||||
mainTemp = unit === "celsius" ? data.sensors.find(s => s.label.includes("cpu_thermal")).value : data.sensors.find(s => s.label.includes("cpu_thermal")).value * 5/9 + 32;
|
if (options.cputemp && cpuSensors) {
|
||||||
if (data.sensors.warning) maxTemp = data.sensors.warning;
|
try {
|
||||||
|
mainTemp = cpuSensors.reduce((acc, s) => acc + s.value, 0) / cpuSensors.length;
|
||||||
|
maxTemp = Math.max(cpuSensors.reduce((acc, s) => acc + s.warning, 0) / cpuSensors.length, maxTemp);
|
||||||
|
if (unit === "fahrenheit") {
|
||||||
|
mainTemp = convertToFahrenheit(mainTemp);
|
||||||
|
maxTemp = convertToFahrenheit(maxTemp);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// cpu sensor retrieval failed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const tempPercent = Math.round((mainTemp / maxTemp) * 100);
|
const tempPercent = Math.round((mainTemp / maxTemp) * 100);
|
||||||
|
|
||||||
@@ -110,7 +125,7 @@ export default function Widget({ options }) {
|
|||||||
<UsageBar percent={data.quicklook.mem} />
|
<UsageBar percent={data.quicklook.mem} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{options.cputemp && mainTemp &&
|
{options.cputemp && mainTemp > 0 &&
|
||||||
(<div className="flex-none flex flex-row items-center mr-3 py-1.5">
|
(<div className="flex-none flex flex-row items-center mr-3 py-1.5">
|
||||||
<FaThermometerHalf className="text-theme-800 dark:text-theme-200 w-5 h-5" />
|
<FaThermometerHalf className="text-theme-800 dark:text-theme-200 w-5 h-5" />
|
||||||
<div className="flex flex-col ml-3 text-left min-w-[85px]">
|
<div className="flex flex-col ml-3 text-left min-w-[85px]">
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useTranslation } from "next-i18next";
|
|||||||
import UsageBar from "./usage-bar";
|
import UsageBar from "./usage-bar";
|
||||||
|
|
||||||
function convertToFahrenheit(t) {
|
function convertToFahrenheit(t) {
|
||||||
return t * 5/9 + 32
|
return t * 9/5 + 32
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function CpuTemp({ expanded, units }) {
|
export default function CpuTemp({ expanded, units }) {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export default function Memory({ expanded }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const percent = Math.round((data.memory.used / data.memory.total) * 100);
|
const percent = Math.round((data.memory.active / data.memory.total) * 100);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex-none flex flex-row items-center mr-3 py-1.5">
|
<div className="flex-none flex flex-row items-center mr-3 py-1.5">
|
||||||
@@ -52,7 +52,7 @@ export default function Memory({ expanded }) {
|
|||||||
<div className="flex flex-col ml-3 text-left min-w-[85px]">
|
<div className="flex flex-col ml-3 text-left min-w-[85px]">
|
||||||
<span className="text-theme-800 dark:text-theme-200 text-xs flex flex-row justify-between">
|
<span className="text-theme-800 dark:text-theme-200 text-xs flex flex-row justify-between">
|
||||||
<div className="pl-0.5 pr-1">
|
<div className="pl-0.5 pr-1">
|
||||||
{t("common.bytes", { value: data.memory.free, maximumFractionDigits: 1, binary: true })}
|
{t("common.bytes", { value: data.memory.available, maximumFractionDigits: 1, binary: true })}
|
||||||
</div>
|
</div>
|
||||||
<div className="pr-1">{t("resources.free")}</div>
|
<div className="pr-1">{t("resources.free")}</div>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import path from "path";
|
|||||||
import yaml from "js-yaml";
|
import yaml from "js-yaml";
|
||||||
import Docker from "dockerode";
|
import Docker from "dockerode";
|
||||||
import * as shvl from "shvl";
|
import * as shvl from "shvl";
|
||||||
import { NetworkingV1Api } from "@kubernetes/client-node";
|
import { CustomObjectsApi, NetworkingV1Api } from "@kubernetes/client-node";
|
||||||
|
|
||||||
import createLogger from "utils/logger";
|
import createLogger from "utils/logger";
|
||||||
import checkAndCopyConfig, { substituteEnvironmentVars } from "utils/config/config";
|
import checkAndCopyConfig, { substituteEnvironmentVars } from "utils/config/config";
|
||||||
@@ -145,6 +145,7 @@ export async function servicesFromKubernetes() {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const networking = kc.makeApiClient(NetworkingV1Api);
|
const networking = kc.makeApiClient(NetworkingV1Api);
|
||||||
|
const crd = kc.makeApiClient(CustomObjectsApi);
|
||||||
|
|
||||||
const ingressList = await networking.listIngressForAllNamespaces(null, null, null, null)
|
const ingressList = await networking.listIngressForAllNamespaces(null, null, null, null)
|
||||||
.then((response) => response.body)
|
.then((response) => response.body)
|
||||||
@@ -152,6 +153,20 @@ export async function servicesFromKubernetes() {
|
|||||||
logger.error("Error getting ingresses: %d %s %s", error.statusCode, error.body, error.response);
|
logger.error("Error getting ingresses: %d %s %s", error.statusCode, error.body, error.response);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const traefikIngressList = await crd.listClusterCustomObject("traefik.containo.us", "v1alpha1", "ingressroutes")
|
||||||
|
.then((response) => response.body)
|
||||||
|
.catch((error) => {
|
||||||
|
logger.error("Error getting traefik ingresses: %d %s %s", error.statusCode, error.body, error.response);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (traefikIngressList && traefikIngressList.items.length > 0) {
|
||||||
|
const traefikServices = traefikIngressList.items
|
||||||
|
.filter((ingress) => ingress.metadata.annotations && ingress.metadata.annotations[`${ANNOTATION_BASE}/href`])
|
||||||
|
ingressList.items.push(...traefikServices);
|
||||||
|
}
|
||||||
|
|
||||||
if (!ingressList) {
|
if (!ingressList) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -282,8 +297,8 @@ export function cleanServiceGroups(groups) {
|
|||||||
if (wan) cleanedService.widget.wan = wan;
|
if (wan) cleanedService.widget.wan = wan;
|
||||||
}
|
}
|
||||||
if (type === "emby" || type === "jellyfin") {
|
if (type === "emby" || type === "jellyfin") {
|
||||||
if (enableBlocks) cleanedService.widget.enableBlocks = enableBlocks === 'true';
|
if (enableBlocks) cleanedService.widget.enableBlocks = enableBlocks;
|
||||||
if (enableNowPlaying) cleanedService.widget.enableNowPlaying = enableNowPlaying === 'true';
|
if (enableNowPlaying) cleanedService.widget.enableNowPlaying = enableNowPlaying;
|
||||||
}
|
}
|
||||||
if (type === "diskstation") {
|
if (type === "diskstation") {
|
||||||
if (volume) cleanedService.widget.volume = volume;
|
if (volume) cleanedService.widget.volume = volume;
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ export default function Component({ service }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playing.length === -1)
|
if (playing.length > 0)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{enableBlocks && <CountBlocks service={service} countData={countData} />}
|
{enableBlocks && <CountBlocks service={service} countData={countData} />}
|
||||||
|
|||||||
Reference in New Issue
Block a user