Merge branch 'benphelps:main' into main

pull/832/head
Ulysse Mensa 1 year ago committed by GitHub
commit 82a6553c58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -7,12 +7,10 @@ WORKDIR /app
COPY --link package.json pnpm-lock.yaml* ./
RUN <<EOF
set -xe
apk add libc6-compat
apk add --virtual .gyp python3 make g++
npm install -g pnpm
EOF
SHELL ["/bin/ash", "-xeo", "pipefail", "-c"]
RUN apk add --no-cache libc6-compat \
&& apk add --no-cache --virtual .gyp python3 make g++ \
&& npm install -g pnpm
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store pnpm fetch | grep -v "cross-device link not permitted\|Falling back to copying packages from store"
@ -29,12 +27,10 @@ ARG REVISION
COPY --link --from=deps /app/node_modules ./node_modules/
COPY . .
RUN <<EOF
set -xe
npm run telemetry
mkdir config && echo '-' > config/settings.yaml
NEXT_PUBLIC_BUILDTIME=$BUILDTIME NEXT_PUBLIC_VERSION=$VERSION NEXT_PUBLIC_REVISION=$REVISION npm run build
EOF
SHELL ["/bin/ash", "-xeo", "pipefail", "-c"]
RUN npm run telemetry \
&& mkdir config && echo '---' > config/settings.yaml \
&& NEXT_PUBLIC_BUILDTIME=$BUILDTIME NEXT_PUBLIC_VERSION=$VERSION NEXT_PUBLIC_REVISION=$REVISION npm run build
# Production image, copy all the files and run next
FROM docker.io/node:18-alpine AS runner
@ -50,12 +46,15 @@ ENV NODE_ENV production
WORKDIR /app
# Copy files from context (this allows the files to copy before the builder stage is done).
COPY --link package.json next.config.js ./
COPY --link /public ./public
COPY --link --chown=1000:1000 package.json next.config.js ./
COPY --link --chown=1000:1000 /public ./public/
# Copy files from builder
COPY --link --from=builder /app/.next/standalone ./
COPY --link --from=builder /app/.next/static/ ./.next/static/
COPY --link --from=builder --chown=1000:1000 /app/.next/standalone ./
COPY --link --from=builder --chown=1000:1000 /app/.next/static/ ./.next/static/
COPY --link --chmod=755 docker-entrypoint.sh /usr/local/bin/
RUN apk add --no-cache su-exec
ENV PORT 3000
EXPOSE $PORT
@ -63,4 +62,5 @@ EXPOSE $PORT
HEALTHCHECK --interval=10s --timeout=3s --start-period=20s \
CMD wget --no-verbose --tries=1 --spider --no-check-certificate http://localhost:$PORT/api/healthcheck || exit 1
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["node", "server.js"]

@ -2,8 +2,22 @@
set -e
# Default to root, so old installations won't break
export PUID=${PUID:-0}
export PGID=${PGID:-0}
# This is in attempt to preserve the original behavior of the Dockerfile,
# while also supporting the lscr.io /config directory
[ ! -d "/app/config" ] && ln -s /config /app/config
node server.js
# Set privileges for /app but only if pid 1 user is root and we are dropping privileges.
# If container is run as an unprivileged user, it means owner already handled ownership setup on their own.
# Running chown in that case (as non-root) will cause error
[ "$(id -u)" == "0" ] && [ "${PUID}" != "0" ] && chown -R ${PUID}:${PGID} /app
# Drop privileges (when asked to) if root, otherwise run as current user
if [ "$(id -u)" == "0" ] && [ "${PUID}" != "0" ]; then
su-exec ${PUID}:${PGID} "$@"
else
exec "$@"
fi

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"print_progress": "Progress",
"printer_state": "Printer State",
"print_status": "Print Status",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"print_progress": "Progress",
"printer_state": "Printer State",
"print_status": "Print Status",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -417,5 +417,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"layers": "Layers",
"print_progress": "Progress"
}
}

@ -164,7 +164,7 @@
"qbittorrent": {
"download": "Bajada",
"upload": "Subida",
"leech": "Leech",
"leech": "Depender",
"seed": "Semillas"
},
"mastodon": {
@ -347,14 +347,14 @@
"deluge": {
"download": "Descarga",
"upload": "Subida",
"leech": "Leech",
"leech": "Depender",
"seed": "Semilla"
},
"flood": {
"download": "Descargar",
"upload": "Subir",
"leech": "Leech",
"seed": "Seed"
"leech": "Depender",
"seed": "Semillas"
},
"tdarr": {
"queue": "Cola",
@ -403,5 +403,11 @@
"memory": "Memoria activa",
"wanUpload": "Carga WAN",
"wanDownload": "Descargar WAN"
},
"moonraker": {
"printer_state": "Estado de la impresora",
"print_status": "Estado de la impresora",
"print_progress": "Progreso",
"layers": "Capas"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Mém. Utilisée",
"wanUpload": "WAN Envoi",
"wanDownload": "WAN Récep."
},
"moonraker": {
"printer_state": "État Imprimante",
"print_status": "Statut Imprimante",
"print_progress": "Progression",
"layers": "Couches"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Aktivna memorija",
"wanUpload": "WAN prijenos",
"wanDownload": "WAN preuzimanje"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"layers": "Layers",
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress"
}
}

@ -403,5 +403,11 @@
"memory": "Memoria in uso",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -412,5 +412,11 @@
"memory": "Memória Ativa",
"wanUpload": "Envio WAN",
"wanDownload": "WAN Descarga"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"print_progress": "Progress",
"printer_state": "Printer State",
"print_status": "Print Status",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Активна пам'ять",
"wanUpload": "Вивантаження WAN",
"wanDownload": "Завантаження WAN"
},
"moonraker": {
"printer_state": "Стан принтера",
"print_status": "Статус друку",
"print_progress": "Прогрес",
"layers": "Шари"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"print_progress": "Progress",
"layers": "Layers",
"printer_state": "Printer State",
"print_status": "Print Status"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN Upload",
"wanDownload": "WAN Download"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -403,5 +403,11 @@
"memory": "Active Memory",
"wanUpload": "WAN上傳",
"wanDownload": "WAN下載"
},
"moonraker": {
"printer_state": "Printer State",
"print_status": "Print Status",
"print_progress": "Progress",
"layers": "Layers"
}
}

@ -19,7 +19,7 @@ export default function Item({ bookmark }) {
<div className="flex-shrink-0 flex items-center justify-center w-11 bg-theme-500/10 dark:bg-theme-900/50 text-theme-700 hover:text-theme-700 dark:text-theme-200 text-sm font-medium rounded-l-md">
{bookmark.icon &&
<div className="flex-shrink-0 w-5 h-5">
<ResolvedIcon icon={bookmark.icon} />
<ResolvedIcon icon={bookmark.icon} alt={bookmark.abbr} />
</div>
}
{!bookmark.icon && bookmark.abbr}

@ -1,9 +1,9 @@
import Image from "next/future/image";
export default function ResolvedIcon({ icon, width = 32, height = 32 }) {
export default function ResolvedIcon({ icon, width = 32, height = 32, alt = "logo" }) {
// direct or relative URLs
if (icon.startsWith("http") || icon.startsWith("/")) {
return <Image src={`${icon}`} width={width} height={height} alt="logo" />;
return <Image src={`${icon}`} width={width} height={height} alt={alt} />;
}
// mdi- prefixed, material design icons
@ -31,7 +31,7 @@ export default function ResolvedIcon({ icon, width = 32, height = 32 }) {
src={`https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/${iconName}.png`}
width={width}
height={height}
alt="logo"
alt={alt}
/>
);
}
}

@ -24,6 +24,7 @@ const components = {
medusa: dynamic(() => import("./medusa/component")),
miniflux: dynamic(() => import("./miniflux/component")),
mikrotik: dynamic(() => import("./mikrotik/component")),
moonraker: dynamic(() => import("./moonraker/component")),
navidrome: dynamic(() => import("./navidrome/component")),
nextdns: dynamic(() => import("./nextdns/component")),
npm: dynamic(() => import("./npm/component")),

@ -0,0 +1,51 @@
import { useTranslation } from "next-i18next";
import Container from "components/services/widget/container";
import Block from "components/services/widget/block";
import useWidgetAPI from "utils/proxy/use-widget-api";
export default function Component({ service }) {
const { t } = useTranslation();
const { widget } = service;
const { data: printStats, error: printStatsError } = useWidgetAPI(widget, "print_stats");
const { data: displayStatus, error: displayStatsError } = useWidgetAPI(widget, "display_status");
const { data: webHooks, error: webHooksError } = useWidgetAPI(widget, "webhooks");
if (printStatsError || displayStatsError || webHooksError) {
const finalError = printStatsError ?? displayStatsError ?? webHooksError;
return <Container error={finalError} />;
}
if (!printStats || !displayStatus || !webHooks) {
return (
<Container service={service}>
<Block label="moonraker.printer_state" />
</Container>
);
}
if (webHooks.result.status.webhooks.state === "shutdown") {
return (
<Container service={service}>
<Block label="moonraker.printer_state" value={webHooks.result.status.webhooks.state} />
</Container>
);
}
let currentLayer = "-";
let totalLayer = "-";
if (printStats.result.status.print_stats.info.total_layer !== null) {
currentLayer = printStats.result.status.print_stats.info.current_layer;
totalLayer = printStats.result.status.print_stats.info.total_layer;
}
return (
<Container service={service}>
<Block label="moonraker.layers" value={`${currentLayer} / ${totalLayer}`} />
<Block label="moonraker.print_progress" value={t("common.percent", { value: (displayStatus.result.status.display_status.progress * 100) })} />
<Block label="moonraker.print_status" value={printStats.result.status.print_stats.state} />
</Container>
);
}

@ -0,0 +1,20 @@
import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = {
api: "{url}/printer/objects/query?{endpoint}",
proxyHandler: genericProxyHandler,
mappings: {
print_stats: {
endpoint: "print_stats",
},
display_status: {
endpoint: "display_status",
},
webhooks: {
endpoint: "webhooks",
},
},
};
export default widget;

@ -19,6 +19,7 @@ import mastodon from "./mastodon/widget";
import medusa from "./medusa/widget";
import miniflux from "./miniflux/widget";
import mikrotik from "./mikrotik/widget";
import moonraker from "./moonraker/widget";
import navidrome from "./navidrome/widget";
import nextdns from "./nextdns/widget";
import npm from "./npm/widget";
@ -77,6 +78,7 @@ const widgets = {
medusa,
miniflux,
mikrotik,
moonraker,
navidrome,
nextdns,
npm,

Loading…
Cancel
Save