diff --git a/.env.local.example b/.env.local.example index a91d28b..2284b89 100644 --- a/.env.local.example +++ b/.env.local.example @@ -1,7 +1,7 @@ # every field in here is optional except, CORE_SECRET and CORE_DATABASE_URL. # if CORE_SECRET is still "changethis" then zipline will exit and tell you to change it. -# if using s3/supabase make sure to comment out the other datasources +# if using s3/supabase make sure to uncomment or comment out the correct lines needed. CORE_RETURN_HTTPS=true CORE_SECRET="changethis" @@ -10,34 +10,36 @@ CORE_PORT=3000 CORE_DATABASE_URL="postgres://postgres:postgres@localhost/zip10" CORE_LOGGER=false CORE_STATS_INTERVAL=1800 +CORE_INVITES_INTERVAL=1800 +CORE_THUMBNAILS_INTERVAL=600 # default DATASOURCE_TYPE=local DATASOURCE_LOCAL_DIRECTORY=./uploads # or you can choose to use s3 -DATASOURCE_TYPE=s3 -DATASOURCE_S3_ACCESS_KEY_ID=key -DATASOURCE_S3_SECRET_ACCESS_KEY=secret -DATASOURCE_S3_BUCKET=bucket -DATASOURCE_S3_ENDPOINT=s3.amazonaws.com -DATASOURCE_S3_REGION=us-west-2 -DATASOURCE_S3_FORCE_S3_PATH=false -DATASOURCE_S3_USE_SSL=false +# DATASOURCE_TYPE=s3 +# DATASOURCE_S3_ACCESS_KEY_ID=key +# DATASOURCE_S3_SECRET_ACCESS_KEY=secret +# DATASOURCE_S3_BUCKET=bucket +# DATASOURCE_S3_ENDPOINT=s3.amazonaws.com +# DATASOURCE_S3_REGION=us-west-2 +# DATASOURCE_S3_FORCE_S3_PATH=false +# DATASOURCE_S3_USE_SSL=false # or supabase -DATASOURCE_TYPE=supabase -DATASOURCE_SUPABASE_KEY=xxx +# DATASOURCE_TYPE=supabase +# DATASOURCE_SUPABASE_KEY=xxx # remember: no leading slash -DATASOURCE_SUPABASE_URL=https://something.supabase.co -DATASOURCE_SUPABASE_BUCKET=zipline +# DATASOURCE_SUPABASE_URL=https://something.supabase.co +# DATASOURCE_SUPABASE_BUCKET=zipline UPLOADER_DEFAULT_FORMAT=RANDOM UPLOADER_ROUTE=/u UPLOADER_LENGTH=6 UPLOADER_ADMIN_LIMIT=104900000 UPLOADER_USER_LIMIT=104900000 -UPLOADER_DISABLED_EXTENSIONS=someext +UPLOADER_DISABLED_EXTENSIONS=someext,anotherext URLS_ROUTE=/go URLS_LENGTH=6 diff --git a/LICENSE b/LICENSE index fd27359..8b3c58d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 dicedtomato +Copyright (c) 2023 dicedtomato Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 3b56858..50a0733 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "fastify": "^4.15.0", "fastify-plugin": "^4.5.0", "fflate": "^0.7.4", + "ffmpeg-static": "^5.1.0", "find-my-way": "^7.6.0", "katex": "^0.16.4", "mantine-datatable": "^2.2.6", diff --git a/prisma/migrations/20230523025656_thumbnails/migration.sql b/prisma/migrations/20230523025656_thumbnails/migration.sql new file mode 100644 index 0000000..f0e9824 --- /dev/null +++ b/prisma/migrations/20230523025656_thumbnails/migration.sql @@ -0,0 +1,16 @@ + +-- CreateTable +CREATE TABLE "Thumbnail" ( + "id" SERIAL NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "name" TEXT NOT NULL, + "fileId" INTEGER NOT NULL, + + CONSTRAINT "Thumbnail_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "Thumbnail_fileId_key" ON "Thumbnail"("fileId"); + +-- AddForeignKey +ALTER TABLE "Thumbnail" ADD CONSTRAINT "Thumbnail_fileId_fkey" FOREIGN KEY ("fileId") REFERENCES "File"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 37855da..b4d4aff 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -8,24 +8,24 @@ generator client { } model User { - id Int @id @default(autoincrement()) - uuid String @unique @default(dbgenerated("gen_random_uuid()")) @db.Uuid - username String - password String? - avatar String? - token String - administrator Boolean @default(false) - superAdmin Boolean @default(false) - systemTheme String @default("system") - embed Json @default("{}") - ratelimit DateTime? - totpSecret String? - domains String[] - oauth OAuth[] - files File[] - urls Url[] - Invite Invite[] - Folder Folder[] + id Int @id @default(autoincrement()) + uuid String @unique @default(dbgenerated("gen_random_uuid()")) @db.Uuid + username String + password String? + avatar String? + token String + administrator Boolean @default(false) + superAdmin Boolean @default(false) + systemTheme String @default("system") + embed Json @default("{}") + ratelimit DateTime? + totpSecret String? + domains String[] + oauth OAuth[] + files File[] + urls Url[] + Invite Invite[] + Folder Folder[] IncompleteFile IncompleteFile[] } @@ -62,6 +62,17 @@ model File { folder Folder? @relation(fields: [folderId], references: [id], onDelete: SetNull) folderId Int? + + thumbnail Thumbnail? +} + +model Thumbnail { + id Int @id @default(autoincrement()) + createdAt DateTime @default(now()) + name String + + fileId Int @unique + file File @relation(fields: [fileId], references: [id], onDelete: Cascade) } model InvisibleFile { diff --git a/src/components/File/index.tsx b/src/components/File/index.tsx index 7670c44..762a177 100644 --- a/src/components/File/index.tsx +++ b/src/components/File/index.tsx @@ -63,7 +63,19 @@ export default function File({ otherUser={otherUser} /> - setOpen(true)}> + setOpen(true)} + >