mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
fix: remove memory key generation
This commit is contained in:
@@ -323,7 +323,6 @@ export function ContainerPortSchema(): z.ZodObject<Properties<ContainerPort>> {
|
||||
export function CreateApiKeyInputSchema(): z.ZodObject<Properties<CreateApiKeyInput>> {
|
||||
return z.object({
|
||||
description: z.string().nullish(),
|
||||
memory: z.boolean().nullish(),
|
||||
name: z.string(),
|
||||
overwrite: z.boolean().nullish(),
|
||||
permissions: z.array(z.lazy(() => AddPermissionInputSchema())).nullish(),
|
||||
|
||||
@@ -347,8 +347,6 @@ export enum ContainerState {
|
||||
|
||||
export type CreateApiKeyInput = {
|
||||
description?: InputMaybe<Scalars['String']['input']>;
|
||||
/** Whether to create the key in memory only (true), or on disk (false) - memory only keys will not persist through reboots of the API */
|
||||
memory?: InputMaybe<Scalars['Boolean']['input']>;
|
||||
name: Scalars['String']['input'];
|
||||
/** This will replace the existing key if one already exists with the same name, otherwise returns the existing key */
|
||||
overwrite?: InputMaybe<Scalars['Boolean']['input']>;
|
||||
|
||||
@@ -29,8 +29,6 @@ input CreateApiKeyInput {
|
||||
permissions: [AddPermissionInput!]
|
||||
""" This will replace the existing key if one already exists with the same name, otherwise returns the existing key """
|
||||
overwrite: Boolean
|
||||
""" Whether to create the key in memory only (true), or on disk (false) - memory only keys will not persist through reboots of the API """
|
||||
memory: Boolean
|
||||
}
|
||||
|
||||
input AddPermissionInput {
|
||||
|
||||
@@ -103,14 +103,12 @@ export class ApiKeyService implements OnModuleInit {
|
||||
roles,
|
||||
permissions,
|
||||
overwrite = false,
|
||||
memory = false,
|
||||
}: {
|
||||
name: string;
|
||||
description: string | undefined;
|
||||
roles?: Role[];
|
||||
permissions?: Permission[] | AddPermissionInput[];
|
||||
overwrite?: boolean;
|
||||
memory?: boolean;
|
||||
}): Promise<ApiKeyWithSecret> {
|
||||
const trimmedName = name?.trim();
|
||||
const sanitizedName = this.sanitizeName(trimmedName);
|
||||
@@ -144,11 +142,7 @@ export class ApiKeyService implements OnModuleInit {
|
||||
// Update createdAt date
|
||||
apiKey.createdAt = new Date().toISOString();
|
||||
|
||||
if (memory) {
|
||||
this.memoryApiKeys.push(apiKey as ApiKeyWithSecret)
|
||||
} else {
|
||||
await this.saveApiKey(apiKey as ApiKeyWithSecret);
|
||||
}
|
||||
await this.saveApiKey(apiKey as ApiKeyWithSecret);
|
||||
|
||||
return apiKey as ApiKeyWithSecret;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,6 @@ export class ApiKeyResolver {
|
||||
description: input.description ?? undefined,
|
||||
roles: input.roles ?? [],
|
||||
permissions: input.permissions ?? [],
|
||||
memory: input.memory ?? false,
|
||||
overwrite: input.overwrite ?? false
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user