From 1060c3a1e89ec63773b6ab7c2d4e7c7c3060ce14 Mon Sep 17 00:00:00 2001 From: James Ward Date: Tue, 30 Jun 2026 08:04:40 -0400 Subject: [PATCH] chore: drop hard coded SVG icons (#1884) --- .../migration/AppMigrationStartup.java | 2 - .../MoveIconsToDataFolderMigration.java | 87 ------------------- .../static/images/icons/svg/atom.svg | 1 - .../static/images/icons/svg/banana.svg | 1 - .../static/images/icons/svg/beef.svg | 1 - .../static/images/icons/svg/brain.svg | 1 - .../static/images/icons/svg/chef-hat.svg | 1 - .../static/images/icons/svg/drama.svg | 1 - .../static/images/icons/svg/ferris-wheel.svg | 1 - .../images/icons/svg/flame-kindling.svg | 1 - .../static/images/icons/svg/ghost.svg | 1 - .../static/images/icons/svg/hamburger.svg | 1 - .../static/images/icons/svg/plane.svg | 1 - .../static/images/icons/svg/rocket.svg | 1 - .../images/icons/svg/roller-coaster.svg | 1 - .../static/images/icons/svg/rose.svg | 1 - .../static/images/icons/svg/skull.svg | 1 - .../static/images/icons/svg/snail.svg | 1 - .../static/images/icons/svg/swords.svg | 1 - .../static/images/icons/svg/tent-tree.svg | 1 - .../static/images/icons/svg/tree-palm.svg | 1 - .../static/images/icons/svg/turntable.svg | 1 - 22 files changed, 109 deletions(-) delete mode 100644 backend/src/main/java/org/booklore/service/migration/migrations/MoveIconsToDataFolderMigration.java delete mode 100644 backend/src/main/resources/static/images/icons/svg/atom.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/banana.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/beef.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/brain.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/chef-hat.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/drama.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/ferris-wheel.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/flame-kindling.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/ghost.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/hamburger.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/plane.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/rocket.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/roller-coaster.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/rose.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/skull.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/snail.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/swords.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/tent-tree.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/tree-palm.svg delete mode 100644 backend/src/main/resources/static/images/icons/svg/turntable.svg diff --git a/backend/src/main/java/org/booklore/service/migration/AppMigrationStartup.java b/backend/src/main/java/org/booklore/service/migration/AppMigrationStartup.java index f63c4f862..9afd661e3 100644 --- a/backend/src/main/java/org/booklore/service/migration/AppMigrationStartup.java +++ b/backend/src/main/java/org/booklore/service/migration/AppMigrationStartup.java @@ -18,7 +18,6 @@ public class AppMigrationStartup { private final PopulateFileHashesMigration populateFileHashesMigration; private final PopulateCoversAndResizeThumbnailsMigration populateCoversAndResizeThumbnailsMigration; private final PopulateSearchTextMigration populateSearchTextMigration; - private final MoveIconsToDataFolderMigration moveIconsToDataFolderMigration; private final GenerateCoverHashMigration generateCoverHashMigration; private final MigrateProgressToFileProgressMigration migrateProgressToFileProgressMigration; @@ -31,7 +30,6 @@ public class AppMigrationStartup { appMigrationService.executeMigration(populateFileHashesMigration); appMigrationService.executeMigration(populateCoversAndResizeThumbnailsMigration); appMigrationService.executeMigration(populateSearchTextMigration); - appMigrationService.executeMigration(moveIconsToDataFolderMigration); appMigrationService.executeMigration(generateCoverHashMigration); appMigrationService.executeMigration(migrateProgressToFileProgressMigration); } diff --git a/backend/src/main/java/org/booklore/service/migration/migrations/MoveIconsToDataFolderMigration.java b/backend/src/main/java/org/booklore/service/migration/migrations/MoveIconsToDataFolderMigration.java deleted file mode 100644 index 95ccbb854..000000000 --- a/backend/src/main/java/org/booklore/service/migration/migrations/MoveIconsToDataFolderMigration.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.booklore.service.migration.migrations; - -import org.booklore.service.migration.Migration; -import org.booklore.util.FileService; -import org.booklore.util.FileUtils; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import org.springframework.stereotype.Component; - -import java.io.IOException; -import java.io.UncheckedIOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; - -@Slf4j -@Component -@RequiredArgsConstructor -public class MoveIconsToDataFolderMigration implements Migration { - - private final FileService fileService; - - @Override - public String getKey() { - return "moveIconsToDataFolder"; - } - - @Override - public String getDescription() { - return "Move SVG icons from resources/static/images/icons/svg to data/icons/svg"; - } - - @Override - public void execute() { - long start = System.nanoTime(); - log.info("Starting migration: {}", getKey()); - - try { - String targetFolder = fileService.getIconsSvgFolder(); - Path targetDir = Paths.get(targetFolder); - Files.createDirectories(targetDir); - Path normalizedTargetDir = FileUtils.normalizeAbsolutePath(targetDir); - - PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); - Resource[] resources = resolver.getResources("classpath:static/images/icons/svg/*.svg"); - - int copiedCount = 0; - for (Resource resource : resources) { - String filename = resource.getFilename(); - if (filename == null) continue; - - if (filename.contains("/") || filename.contains("\\") || filename.contains("..")) { - log.warn("Skipping suspicious icon filename during migration: {}", filename); - continue; - } - - Path targetFile; - try { - targetFile = FileUtils.resolvePathWithinBase(normalizedTargetDir, filename); - } catch (IllegalArgumentException ex) { - log.warn("Skipping icon outside target directory: {}", filename); - continue; - } - - try (var inputStream = resource.getInputStream()) { - Files.copy(inputStream, targetFile, StandardCopyOption.REPLACE_EXISTING); - copiedCount++; - log.debug("Copied icon: {} to {}", filename, targetFile); - } catch (IOException e) { - log.error("Failed to copy icon: {}", filename, e); - } - } - - log.info("Copied {} SVG icons from resources to data folder", copiedCount); - - long elapsedMs = (System.nanoTime() - start) / 1_000_000; - log.info("Completed migration: {} in {} ms", getKey(), elapsedMs); - } catch (IOException e) { - log.error("Error during migration {}", getKey(), e); - throw new UncheckedIOException(e); - } - } -} - diff --git a/backend/src/main/resources/static/images/icons/svg/atom.svg b/backend/src/main/resources/static/images/icons/svg/atom.svg deleted file mode 100644 index 8b33eb0ec..000000000 --- a/backend/src/main/resources/static/images/icons/svg/atom.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/banana.svg b/backend/src/main/resources/static/images/icons/svg/banana.svg deleted file mode 100644 index 56d39cf62..000000000 --- a/backend/src/main/resources/static/images/icons/svg/banana.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/beef.svg b/backend/src/main/resources/static/images/icons/svg/beef.svg deleted file mode 100644 index c5ae70859..000000000 --- a/backend/src/main/resources/static/images/icons/svg/beef.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/brain.svg b/backend/src/main/resources/static/images/icons/svg/brain.svg deleted file mode 100644 index 259ac478c..000000000 --- a/backend/src/main/resources/static/images/icons/svg/brain.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/chef-hat.svg b/backend/src/main/resources/static/images/icons/svg/chef-hat.svg deleted file mode 100644 index fdce6c491..000000000 --- a/backend/src/main/resources/static/images/icons/svg/chef-hat.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/drama.svg b/backend/src/main/resources/static/images/icons/svg/drama.svg deleted file mode 100644 index 0797b6f03..000000000 --- a/backend/src/main/resources/static/images/icons/svg/drama.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/ferris-wheel.svg b/backend/src/main/resources/static/images/icons/svg/ferris-wheel.svg deleted file mode 100644 index 15dc12b88..000000000 --- a/backend/src/main/resources/static/images/icons/svg/ferris-wheel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/flame-kindling.svg b/backend/src/main/resources/static/images/icons/svg/flame-kindling.svg deleted file mode 100644 index 66a71ca63..000000000 --- a/backend/src/main/resources/static/images/icons/svg/flame-kindling.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/ghost.svg b/backend/src/main/resources/static/images/icons/svg/ghost.svg deleted file mode 100644 index 9d8d0df8a..000000000 --- a/backend/src/main/resources/static/images/icons/svg/ghost.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/hamburger.svg b/backend/src/main/resources/static/images/icons/svg/hamburger.svg deleted file mode 100644 index 26cf50738..000000000 --- a/backend/src/main/resources/static/images/icons/svg/hamburger.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/plane.svg b/backend/src/main/resources/static/images/icons/svg/plane.svg deleted file mode 100644 index f036eb68e..000000000 --- a/backend/src/main/resources/static/images/icons/svg/plane.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/rocket.svg b/backend/src/main/resources/static/images/icons/svg/rocket.svg deleted file mode 100644 index 14fb3aaba..000000000 --- a/backend/src/main/resources/static/images/icons/svg/rocket.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/roller-coaster.svg b/backend/src/main/resources/static/images/icons/svg/roller-coaster.svg deleted file mode 100644 index e3ed9bfe1..000000000 --- a/backend/src/main/resources/static/images/icons/svg/roller-coaster.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/rose.svg b/backend/src/main/resources/static/images/icons/svg/rose.svg deleted file mode 100644 index 450ccd7c9..000000000 --- a/backend/src/main/resources/static/images/icons/svg/rose.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/skull.svg b/backend/src/main/resources/static/images/icons/svg/skull.svg deleted file mode 100644 index 19958d8f0..000000000 --- a/backend/src/main/resources/static/images/icons/svg/skull.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/snail.svg b/backend/src/main/resources/static/images/icons/svg/snail.svg deleted file mode 100644 index 03b50a905..000000000 --- a/backend/src/main/resources/static/images/icons/svg/snail.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/swords.svg b/backend/src/main/resources/static/images/icons/svg/swords.svg deleted file mode 100644 index 832b82ba4..000000000 --- a/backend/src/main/resources/static/images/icons/svg/swords.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/tent-tree.svg b/backend/src/main/resources/static/images/icons/svg/tent-tree.svg deleted file mode 100644 index 239f87f99..000000000 --- a/backend/src/main/resources/static/images/icons/svg/tent-tree.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/tree-palm.svg b/backend/src/main/resources/static/images/icons/svg/tree-palm.svg deleted file mode 100644 index edc542971..000000000 --- a/backend/src/main/resources/static/images/icons/svg/tree-palm.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/backend/src/main/resources/static/images/icons/svg/turntable.svg b/backend/src/main/resources/static/images/icons/svg/turntable.svg deleted file mode 100644 index 5ed52b5aa..000000000 --- a/backend/src/main/resources/static/images/icons/svg/turntable.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file