From 6cb43b412c28f4b21b5484edb3c0852901bb3926 Mon Sep 17 00:00:00 2001 From: akastijn Date: Sun, 4 Jan 2026 05:37:46 +0100 Subject: [PATCH] Comment out unused notification functionality in `ParticleController` since the file is directly readable --- .../particles/ParticleController.java | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/backend/src/main/java/com/alttd/altitudeweb/controllers/particles/ParticleController.java b/backend/src/main/java/com/alttd/altitudeweb/controllers/particles/ParticleController.java index 6e00f1c..8d481e8 100644 --- a/backend/src/main/java/com/alttd/altitudeweb/controllers/particles/ParticleController.java +++ b/backend/src/main/java/com/alttd/altitudeweb/controllers/particles/ParticleController.java @@ -24,14 +24,14 @@ import java.nio.file.Path; @RestController public class ParticleController implements ParticlesApi { - @Value("${login.secret:#{null}}") - private String loginSecret; +// @Value("${login.secret:#{null}}") +// private String loginSecret; @Value("${particles.file_path}") private String particlesFilePath; - @Value("${notification.server.url:http://localhost:8080}") - private String notificationServerUrl; +// @Value("${notification.server.url:http://localhost:8080}") +// private String notificationServerUrl; @Override public ResponseEntity downloadFile(String filename) { @@ -96,7 +96,7 @@ public class ParticleController implements ParticlesApi { return ResponseEntity.status(404).build(); } ResponseEntity voidResponseEntity = writeContentToFile(file, filename, content); - notifyServerOfFileUpload(filename); +// notifyServerOfFileUpload(filename); return voidResponseEntity; } @@ -116,35 +116,35 @@ public class ParticleController implements ParticlesApi { } ResponseEntity voidResponseEntity = writeContentToFile(file, filename, content); - notifyServerOfFileUpload(uuid, filename); +// notifyServerOfFileUpload(uuid, filename); return voidResponseEntity; } - private void notifyServerOfFileUpload(String filename) { - String notificationUrl = String.format("http://%s/notify/%s.json", notificationServerUrl, filename); - sendNotification(notificationUrl, String.format("file upload: %s", filename)); - } - - private void notifyServerOfFileUpload(String uuid, String filename) { - String notificationUrl = String.format("%s/notify/%s/%s.json", notificationServerUrl, uuid, filename); - sendNotification(notificationUrl, String.format("file upload for user %s: %s", uuid, filename)); - } - - private void sendNotification(String notificationUrl, String logDescription) { - try { - RestTemplate restTemplate = new RestTemplate(); - ResponseEntity response = restTemplate.getForEntity(notificationUrl, String.class); - - if (response.getStatusCode().is2xxSuccessful()) { - log.info("Successfully notified server of {}", logDescription); - } else { - log.warn("Failed to notify server of {}, status: {}", - logDescription, response.getStatusCode()); - } - } catch (Exception e) { - log.error("Error notifying server of {}", logDescription, e); - } - } +// private void notifyServerOfFileUpload(String filename) { +// String notificationUrl = String.format("http://%s/notify/%s.json", notificationServerUrl, filename); +// sendNotification(notificationUrl, String.format("file upload: %s", filename)); +// } +// +// private void notifyServerOfFileUpload(String uuid, String filename) { +// String notificationUrl = String.format("%s/notify/%s/%s.json", notificationServerUrl, uuid, filename); +// sendNotification(notificationUrl, String.format("file upload for user %s: %s", uuid, filename)); +// } +// +// private void sendNotification(String notificationUrl, String logDescription) { +// try { +// RestTemplate restTemplate = new RestTemplate(); +// ResponseEntity response = restTemplate.getForEntity(notificationUrl, String.class); +// +// if (response.getStatusCode().is2xxSuccessful()) { +// log.info("Successfully notified server of {}", logDescription); +// } else { +// log.warn("Failed to notify server of {}, status: {}", +// logDescription, response.getStatusCode()); +// } +// } catch (Exception e) { +// log.error("Error notifying server of {}", logDescription, e); +// } +// } private ResponseEntity writeContentToFile(File dir, String filename, MultipartFile content) {