mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-12 21:08:46 +00:00
사소한 리팩토링
This commit is contained in:
@@ -27,6 +27,3 @@ Thumbs.db
|
||||
# Vite
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
|
||||
# SQLite
|
||||
*.db
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -26,6 +26,3 @@ Thumbs.db
|
||||
# Vite
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
|
||||
# SQLite
|
||||
*.db
|
||||
|
||||
@@ -25,18 +25,16 @@
|
||||
class="absolute inset-0 bg-black bg-opacity-50"
|
||||
transition:fade|global={{ duration: 100 }}
|
||||
></div>
|
||||
<div class="z-20 w-full">
|
||||
<AdaptiveDiv>
|
||||
<div
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
class="flex max-h-[70vh] min-h-[30vh] flex-col rounded-t-2xl bg-white"
|
||||
transition:fly|global={{ y: 100, duration: 200 }}
|
||||
>
|
||||
<div class={["flex-grow overflow-y-auto", className]}>
|
||||
{@render children()}
|
||||
</div>
|
||||
<AdaptiveDiv class="z-10 w-full">
|
||||
<div
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
class="flex max-h-[70vh] min-h-[30vh] flex-col rounded-t-2xl bg-white"
|
||||
transition:fly|global={{ y: 100, duration: 200 }}
|
||||
>
|
||||
<div class={["flex-grow overflow-y-auto", className]}>
|
||||
{@render children()}
|
||||
</div>
|
||||
</AdaptiveDiv>
|
||||
</div>
|
||||
</div>
|
||||
</AdaptiveDiv>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -22,11 +22,9 @@
|
||||
class="fixed inset-0 z-10 bg-black bg-opacity-50"
|
||||
transition:fade|global={{ duration: 100 }}
|
||||
>
|
||||
<AdaptiveDiv class="h-full">
|
||||
<div class="flex h-full items-center justify-center px-4">
|
||||
<div onclick={(e) => e.stopPropagation()} class={["rounded-2xl bg-white p-4", className]}>
|
||||
{@render children()}
|
||||
</div>
|
||||
<AdaptiveDiv class="flex h-full items-center justify-center px-4">
|
||||
<div onclick={(e) => e.stopPropagation()} class={["rounded-2xl bg-white p-4", className]}>
|
||||
{@render children()}
|
||||
</div>
|
||||
</AdaptiveDiv>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export type Ciphertext = {
|
||||
export interface Ciphertext {
|
||||
ciphertext: string; // Base64
|
||||
iv: string; // Base64
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ export const passwordChangeRequest = z.object({
|
||||
export type PasswordChangeRequest = z.infer<typeof passwordChangeRequest>;
|
||||
|
||||
export const loginRequest = z.object({
|
||||
email: z.string().email().nonempty(),
|
||||
email: z.string().email(),
|
||||
password: z.string().trim().nonempty(),
|
||||
});
|
||||
export type LoginRequest = z.infer<typeof loginRequest>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const categoryIdSchema = z.union([z.enum(["root"]), z.number().int().positive()]);
|
||||
export const categoryIdSchema = z.union([z.literal("root"), z.number().int().positive()]);
|
||||
|
||||
export const categoryInfoResponse = z.object({
|
||||
metadata: z
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const directoryIdSchema = z.union([z.enum(["root"]), z.number().int().positive()]);
|
||||
export const directoryIdSchema = z.union([z.literal("root"), z.number().int().positive()]);
|
||||
|
||||
export const directoryInfoResponse = z.object({
|
||||
metadata: z
|
||||
|
||||
@@ -9,6 +9,7 @@ export const fileInfoResponse = z.object({
|
||||
dekVersion: z.string().datetime(),
|
||||
contentType: z
|
||||
.string()
|
||||
.trim()
|
||||
.nonempty()
|
||||
.refine((value) => mime.getExtension(value) !== null), // MIME type
|
||||
contentIv: z.string().base64().nonempty(),
|
||||
@@ -49,6 +50,7 @@ export const fileUploadRequest = z.object({
|
||||
contentHmac: z.string().base64().nonempty(),
|
||||
contentType: z
|
||||
.string()
|
||||
.trim()
|
||||
.nonempty()
|
||||
.refine((value) => mime.getExtension(value) !== null), // MIME type
|
||||
contentIv: z.string().base64().nonempty(),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const userInfoResponse = z.object({
|
||||
email: z.string().email().nonempty(),
|
||||
email: z.string().email(),
|
||||
nickname: z.string().nonempty(),
|
||||
});
|
||||
export type UserInfoResponse = z.infer<typeof userInfoResponse>;
|
||||
|
||||
export const nicknameChangeRequest = z.object({
|
||||
newNickname: z.string().min(2).max(8),
|
||||
newNickname: z.string().trim().min(2).max(8),
|
||||
});
|
||||
export type NicknameChangeRequest = z.infer<typeof nicknameChangeRequest>;
|
||||
|
||||
@@ -31,6 +31,6 @@ export const GET: RequestHandler = async ({ locals, url, params }) => {
|
||||
return json(
|
||||
categoryFileListResponse.parse({
|
||||
files: files.map(({ id, isRecursive }) => ({ file: id, isRecursive })),
|
||||
}) satisfies CategoryFileListResponse,
|
||||
} satisfies CategoryFileListResponse),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -73,12 +73,13 @@ export const POST: RequestHandler = async ({ locals, request }) => {
|
||||
"field",
|
||||
handler(async (fieldname, val) => {
|
||||
if (fieldname === "metadata") {
|
||||
// Ignore subsequent metadata fields
|
||||
if (!metadata) {
|
||||
// Ignore subsequent metadata fields
|
||||
metadata = parseFileMetadata(userId, val);
|
||||
}
|
||||
} else if (fieldname === "checksum") {
|
||||
resolveChecksum(val); // Ignore subsequent checksum fields
|
||||
// Ignore subsequent checksum fields
|
||||
resolveChecksum(val);
|
||||
} else {
|
||||
error(400, "Invalid request body");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user