mirror of
https://github.com/swissmakers/swiss-datashare.git
synced 2026-04-11 10:27:01 +02:00
fix: convert async function to sync function
This commit is contained in:
@@ -22,7 +22,7 @@ export class EmailService {
|
||||
if (!this.config.get("emailRecepientsEnabled"))
|
||||
throw new InternalServerErrorException("Email service disabled");
|
||||
|
||||
const shareUrl = `${this.config.get("APP_URL")}/share/${shareId}`;
|
||||
const shareUrl = `${this.config.get("appUrl")}/share/${shareId}`;
|
||||
|
||||
|
||||
await transporter.sendMail({
|
||||
|
||||
@@ -78,14 +78,15 @@ export class FileService {
|
||||
return fs.createReadStream(`./data/uploads/shares/${shareId}/archive.zip`);
|
||||
}
|
||||
|
||||
async getFileDownloadUrl(shareId: string, fileId: string) {
|
||||
getFileDownloadUrl(shareId: string, fileId: string) {
|
||||
const downloadToken = this.generateFileDownloadToken(shareId, fileId);
|
||||
|
||||
return `${this.config.get(
|
||||
"APP_URL"
|
||||
"appUrl"
|
||||
)}/api/shares/${shareId}/files/${fileId}?token=${downloadToken}`;
|
||||
}
|
||||
|
||||
async generateFileDownloadToken(shareId: string, fileId: string) {
|
||||
generateFileDownloadToken(shareId: string, fileId: string) {
|
||||
if (fileId == "zip") fileId = undefined;
|
||||
|
||||
return this.jwtService.sign(
|
||||
@@ -100,7 +101,7 @@ export class FileService {
|
||||
);
|
||||
}
|
||||
|
||||
async verifyFileDownloadToken(shareId: string, token: string) {
|
||||
verifyFileDownloadToken(shareId: string, token: string) {
|
||||
try {
|
||||
const claims = this.jwtService.verify(token, {
|
||||
secret: this.config.get("jwtSecret"),
|
||||
|
||||
Reference in New Issue
Block a user