mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
HealthLog — personal health-tracking PWA with weight, blood pressure, pulse, mood tracking, medication compliance, Withings integration, doctor report PDF export, and Dracula-themed UI.
68 lines
1.7 KiB
TypeScript
68 lines
1.7 KiB
TypeScript
import { prisma } from "@/lib/db";
|
|
|
|
export interface PublicMonitoringSettings {
|
|
umamiEnabled: boolean;
|
|
umamiScriptUrl: string | null;
|
|
umamiWebsiteId: string | null;
|
|
glitchtipEnabled: boolean;
|
|
}
|
|
|
|
export interface GlitchtipSettings {
|
|
glitchtipEnabled: boolean;
|
|
glitchtipDsn: string | null;
|
|
glitchtipEnvironment: string | null;
|
|
}
|
|
|
|
export async function getPublicMonitoringSettings(): Promise<PublicMonitoringSettings> {
|
|
try {
|
|
const settings = await prisma.appSettings.findUnique({
|
|
where: { id: "singleton" },
|
|
select: {
|
|
umamiEnabled: true,
|
|
umamiScriptUrl: true,
|
|
umamiWebsiteId: true,
|
|
glitchtipEnabled: true,
|
|
},
|
|
});
|
|
|
|
return {
|
|
umamiEnabled: settings?.umamiEnabled ?? false,
|
|
umamiScriptUrl: settings?.umamiScriptUrl ?? null,
|
|
umamiWebsiteId: settings?.umamiWebsiteId ?? null,
|
|
glitchtipEnabled: settings?.glitchtipEnabled ?? false,
|
|
};
|
|
} catch {
|
|
return {
|
|
umamiEnabled: false,
|
|
umamiScriptUrl: null,
|
|
umamiWebsiteId: null,
|
|
glitchtipEnabled: false,
|
|
};
|
|
}
|
|
}
|
|
|
|
export async function getGlitchtipSettings(): Promise<GlitchtipSettings> {
|
|
try {
|
|
const settings = await prisma.appSettings.findUnique({
|
|
where: { id: "singleton" },
|
|
select: {
|
|
glitchtipEnabled: true,
|
|
glitchtipDsn: true,
|
|
glitchtipEnvironment: true,
|
|
},
|
|
});
|
|
|
|
return {
|
|
glitchtipEnabled: settings?.glitchtipEnabled ?? false,
|
|
glitchtipDsn: settings?.glitchtipDsn ?? null,
|
|
glitchtipEnvironment: settings?.glitchtipEnvironment ?? null,
|
|
};
|
|
} catch {
|
|
return {
|
|
glitchtipEnabled: false,
|
|
glitchtipDsn: null,
|
|
glitchtipEnvironment: null,
|
|
};
|
|
}
|
|
}
|