feat(s3): stream s3 content over a zip file (#822)

* chore: update package.json and enhance file handling in backend

* refactor: remove StreamResponseFilter and update getZip method for improved file handling

- Deleted StreamResponseFilter as it was no longer needed.
- Updated getZip method in LocalFileService to return a Promise and handle errors more effectively.
- Adjusted getZip method in FileService to await the storage service's getZip call.

* refactor: remove unused UseFilters import in file.controller.ts
This commit is contained in:
Lucas Reis
2025-05-04 20:37:04 +02:00
committed by GitHub
parent 853f217bf1
commit ccc783ab6a
7 changed files with 159 additions and 22 deletions

View File

@@ -366,6 +366,8 @@ export default {
// /share/[id]
"share.title": "Share {shareId}",
"share.description": "Look what I've shared with you!",
"share.fileCount":
"{count, plural, =1 {# file} other {# files}} · {size} (zip file may be smaller due to compression)",
"share.error.visitor-limit-exceeded.title": "Visitor limit exceeded",
"share.error.visitor-limit-exceeded.description":
"The visitor limit from this share has been exceeded.",
@@ -408,14 +410,15 @@ export default {
// /imprint
"imprint.title": "Imprint",
// END /imprint
// /privacy
"privacy.title": "Privacy Policy",
// END /privacy
// /admin/config
"admin.config.config-file-warning.title": "Configuration file present",
"admin.config.config-file-warning.description": "As you have a configured Pingvin Share with a configuration file, you can't change the configuration through the UI.",
"admin.config.config-file-warning.description":
"As you have a configured Pingvin Share with a configuration file, you can't change the configuration through the UI.",
"admin.config.title": "Configuration",
"admin.config.category.general": "General",
@@ -642,7 +645,8 @@ export default {
"admin.config.category.s3": "S3",
"admin.config.s3.enabled": "Enabled",
"admin.config.s3.enabled.description": "Whether S3 should be used to store the shared files instead of the local file system.",
"admin.config.s3.enabled.description":
"Whether S3 should be used to store the shared files instead of the local file system.",
"admin.config.s3.endpoint": "Endpoint",
"admin.config.s3.endpoint.description": "The URL of the S3 bucket.",
"admin.config.s3.region": "Region",
@@ -650,25 +654,34 @@ export default {
"admin.config.s3.bucket-name": "Bucket name",
"admin.config.s3.bucket-name.description": "The name of the S3 bucket.",
"admin.config.s3.bucket-path": "Path",
"admin.config.s3.bucket-path.description": "The default path which should be used to store the files in the S3 bucket.",
"admin.config.s3.bucket-path.description":
"The default path which should be used to store the files in the S3 bucket.",
"admin.config.s3.key": "Key",
"admin.config.s3.key.description": "The key which allows you to access the S3 bucket.",
"admin.config.s3.key.description":
"The key which allows you to access the S3 bucket.",
"admin.config.s3.secret": "Secret",
"admin.config.s3.secret.description": "The secret which allows you to access the S3 bucket.",
"admin.config.s3.secret.description":
"The secret which allows you to access the S3 bucket.",
"admin.config.s3.use-checksum": "Use checksum",
"admin.config.s3.use-checksum.description": "Turn off for backends that do not support checksum (e.g. B2).",
"admin.config.s3.use-checksum.description":
"Turn off for backends that do not support checksum (e.g. B2).",
"admin.config.category.legal": "Legal",
"admin.config.legal.enabled": "Enable legal notices",
"admin.config.legal.enabled.description": "Whether to show a link to imprint and privacy policy in the footer.",
"admin.config.legal.enabled.description":
"Whether to show a link to imprint and privacy policy in the footer.",
"admin.config.legal.imprint-text": "Imprint text",
"admin.config.legal.imprint-text.description": "The text which should be shown in the imprint. Supports Markdown. Leave blank to link to an external imprint page.",
"admin.config.legal.imprint-text.description":
"The text which should be shown in the imprint. Supports Markdown. Leave blank to link to an external imprint page.",
"admin.config.legal.imprint-url": "Imprint URL",
"admin.config.legal.imprint-url.description": "If you already have an imprint page you can link it here instead of using the text field.",
"admin.config.legal.imprint-url.description":
"If you already have an imprint page you can link it here instead of using the text field.",
"admin.config.legal.privacy-policy-text": "Privacy policy text",
"admin.config.legal.privacy-policy-text.description": "The text which should be shown in the privacy policy. Supports Markdown. Leave blank to link to an external privacy policy page.",
"admin.config.legal.privacy-policy-text.description":
"The text which should be shown in the privacy policy. Supports Markdown. Leave blank to link to an external privacy policy page.",
"admin.config.legal.privacy-policy-url": "Privacy policy URL",
"admin.config.legal.privacy-policy-url.description": "If you already have a privacy policy page you can link it here instead of using the text field.",
"admin.config.legal.privacy-policy-url.description":
"If you already have a privacy policy page you can link it here instead of using the text field.",
// 404
"404.description": "Oops this page doesn't exist.",

View File

@@ -2,6 +2,7 @@ import { Box, Group, Text, Title } from "@mantine/core";
import { useModals } from "@mantine/modals";
import { GetServerSidePropsContext } from "next";
import { useEffect, useState } from "react";
import { FormattedMessage } from "react-intl";
import Meta from "../../../components/Meta";
import DownloadAllButton from "../../../components/share/DownloadAllButton";
import FileList from "../../../components/share/FileList";
@@ -11,6 +12,7 @@ import useTranslate from "../../../hooks/useTranslate.hook";
import shareService from "../../../services/share.service";
import { Share as ShareType } from "../../../types/share.type";
import toast from "../../../utils/toast.util";
import { byteToHumanSizeString } from "../../../utils/fileSize.util";
export function getServerSideProps(context: GetServerSidePropsContext) {
return {
@@ -107,7 +109,25 @@ const Share = ({ shareId }: { shareId: string }) => {
<Box style={{ maxWidth: "70%" }}>
<Title order={3}>{share?.name || share?.id}</Title>
<Text size="sm">{share?.description}</Text>
{share?.files?.length > 0 && (
<Text size="sm" color="dimmed" mt={5}>
<FormattedMessage
id="share.fileCount"
values={{
count: share?.files?.length || 0,
size: byteToHumanSizeString(
share?.files?.reduce(
(total: number, file: { size: string }) =>
total + parseInt(file.size),
0,
) || 0,
),
}}
/>
</Text>
)}
</Box>
{share?.files.length > 1 && <DownloadAllButton shareId={shareId} />}
</Group>