Setup wizard & 0.3.0 release (#146)

* fix: small merge fixes

* feat: initial setup wizard

* fix: last few localization items

* fix: lint

* fix: bump version
This commit is contained in:
DecDuck
2025-07-31 20:41:02 +10:00
committed by GitHub
parent ed99e020df
commit e4c8d42cc8
25 changed files with 684 additions and 279 deletions

View File

@ -1,6 +1,18 @@
import { APITokenMode } from "~/prisma/client/enums";
import prisma from "~/server/internal/db/database";
import { systemConfig } from "../internal/config/sys-conf";
import { logger } from "../internal/logging";
export default defineNitroPlugin(async (_nitro) => {
await prisma.aPIToken.deleteMany({
where: {
acls: {
hasSome: ["setup"],
},
mode: APITokenMode.System,
},
});
const userCount = await prisma.user.count({
where: { id: { not: "system" } },
});
@ -10,18 +22,14 @@ export default defineNitroPlugin(async (_nitro) => {
// but has not been configured
// so it should be in-place
// Create admin invitation
await prisma.invitation.upsert({
where: {
id: "admin",
},
create: {
id: "admin",
isAdmin: true,
expires: new Date("4096-01-01"),
},
update: {
isAdmin: true,
const token = await prisma.aPIToken.create({
data: {
name: "Setup Wizard",
mode: APITokenMode.System,
acls: ["setup"],
},
});
const setupUrl = `${systemConfig.getExternalUrl()}/setup?token=${token.token}`;
logger.info(`Open ${setupUrl} in a browser to get started with Drop.`);
});