Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
dabico committed Jun 28, 2023
2 parents 776a066 + b63cf7d commit df1673b
Show file tree
Hide file tree
Showing 60 changed files with 4,732 additions and 3,703 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/vue-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ jobs:
steps:
- name: Checkout main branch
uses: actions/checkout@v2

- name: Set up Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'npm'
cache-dependency-path: './dl4se-website/package-lock.json'

- name: Node Clean Install
run: npm clean-install

- name: Lint
run: npm run lint

- name: Vue Build
run: npm run build --if-present
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.workingDirectories": [{ "mode": "auto" }]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.experimental.FieldDefaults;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.io.InputStreamResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
Expand Down Expand Up @@ -49,8 +49,7 @@

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.File;
import java.nio.file.Path;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
Expand Down Expand Up @@ -156,22 +155,24 @@ public ResponseEntity<?> requestAccess(@PathVariable UUID uuid, @AuthenticationP
return ResponseEntity.ok(token.getValue());
}

@SneakyThrows({FileNotFoundException.class})
@GetMapping(value = "/download/{uuid}")
public ResponseEntity<?> download(@PathVariable UUID uuid, @RequestParam @NotBlank String token) {
downloadService.consume(token);
Task task = taskService.getWithUUID(uuid);

Path exportFilePath = fileSystemService.getTaskArchive(task);
String exportFileName = exportFilePath.getFileName().toString();
long exportFileSize = exportFilePath.toFile().length();
InputStreamResource resource = new InputStreamResource(new FileInputStream(exportFilePath.toFile()));
File exportFile = exportFilePath.toFile();
long exportFileSize = exportFile.length();
long exportFileLastModified = exportFile.lastModified();
Resource resource = new FileSystemResource(exportFile);
ContentDisposition disposition = ContentDisposition.attachment().filename(exportFileName).build();

HttpHeaders headers = new HttpHeaders();
headers.setContentType(new MediaType("application", "gzip"));
headers.setContentLength(exportFileSize);
headers.setContentDisposition(disposition);
headers.setLastModified(exportFileLastModified);

return new ResponseEntity<>(resource, headers, HttpStatus.OK);
}
Expand Down
19 changes: 8 additions & 11 deletions dl4se-website/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@ module.exports = {
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
extends: ["plugin:vue/essential", "eslint:recommended", "prettier"],
parserOptions: {
parser: '@babel/eslint-parser'
parser: "@babel/eslint-parser"
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-unused-vars': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'vue/no-unused-vars': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'vue/no-unused-components': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'vue/multi-word-component-names': 'off'
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-unused-vars": process.env.NODE_ENV === "production" ? "warn" : "off",
"vue/no-unused-vars": process.env.NODE_ENV === "production" ? "warn" : "off",
"vue/no-unused-components": process.env.NODE_ENV === "production" ? "warn" : "off",
"vue/multi-word-component-names": "off"
}
}
Loading

0 comments on commit df1673b

Please sign in to comment.