@@ -87,10 +87,13 @@ async function createMultipartUpload(
|
||||
const prefix = (formData.get("prefix") as string) || "";
|
||||
|
||||
const plan = await getPlanQuota(user.team!);
|
||||
if (Number(fileSize) > Number(plan.stMaxFileSize)) {
|
||||
return Response.json("File size limit exceeded", { status: 403 });
|
||||
}
|
||||
const limit = await restrictByTimeRange({
|
||||
model: "userUrl",
|
||||
model: "userFile",
|
||||
userId: user.id,
|
||||
limit: Number(plan.stMaxFileSize),
|
||||
limit: Number(plan.stMaxFileCount),
|
||||
rangeType: "month",
|
||||
});
|
||||
if (limit) return Response.json(limit.statusText, { status: limit.status });
|
||||
|
||||
+29
-25
@@ -206,31 +206,35 @@ export default function UserFileManager({ user, action }: FileListProps) {
|
||||
{isLoading ? (
|
||||
<Skeleton className="h-9 w-[120px] rounded border-r-0 shadow-inner" />
|
||||
) : (
|
||||
<Select
|
||||
value={bucketInfo.bucket}
|
||||
onValueChange={handleChangeBucket}
|
||||
>
|
||||
<SelectTrigger className="w-[120px]">
|
||||
<SelectValue placeholder="Select a bucket" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectLabel className="mx-auto text-center">
|
||||
{r2Configs?.provider_name}
|
||||
</SelectLabel>
|
||||
{r2Configs?.buckets?.map((item) => (
|
||||
<SelectItem
|
||||
key={item.bucket}
|
||||
value={item.bucket}
|
||||
onClick={() => handleChangeBucket(item.bucket)}
|
||||
>
|
||||
{item.bucket}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectGroup>
|
||||
{/* <SelectSeparator /> */}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
r2Configs &&
|
||||
r2Configs.buckets &&
|
||||
r2Configs.buckets.length > 0 && (
|
||||
<Select
|
||||
value={bucketInfo.bucket}
|
||||
onValueChange={handleChangeBucket}
|
||||
>
|
||||
<SelectTrigger className="w-[120px]">
|
||||
<SelectValue placeholder="Select a bucket" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectLabel className="mx-auto text-center">
|
||||
{r2Configs?.provider_name}
|
||||
</SelectLabel>
|
||||
{r2Configs?.buckets?.map((item) => (
|
||||
<SelectItem
|
||||
key={item.bucket}
|
||||
value={item.bucket}
|
||||
onClick={() => handleChangeBucket(item.bucket)}
|
||||
>
|
||||
{item.bucket}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectGroup>
|
||||
{/* <SelectSeparator /> */}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
)
|
||||
)}
|
||||
|
||||
{!isAdmin && (
|
||||
|
||||
@@ -35,10 +35,11 @@ const UploadPending = ({
|
||||
</Badge>
|
||||
</div>
|
||||
)}
|
||||
{pendingUpload && (
|
||||
<p className="rounded-md border border-dashed bg-yellow-100 p-2 text-sm text-muted-foreground dark:bg-neutral-600">
|
||||
Do not close the window until the upload is complete
|
||||
</p>
|
||||
{!pendingUpload && (
|
||||
<div className="flex items-center gap-1 rounded-md border border-dashed bg-yellow-100 p-2 text-sm text-muted-foreground dark:bg-neutral-600">
|
||||
<Icons.info className="size-4" />
|
||||
{t("Do not close the window until the upload is complete")}
|
||||
</div>
|
||||
)}
|
||||
{pendingUpload &&
|
||||
pendingUpload.map((item) => {
|
||||
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
Home,
|
||||
Image,
|
||||
Inbox,
|
||||
Info,
|
||||
Laptop,
|
||||
LayoutGrid,
|
||||
LayoutPanelLeft,
|
||||
@@ -323,6 +324,7 @@ export const Icons = {
|
||||
sun: SunMedium,
|
||||
trash: Trash2,
|
||||
inbox: Inbox,
|
||||
info: Info,
|
||||
twitter: ({ ...props }: LucideProps) => (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
|
||||
+2
-1
@@ -366,7 +366,8 @@
|
||||
"Cancel": "Cancel",
|
||||
"Clear": "Clear",
|
||||
"Upload Files": "Upload Files",
|
||||
"Uploud channel": "Uploud channel"
|
||||
"Uploud channel": "Uploud channel",
|
||||
"Do not close the window until the upload is complete": "Do not close the window until the upload is complete"
|
||||
},
|
||||
"Landing": {
|
||||
"settings": "Settings",
|
||||
|
||||
+2
-1
@@ -366,7 +366,8 @@
|
||||
"Cancel": "取消",
|
||||
"Clear": "清空",
|
||||
"Upload Files": "上传文件",
|
||||
"Uploud channel": "渠道"
|
||||
"Uploud channel": "渠道",
|
||||
"Do not close the window until the upload is complete": "在上传完成之前不要浏览器关闭窗口"
|
||||
},
|
||||
"Landing": {
|
||||
"settings": "设置",
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user