mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-30 22:46:40 +00:00
Add basic provisioning room v1 and update keys
This commit is contained in:
@@ -82,7 +82,8 @@ export async function registerNewt(
|
||||
orgId: siteProvisioningKeyOrg.orgId,
|
||||
maxBatchSize: siteProvisioningKeys.maxBatchSize,
|
||||
numUsed: siteProvisioningKeys.numUsed,
|
||||
validUntil: siteProvisioningKeys.validUntil
|
||||
validUntil: siteProvisioningKeys.validUntil,
|
||||
approveNewSites: siteProvisioningKeys.approveNewSites,
|
||||
})
|
||||
.from(siteProvisioningKeys)
|
||||
.innerJoin(
|
||||
@@ -197,7 +198,7 @@ export async function registerNewt(
|
||||
niceId,
|
||||
type: "newt",
|
||||
dockerSocketEnabled: true,
|
||||
status: "pending"
|
||||
status: keyRecord.approveNewSites ? "approved" : "pending",
|
||||
})
|
||||
.returning();
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ export async function createSite(
|
||||
address: updatedAddress || null,
|
||||
type,
|
||||
dockerSocketEnabled: true,
|
||||
status: "accepted"
|
||||
status: "approved"
|
||||
})
|
||||
.returning();
|
||||
} else if (type == "wireguard") {
|
||||
@@ -357,7 +357,7 @@ export async function createSite(
|
||||
subnet,
|
||||
type,
|
||||
pubKey: pubKey || null,
|
||||
status: "accepted"
|
||||
status: "approved"
|
||||
})
|
||||
.returning();
|
||||
} else if (type == "local") {
|
||||
@@ -373,7 +373,7 @@ export async function createSite(
|
||||
dockerSocketEnabled: false,
|
||||
online: true,
|
||||
subnet: "0.0.0.0/32",
|
||||
status: "accepted"
|
||||
status: "approved"
|
||||
})
|
||||
.returning();
|
||||
} else {
|
||||
|
||||
@@ -137,12 +137,12 @@ const listSitesSchema = z.object({
|
||||
description: "Filter by online status"
|
||||
}),
|
||||
status: z
|
||||
.enum(["pending", "accepted"])
|
||||
.enum(["pending", "approved"])
|
||||
.optional()
|
||||
.catch(undefined)
|
||||
.openapi({
|
||||
type: "string",
|
||||
enum: ["pending", "accepted"],
|
||||
enum: ["pending", "approved"],
|
||||
description: "Filter by site status"
|
||||
})
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ const updateSiteBodySchema = z
|
||||
name: z.string().min(1).max(255).optional(),
|
||||
niceId: z.string().min(1).max(255).optional(),
|
||||
dockerSocketEnabled: z.boolean().optional(),
|
||||
status: z.enum(["pending", "accepted"]).optional(),
|
||||
status: z.enum(["pending", "approved"]).optional(),
|
||||
// remoteSubnets: z.string().optional()
|
||||
// subdomain: z
|
||||
// .string()
|
||||
|
||||
@@ -8,6 +8,7 @@ export type SiteProvisioningKeyListItem = {
|
||||
maxBatchSize: number | null;
|
||||
numUsed: number;
|
||||
validUntil: string | null;
|
||||
approveNewSites: boolean;
|
||||
};
|
||||
|
||||
export type ListSiteProvisioningKeysResponse = {
|
||||
@@ -26,6 +27,7 @@ export type CreateSiteProvisioningKeyResponse = {
|
||||
maxBatchSize: number | null;
|
||||
numUsed: number;
|
||||
validUntil: string | null;
|
||||
approveNewSites: boolean;
|
||||
};
|
||||
|
||||
export type UpdateSiteProvisioningKeyResponse = {
|
||||
@@ -38,4 +40,5 @@ export type UpdateSiteProvisioningKeyResponse = {
|
||||
maxBatchSize: number | null;
|
||||
numUsed: number;
|
||||
validUntil: string | null;
|
||||
approveNewSites: boolean;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user