1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-06-30 22:50:12 +02:00

feat: ability to define zip compression level

This commit is contained in:
Elias Schneider 2023-07-22 15:44:45 +02:00
parent 389dc87cac
commit 7827b687fa
No known key found for this signature in database
GPG Key ID: 07E623B294202B6C
4 changed files with 9 additions and 5 deletions

View File

@ -18,7 +18,6 @@ const configVariables: ConfigVariables = {
appUrl: { appUrl: {
type: "string", type: "string",
defaultValue: "http://localhost:3000", defaultValue: "http://localhost:3000",
secret: false, secret: false,
}, },
showHomePage: { showHomePage: {
@ -36,15 +35,17 @@ const configVariables: ConfigVariables = {
allowUnauthenticatedShares: { allowUnauthenticatedShares: {
type: "boolean", type: "boolean",
defaultValue: "false", defaultValue: "false",
secret: false, secret: false,
}, },
maxSize: { maxSize: {
type: "number", type: "number",
defaultValue: "1000000000", defaultValue: "1000000000",
secret: false, secret: false,
}, },
zipCompressionLevel: {
type: "number",
defaultValue: "9",
},
}, },
email: { email: {
enableShareEmailRecipients: { enableShareEmailRecipients: {

View File

@ -104,7 +104,7 @@ export class ShareService {
const files = await this.prisma.file.findMany({ where: { shareId } }); const files = await this.prisma.file.findMany({ where: { shareId } });
const archive = archiver("zip", { const archive = archiver("zip", {
zlib: { level: 9 }, zlib: { level: this.config.get("share.zipCompressionLevel") },
}); });
const writeStream = fs.createWriteStream(`${path}/archive.zip`); const writeStream = fs.createWriteStream(`${path}/archive.zip`);

View File

@ -49,7 +49,7 @@ const DownloadAllButton = ({ shareId }: { shareId: string }) => {
} }
}} }}
> >
<FormattedMessage id="share.download-all" /> <FormattedMessage id="share.button.download-all" />
</Button> </Button>
); );
}; };

View File

@ -386,6 +386,9 @@ export default {
"Whether unauthenticated users can create shares", "Whether unauthenticated users can create shares",
"admin.config.share.max-size": "Max size", "admin.config.share.max-size": "Max size",
"admin.config.share.max-size.description": "Maximum share size in bytes", "admin.config.share.max-size.description": "Maximum share size in bytes",
"admin.config.share.zip-compression-level": "Zip compression level",
"admin.config.share.zip-compression-level.description":
"Adjust the level to balance between file size and compression speed. Valid values range from 0 to 9, with 0 being no compression and 9 being maximum compression. ",
"admin.config.smtp.enabled": "Enabled", "admin.config.smtp.enabled": "Enabled",
"admin.config.smtp.enabled.description": "admin.config.smtp.enabled.description":