diff --git a/src/main/java/se/su/dsv/seshat/controllers/LandingController.java b/src/main/java/se/su/dsv/seshat/controllers/RootController.java similarity index 68% rename from src/main/java/se/su/dsv/seshat/controllers/LandingController.java rename to src/main/java/se/su/dsv/seshat/controllers/RootController.java index e07debc..7371baa 100644 --- a/src/main/java/se/su/dsv/seshat/controllers/LandingController.java +++ b/src/main/java/se/su/dsv/seshat/controllers/RootController.java @@ -1,15 +1,18 @@ package se.su.dsv.seshat.controllers; -import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; @Controller -public class LandingController { +public class RootController { @GetMapping("/") public String showHomePage() { return "redirect:/files/manage"; } + @GetMapping("/about") + public String showAboutPage() { + return "about"; + } } diff --git a/src/main/java/se/su/dsv/seshat/services/StorageService.java b/src/main/java/se/su/dsv/seshat/services/StorageService.java index 7f67d7f..9cea80e 100644 --- a/src/main/java/se/su/dsv/seshat/services/StorageService.java +++ b/src/main/java/se/su/dsv/seshat/services/StorageService.java @@ -99,7 +99,8 @@ public class StorageService { String sanitizedFilename = sanitizeFilename(originalFilename); // Users upload directory - Path userUploadDir = Paths.get(uploadRoot, user.getUsername(), UUID.randomUUID().toString()); + String uuid = UUID.randomUUID().toString(); + Path userUploadDir = Paths.get(uploadRoot, user.getUsername(), uuid); try { if(!Files.exists(userUploadDir)) { @@ -124,7 +125,7 @@ public class StorageService { } metadata.setUploadedAt(LocalDateTime.now()); String fileFolder = fileNameAndUploadedTime(metadata); - metadata.setOutputDirectory(outputRoot + File.separator + user.getUsername() + File.separator + fileFolder); + metadata.setOutputDirectory(outputRoot + File.separator + user.getUsername() + File.separator + uuid + File.separator + fileFolder); metadata.setUser(user); return fileMetadataRepository.save(metadata); } catch (IOException e) { diff --git a/src/main/resources/static/css/styles.css b/src/main/resources/static/css/styles.css index 7f8f0f0..693f306 100644 --- a/src/main/resources/static/css/styles.css +++ b/src/main/resources/static/css/styles.css @@ -3,9 +3,25 @@ --bs-btn-bg: #002F5F; } +.header { + padding: 6rem 0; + .container-header { + display: flex; + justify-content: space-between; + align-items: center; + flex-direction: column; + @media (min-width: 768px) { + flex-direction: row; + } + } +} + .header-link { color: white; text-decoration: none; +} + +.header-powered-by { font-size: 0.8rem; } @@ -22,6 +38,7 @@ font-size: 2rem; font-weight: normal; margin: 0; + text-align: center; } .header .user-menu { @@ -53,6 +70,11 @@ } footer { margin-top: 1rem; + .container { + justify-content: space-between; + align-items: center; + display: flex; + } } html, body { diff --git a/src/main/resources/static/js/script.js b/src/main/resources/static/js/script.js index 666e470..2124789 100644 --- a/src/main/resources/static/js/script.js +++ b/src/main/resources/static/js/script.js @@ -57,4 +57,44 @@ function validateFile() { } return true; -} \ No newline at end of file +} + +// Progress bar for file upload +document.getElementById('uploadForm').addEventListener('submit', function(event) { + event.preventDefault(); + const fileInput = document.getElementById('file'); + const file = fileInput.files[0]; + const formData = new FormData(); + formData.append('file', file); + formData.append('language', document.getElementById('language').value); + + const xhr = new XMLHttpRequest(); + xhr.open('POST', '/files/upload', true); + + xhr.upload.addEventListener('progress', function(event) { + if (event.lengthComputable) { + const percentComplete = (event.loaded / event.total) * 100; + const progressBar = document.getElementById('progressBar'); + progressBar.style.width = percentComplete + '%'; + progressBar.setAttribute('aria-valuenow', percentComplete); + progressBar.textContent = Math.round(percentComplete) + '%'; + } + }); + + xhr.addEventListener('load', function() { + if (xhr.status === 200) { + window.location.reload(); + } else { + alert('File upload failed'); + } + document.getElementById('progressContainer').style.display = 'none'; + }); + + xhr.addEventListener('error', function() { + alert('File upload failed'); + document.getElementById('progressContainer').style.display = 'none'; + }); + + document.getElementById('progressContainer').style.display = 'block'; + xhr.send(formData); +}); \ No newline at end of file diff --git a/src/main/resources/templates/about.html b/src/main/resources/templates/about.html new file mode 100644 index 0000000..32c2af4 --- /dev/null +++ b/src/main/resources/templates/about.html @@ -0,0 +1,48 @@ + + + + + + Seshat Auido Transcriber + + + + + +
+
+ +

Seshat Audio Transcriber

+ +
+
+ + Powered with Whisper AI + +
+
+
+

About Seshat Audio Transcriber

+

This tool allows you to upload audio files and transcribe them into text using whisperAI.

+

The application runs a local instance of Whisper AI, using the turbo model on one NVIDIA RTX A4000 graphics card.

+

All processing is done locally, and no data is sent to the cloud, ensuring your privacy and data security.

+
+ + + + + \ No newline at end of file diff --git a/src/main/resources/templates/file-management.html b/src/main/resources/templates/file-management.html index c16db8e..f420a81 100644 --- a/src/main/resources/templates/file-management.html +++ b/src/main/resources/templates/file-management.html @@ -10,9 +10,9 @@
-
+
@@ -36,7 +36,7 @@

Upload File

-
+
+
@@ -159,7 +164,10 @@