🔀 Merge branch 'dev' into feature/add-basic-authentication
This commit is contained in:
@@ -2,6 +2,8 @@ FROM node:20.5-slim
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Define node.js environment variables
|
# Define node.js environment variables
|
||||||
|
ARG PORT=7575
|
||||||
|
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
ENV NODE_OPTIONS '--no-experimental-fetch'
|
ENV NODE_OPTIONS '--no-experimental-fetch'
|
||||||
@@ -22,11 +24,15 @@ RUN apt-get update -y && apt-get install -y openssl
|
|||||||
RUN yarn global add prisma
|
RUN yarn global add prisma
|
||||||
|
|
||||||
# Expose the default application port
|
# Expose the default application port
|
||||||
EXPOSE 7575
|
EXPOSE $PORT
|
||||||
|
ENV PORT=${PORT}
|
||||||
|
|
||||||
ENV DATABASE_URL "file:../database/db.sqlite"
|
ENV DATABASE_URL "file:../database/db.sqlite"
|
||||||
ENV NEXTAUTH_URL "http://localhost:3000"
|
ENV NEXTAUTH_URL "http://localhost:3000"
|
||||||
ENV PORT 7575
|
ENV PORT 7575
|
||||||
ENV NEXTAUTH_SECRET NOT_IN_USE_BECAUSE_JWTS_ARE_UNUSED
|
ENV NEXTAUTH_SECRET NOT_IN_USE_BECAUSE_JWTS_ARE_UNUSED
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=10s --timeout=5s --start-period=5s --retries=3 \
|
||||||
|
CMD wget --no-verbose --tries=1 --spider http://localhost:${PORT} || exit 1
|
||||||
|
|
||||||
CMD ["sh", "./scripts/run.sh"]
|
CMD ["sh", "./scripts/run.sh"]
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
{
|
{
|
||||||
"descriptor": {
|
"descriptor": {
|
||||||
"name": "DNS hole controls",
|
"name": "DNS hole controls",
|
||||||
"description": "Control PiHole or AdGuard from your dashboard"
|
"description": "Control PiHole or AdGuard from your dashboard",
|
||||||
|
"settings": {
|
||||||
|
"title": "DNS hole controls settings",
|
||||||
|
"showToggleAllButtons": {
|
||||||
|
"label": "Show 'Enable/Disable All' Buttons"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,12 @@ import { useDnsHoleSummeryQuery } from './DnsHoleSummary';
|
|||||||
const definition = defineWidget({
|
const definition = defineWidget({
|
||||||
id: 'dns-hole-controls',
|
id: 'dns-hole-controls',
|
||||||
icon: IconDeviceGamepad,
|
icon: IconDeviceGamepad,
|
||||||
options: {},
|
options: {
|
||||||
|
showToggleAllButtons: {
|
||||||
|
type: 'switch',
|
||||||
|
defaultValue: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
gridstack: {
|
gridstack: {
|
||||||
minWidth: 2,
|
minWidth: 2,
|
||||||
minHeight: 1,
|
minHeight: 1,
|
||||||
@@ -106,7 +111,7 @@ function DnsHoleControlsWidgetTile({ widget }: DnsHoleControlsWidgetProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack justify="space-between" h={'100%'} spacing="0.25rem">
|
<Stack justify="space-between" h={'100%'} spacing="0.25rem">
|
||||||
{sessionData?.user?.isAdmin && (
|
{sessionData?.user?.isAdmin && widget.properties.showToggleAllButtons && (
|
||||||
<SimpleGrid
|
<SimpleGrid
|
||||||
ref={ref}
|
ref={ref}
|
||||||
cols={width > 275 ? 2 : 1}
|
cols={width > 275 ? 2 : 1}
|
||||||
@@ -156,7 +161,14 @@ function DnsHoleControlsWidgetTile({ widget }: DnsHoleControlsWidgetProps) {
|
|||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Stack spacing="0.25rem">
|
<Stack
|
||||||
|
spacing="0.25rem"
|
||||||
|
display="flex"
|
||||||
|
style={{
|
||||||
|
flex: '1',
|
||||||
|
justifyContent: widget.properties.showToggleAllButtons ? 'flex-end' : 'space-evenly',
|
||||||
|
}}
|
||||||
|
>
|
||||||
{data.status.map((dnsHole, index) => {
|
{data.status.map((dnsHole, index) => {
|
||||||
const app = config?.apps.find((x) => x.id === dnsHole.appId);
|
const app = config?.apps.find((x) => x.id === dnsHole.appId);
|
||||||
|
|
||||||
@@ -165,7 +177,7 @@ function DnsHoleControlsWidgetTile({ widget }: DnsHoleControlsWidgetProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card withBorder={true} key={dnsHole.appId} p="xs">
|
<Card withBorder={true} key={dnsHole.appId} p="xs" radius="md">
|
||||||
<Group>
|
<Group>
|
||||||
<Box
|
<Box
|
||||||
sx={(theme) => ({
|
sx={(theme) => ({
|
||||||
@@ -182,15 +194,18 @@ function DnsHoleControlsWidgetTile({ widget }: DnsHoleControlsWidgetProps) {
|
|||||||
<Text>{app.name}</Text>
|
<Text>{app.name}</Text>
|
||||||
<UnstyledButton
|
<UnstyledButton
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await mutateAsync({
|
await mutateAsync(
|
||||||
action: dnsHole.status === 'enabled' ? 'disable' : 'enable',
|
{
|
||||||
configName,
|
action: dnsHole.status === 'enabled' ? 'disable' : 'enable',
|
||||||
appsToChange: [app.id],
|
configName,
|
||||||
},{
|
appsToChange: [app.id],
|
||||||
onSettled: () => {
|
},
|
||||||
reFetchSummaryDns();
|
{
|
||||||
|
onSettled: () => {
|
||||||
|
reFetchSummaryDns();
|
||||||
|
},
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
}}
|
}}
|
||||||
disabled={fetchingDnsSummary || changingStatus}
|
disabled={fetchingDnsSummary || changingStatus}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user