mirror of
https://github.com/RoastSlav/quickdrop.git
synced 2026-05-03 19:09:33 -05:00
added a checkbox to hide the file when uploading
This commit is contained in:
@@ -24,10 +24,11 @@ public class FileRestController {
|
||||
|
||||
@PostMapping("/upload")
|
||||
public ResponseEntity<FileEntity> saveFile(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "description") String description,
|
||||
@RequestParam(value = "description", required = false) String description,
|
||||
@RequestParam(value = "keepIndefinitely", defaultValue = "false") boolean keepIndefinitely,
|
||||
@RequestParam(value = "password", required = false) String password) {
|
||||
FileUploadRequest fileUploadRequest = new FileUploadRequest(description, keepIndefinitely, password);
|
||||
@RequestParam(value = "password", required = false) String password,
|
||||
@RequestParam(value = "hidden", defaultValue = "false") boolean hidden) {
|
||||
FileUploadRequest fileUploadRequest = new FileUploadRequest(description, keepIndefinitely, password, hidden);
|
||||
FileEntity fileEntity = fileService.saveFile(file, fileUploadRequest);
|
||||
if (fileEntity != null) {
|
||||
return ResponseEntity.ok(fileEntity);
|
||||
@@ -36,6 +37,7 @@ public class FileRestController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/share/{id}")
|
||||
public ResponseEntity<String> generateShareableLink(@PathVariable Long id, HttpServletRequest request) {
|
||||
FileEntity fileEntity = fileService.getFile(id);
|
||||
|
||||
@@ -4,13 +4,15 @@ public class FileUploadRequest {
|
||||
public String description;
|
||||
public boolean keepIndefinitely;
|
||||
public String password;
|
||||
public boolean hidden;
|
||||
|
||||
public FileUploadRequest() {
|
||||
}
|
||||
|
||||
public FileUploadRequest(String description, boolean keepIndefinitely, String password) {
|
||||
public FileUploadRequest(String description, boolean keepIndefinitely, String password, boolean hidden) {
|
||||
this.description = description;
|
||||
this.keepIndefinitely = keepIndefinitely;
|
||||
this.password = password;
|
||||
this.hidden = hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ public class FileService {
|
||||
fileEntity.description = fileUploadRequest.description;
|
||||
fileEntity.size = file.getSize();
|
||||
fileEntity.keepIndefinitely = fileUploadRequest.keepIndefinitely;
|
||||
fileEntity.hidden = fileUploadRequest.hidden;
|
||||
|
||||
if (fileUploadRequest.password != null && !fileUploadRequest.password.isEmpty()) {
|
||||
fileEntity.passwordHash = passwordEncoder.encode(fileUploadRequest.password);
|
||||
|
||||
@@ -123,6 +123,12 @@
|
||||
<label class="form-check-label" for="keepIndefinitely">Keep indefinitely</label>
|
||||
</div>
|
||||
|
||||
<!-- Hidden File Checkbox -->
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" id="hidden" name="hidden" type="checkbox"/>
|
||||
<label class="form-check-label" for="hidden">Hide from file list</label>
|
||||
</div>
|
||||
|
||||
<!-- Password Input -->
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="password">Password (Optional):</label>
|
||||
|
||||
Reference in New Issue
Block a user