diff --git a/src/lib/components/svg/databases/Redis.svelte b/src/lib/components/svg/databases/Redis.svelte index 2571e601d..24a7dc797 100644 --- a/src/lib/components/svg/databases/Redis.svelte +++ b/src/lib/components/svg/databases/Redis.svelte @@ -4,9 +4,7 @@ + export let isAbsolute = false; + + + diff --git a/src/lib/database/common.ts b/src/lib/database/common.ts index 968208f55..314f77b08 100644 --- a/src/lib/database/common.ts +++ b/src/lib/database/common.ts @@ -11,11 +11,12 @@ import generator from 'generate-password'; import forge from 'node-forge'; import getPort, { portNumbers } from 'get-port'; -export function generatePassword(length = 24): string { +export function generatePassword(length = 24, symbols = false): string { return generator.generate({ length, numbers: true, - strict: true + strict: true, + symbols }); } diff --git a/src/lib/database/services.ts b/src/lib/database/services.ts index 9e3d1b467..df760cf76 100644 --- a/src/lib/database/services.ts +++ b/src/lib/database/services.ts @@ -15,7 +15,8 @@ const include: Prisma.ServiceInclude = { ghost: true, meiliSearch: true, umami: true, - hasura: true + hasura: true, + fider: true }; export async function listServicesWithIncludes() { return await prisma.service.findMany({ @@ -103,6 +104,12 @@ export async function getService({ id, teamId }: { id: string; teamId: string }) if (body.hasura?.graphQLAdminPassword) body.hasura.graphQLAdminPassword = decrypt(body.hasura.graphQLAdminPassword); + if (body.fider?.postgresqlPassword) + body.fider.postgresqlPassword = decrypt(body.fider.postgresqlPassword); + if (body.fider?.jwtSecret) body.fider.jwtSecret = decrypt(body.fider.jwtSecret); + if (body.fider?.emailSmtpPassword) + body.fider.emailSmtpPassword = decrypt(body.fider.emailSmtpPassword); + const settings = await prisma.setting.findFirst(); return { ...body, settings }; @@ -268,6 +275,25 @@ export async function configureServiceType({ } } }); + } else if (type === 'fider') { + const postgresqlUser = cuid(); + const postgresqlPassword = encrypt(generatePassword()); + const postgresqlDatabase = 'fider'; + const jwtSecret = encrypt(generatePassword(64, true)); + await prisma.service.update({ + where: { id }, + data: { + type, + fider: { + create: { + postgresqlDatabase, + postgresqlPassword, + postgresqlUser, + jwtSecret + } + } + } + }); } } @@ -326,52 +352,53 @@ export async function updateService({ return await prisma.service.update({ where: { id }, data: { fqdn, name } }); } -export async function updateLanguageToolService({ +export async function updateFiderService({ id, fqdn, - name + name, + emailNoreply, + emailMailgunApiKey, + emailMailgunDomain, + emailMailgunRegion, + emailSmtpHost, + emailSmtpPort, + emailSmtpUser, + emailSmtpPassword, + emailSmtpEnableStartTls }: { id: string; fqdn: string; name: string; + emailNoreply: string; + emailMailgunApiKey: string; + emailMailgunDomain: string; + emailMailgunRegion: string; + emailSmtpHost: string; + emailSmtpPort: number; + emailSmtpUser: string; + emailSmtpPassword: string; + emailSmtpEnableStartTls: boolean; }): Promise { - return await prisma.service.update({ where: { id }, data: { fqdn, name } }); -} - -export async function updateMeiliSearchService({ - id, - fqdn, - name -}: { - id: string; - fqdn: string; - name: string; -}): Promise { - return await prisma.service.update({ where: { id }, data: { fqdn, name } }); -} - -export async function updateVaultWardenService({ - id, - fqdn, - name -}: { - id: string; - fqdn: string; - name: string; -}): Promise { - return await prisma.service.update({ where: { id }, data: { fqdn, name } }); -} - -export async function updateVsCodeServer({ - id, - fqdn, - name -}: { - id: string; - fqdn: string; - name: string; -}): Promise { - return await prisma.service.update({ where: { id }, data: { fqdn, name } }); + return await prisma.service.update({ + where: { id }, + data: { + fqdn, + name, + fider: { + update: { + emailNoreply, + emailMailgunApiKey, + emailMailgunDomain, + emailMailgunRegion, + emailSmtpHost, + emailSmtpPort, + emailSmtpUser, + emailSmtpPassword, + emailSmtpEnableStartTls + } + } + } + }); } export async function updateWordpress({ @@ -423,6 +450,7 @@ export async function updateGhostService({ export async function removeService({ id }: { id: string }): Promise { await prisma.servicePersistentStorage.deleteMany({ where: { serviceId: id } }); await prisma.meiliSearch.deleteMany({ where: { serviceId: id } }); + await prisma.fider.deleteMany({ where: { serviceId: id } }); await prisma.ghost.deleteMany({ where: { serviceId: id } }); await prisma.umami.deleteMany({ where: { serviceId: id } }); await prisma.hasura.deleteMany({ where: { serviceId: id } }); diff --git a/src/lib/locales/en.json b/src/lib/locales/en.json index a5d6cbd50..22c7adf38 100644 --- a/src/lib/locales/en.json +++ b/src/lib/locales/en.json @@ -228,7 +228,8 @@ "permission_denied_start_database": "You do not have permission to start the database.", "delete_database": "Delete Database", "permission_denied_delete_database": "You do not have permission to delete a Database", - "no_databases_found": "No databases found" + "no_databases_found": "No databases found", + "logs": "Database Logs" }, "destination": { "delete_destination": "Delete Destination", @@ -293,7 +294,8 @@ "permission_denied_start_service": "You do not have permission to start the service.", "delete_service": "Delete Service", "permission_denied_delete_service": "You do not have permission to delete a service.", - "no_service": "No services found" + "no_service": "No services found", + "logs": "Service Logs" }, "setting": { "change_language": "Change Language", diff --git a/src/routes/applications/[id]/__layout.svelte b/src/routes/applications/[id]/__layout.svelte index bf634edde..cc8c19c19 100644 --- a/src/routes/applications/[id]/__layout.svelte +++ b/src/routes/applications/[id]/__layout.svelte @@ -394,7 +394,7 @@ >