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