Compare commits
3 Commits
d932dde701
...
aedca8fe81
Author | SHA1 | Date |
---|---|---|
Elias Schneider | aedca8fe81 | |
Elias Schneider | 7896791d56 | |
Elias Schneider | c4a364b4e2 |
|
@ -29,7 +29,7 @@ export class ShareService {
|
|||
private config: ConfigService,
|
||||
private jwtService: JwtService,
|
||||
private reverseShareService: ReverseShareService,
|
||||
private clamScanService: ClamScanService
|
||||
private clamScanService: ClamScanService,
|
||||
) {}
|
||||
|
||||
async create(share: CreateShareDTO, user?: User, reverseShareToken?: string) {
|
||||
|
@ -47,7 +47,7 @@ export class ShareService {
|
|||
|
||||
// If share is created by a reverse share token override the expiration date
|
||||
const reverseShare = await this.reverseShareService.getByToken(
|
||||
reverseShareToken
|
||||
reverseShareToken,
|
||||
);
|
||||
if (reverseShare) {
|
||||
expirationDate = reverseShare.shareExpiration;
|
||||
|
@ -65,7 +65,7 @@ export class ShareService {
|
|||
.toDate())
|
||||
) {
|
||||
throw new BadRequestException(
|
||||
"Expiration date exceeds maximum expiration date"
|
||||
"Expiration date exceeds maximum expiration date",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -140,13 +140,13 @@ export class ShareService {
|
|||
|
||||
if (share.files.length == 0)
|
||||
throw new BadRequestException(
|
||||
"You need at least on file in your share to complete it."
|
||||
"You need at least on file in your share to complete it.",
|
||||
);
|
||||
|
||||
// Asynchronously create a zip of all files
|
||||
if (share.files.length > 1)
|
||||
this.createZip(id).then(() =>
|
||||
this.prisma.share.update({ where: { id }, data: { isZipReady: true } })
|
||||
this.prisma.share.update({ where: { id }, data: { isZipReady: true } }),
|
||||
);
|
||||
|
||||
// Send email for each recipient
|
||||
|
@ -156,7 +156,7 @@ export class ShareService {
|
|||
share.id,
|
||||
share.creator,
|
||||
share.description,
|
||||
share.expiration
|
||||
share.expiration,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ export class ShareService {
|
|||
) {
|
||||
await this.emailService.sendMailToReverseShareCreator(
|
||||
share.reverseShare.creator.email,
|
||||
share.id
|
||||
share.id,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ export class ShareService {
|
|||
if (share.security?.maxViews && share.security.maxViews <= share.views) {
|
||||
throw new ForbiddenException(
|
||||
"Maximum views exceeded",
|
||||
"share_max_views_exceeded"
|
||||
"share_max_views_exceeded",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ export class ShareService {
|
|||
{
|
||||
expiresIn: moment(expiration).diff(new Date(), "seconds") + "s",
|
||||
secret: this.config.get("internal.jwtSecret"),
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -432,7 +432,7 @@
|
|||
" const responseBody = pm.response.json();",
|
||||
" pm.expect(responseBody).to.have.property(\"id\")",
|
||||
" pm.expect(responseBody).to.have.property(\"expiration\")",
|
||||
" pm.expect(Object.keys(responseBody).length).be.equal(3)",
|
||||
" pm.expect(Object.keys(responseBody).length).be.equal(4)",
|
||||
"});",
|
||||
""
|
||||
],
|
||||
|
@ -626,7 +626,7 @@
|
|||
" const responseBody = pm.response.json();",
|
||||
" pm.expect(responseBody).to.have.property(\"id\")",
|
||||
" pm.expect(responseBody).to.have.property(\"expiration\")",
|
||||
" pm.expect(Object.keys(responseBody).length).be.equal(3)",
|
||||
" pm.expect(Object.keys(responseBody).length).be.equal(4)",
|
||||
"});",
|
||||
""
|
||||
],
|
||||
|
|
|
@ -12,12 +12,11 @@ const showShareInformationsModal = (
|
|||
modals: ModalsContextProps,
|
||||
share: MyShare,
|
||||
appUrl: string,
|
||||
maxShareSize: number
|
||||
maxShareSize: number,
|
||||
) => {
|
||||
const t = translateOutsideContext();
|
||||
const link = `${appUrl}/s/${share.id}`;
|
||||
|
||||
|
||||
const formattedShareSize = byteToHumanSizeString(share.size);
|
||||
const formattedMaxShareSize = byteToHumanSizeString(maxShareSize);
|
||||
const shareSizeProgress = (share.size / maxShareSize) * 100;
|
||||
|
|
|
@ -42,7 +42,7 @@ const showCreateUploadModal = (
|
|||
maxExpirationInHours: number;
|
||||
},
|
||||
files: FileUpload[],
|
||||
uploadCallback: (createShare: CreateShare, files: FileUpload[]) => void
|
||||
uploadCallback: (createShare: CreateShare, files: FileUpload[]) => void,
|
||||
) => {
|
||||
const t = translateOutsideContext();
|
||||
|
||||
|
@ -135,15 +135,15 @@ const CreateUploadModalBody = ({
|
|||
form.values.expiration_num,
|
||||
form.values.expiration_unit.replace(
|
||||
"-",
|
||||
""
|
||||
) as moment.unitOfTime.DurationConstructor
|
||||
"",
|
||||
) as moment.unitOfTime.DurationConstructor,
|
||||
);
|
||||
|
||||
if (
|
||||
options.maxExpirationInHours != 0 &&
|
||||
(form.values.never_expires ||
|
||||
expirationDate.isAfter(
|
||||
moment().add(options.maxExpirationInHours, "hours")
|
||||
moment().add(options.maxExpirationInHours, "hours"),
|
||||
))
|
||||
) {
|
||||
form.setFieldError(
|
||||
|
@ -152,7 +152,7 @@ const CreateUploadModalBody = ({
|
|||
max: moment
|
||||
.duration(options.maxExpirationInHours, "hours")
|
||||
.humanize(),
|
||||
})
|
||||
}),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ const CreateUploadModalBody = ({
|
|||
maxViews: values.maxViews || undefined,
|
||||
},
|
||||
},
|
||||
files
|
||||
files,
|
||||
);
|
||||
modals.closeAll();
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ const CreateUploadModalBody = ({
|
|||
"link",
|
||||
Buffer.from(Math.random().toString(), "utf8")
|
||||
.toString("base64")
|
||||
.substr(10, 7)
|
||||
.substr(10, 7),
|
||||
)
|
||||
}
|
||||
>
|
||||
|
@ -307,7 +307,7 @@ const CreateUploadModalBody = ({
|
|||
neverExpires: t("upload.modal.completed.never-expires"),
|
||||
expiresOn: t("upload.modal.completed.expires-on"),
|
||||
},
|
||||
form
|
||||
form,
|
||||
)}
|
||||
</Text>
|
||||
</>
|
||||
|
@ -322,14 +322,14 @@ const CreateUploadModalBody = ({
|
|||
<TextInput
|
||||
variant="filled"
|
||||
placeholder={t(
|
||||
"upload.modal.accordion.name-and-description.name.placeholder"
|
||||
"upload.modal.accordion.name-and-description.name.placeholder",
|
||||
)}
|
||||
{...form.getInputProps("name")}
|
||||
/>
|
||||
<Textarea
|
||||
variant="filled"
|
||||
placeholder={t(
|
||||
"upload.modal.accordion.name-and-description.description.placeholder"
|
||||
"upload.modal.accordion.name-and-description.description.placeholder",
|
||||
)}
|
||||
{...form.getInputProps("description")}
|
||||
/>
|
||||
|
@ -353,7 +353,7 @@ const CreateUploadModalBody = ({
|
|||
if (!query.match(/^\S+@\S+\.\S+$/)) {
|
||||
form.setFieldError(
|
||||
"recipients",
|
||||
t("upload.modal.accordion.email.invalid-email")
|
||||
t("upload.modal.accordion.email.invalid-email"),
|
||||
);
|
||||
} else {
|
||||
form.setFieldError("recipients", null);
|
||||
|
@ -379,7 +379,7 @@ const CreateUploadModalBody = ({
|
|||
<PasswordInput
|
||||
variant="filled"
|
||||
placeholder={t(
|
||||
"upload.modal.accordion.security.password.placeholder"
|
||||
"upload.modal.accordion.security.password.placeholder",
|
||||
)}
|
||||
label={t("upload.modal.accordion.security.password.label")}
|
||||
autoComplete="off"
|
||||
|
@ -390,7 +390,7 @@ const CreateUploadModalBody = ({
|
|||
type="number"
|
||||
variant="filled"
|
||||
placeholder={t(
|
||||
"upload.modal.accordion.security.max-views.placeholder"
|
||||
"upload.modal.accordion.security.max-views.placeholder",
|
||||
)}
|
||||
label={t("upload.modal.accordion.security.max-views.label")}
|
||||
{...form.getInputProps("maxViews")}
|
||||
|
|
|
@ -68,7 +68,7 @@ const MyShares = () => {
|
|||
<Table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<th>
|
||||
<FormattedMessage id="account.shares.table.id" />
|
||||
</th>
|
||||
<th>
|
||||
|
|
|
@ -91,7 +91,7 @@ const Share = ({ shareId }: { shareId: string }) => {
|
|||
return (
|
||||
<>
|
||||
<Meta
|
||||
title={t("share.title", { shareId: share?.name || shareId})}
|
||||
title={t("share.title", { shareId: share?.name || shareId })}
|
||||
description={t("share.description")}
|
||||
/>
|
||||
|
||||
|
|
Loading…
Reference in New Issue