From 2b7034f8b4ed758b2fc0e83b6de60be77d33a74d Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Wed, 14 Sep 2022 12:38:48 +0200 Subject: [PATCH] Provide default authority images as Base64 data URI to support subpaths --- .../org/cryptomator/hub/api/AuthorityDto.java | 16 ++++++++++++++-- frontend/public/group-icon.svg | 4 ---- frontend/public/user-icon.svg | 4 ---- 3 files changed, 14 insertions(+), 10 deletions(-) delete mode 100644 frontend/public/group-icon.svg delete mode 100644 frontend/public/user-icon.svg diff --git a/backend/src/main/java/org/cryptomator/hub/api/AuthorityDto.java b/backend/src/main/java/org/cryptomator/hub/api/AuthorityDto.java index a8018a9d..fbb1d431 100644 --- a/backend/src/main/java/org/cryptomator/hub/api/AuthorityDto.java +++ b/backend/src/main/java/org/cryptomator/hub/api/AuthorityDto.java @@ -6,6 +6,18 @@ abstract sealed class AuthorityDto permits UserDto, GroupDto { + private static final String DEFAULT_USER_DATA_IMAGE = """ + data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJoLTUgdy01IiB2aWV3Qm94PSIwIDAgMjAgMjAiIGZpbGw9ImN1cnJlbnRDb2xvciI+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkd\ + Gg9IjIwIiBoZWlnaHQ9IjIwIiByeD0iMDAiIHJ5PSIwMCIgZmlsbD0id2hpdGUiIC8+CiAgPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTAgOWEzIDMgMCAxMDAtNiAzIDMgMCAwMDAgNnptLTcgOWE3IDcgMCAxMTE0IDBIM3oiIGNsaXAt\ + cnVsZT0iZXZlbm9kZCIgLz4KPC9zdmc+ + """; + private static final String DEFAULT_GROUP_DATA_IMAGE = """ + data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzTmFtZT0iaC01IHctNSIgdmlld0JveD0iMCAwIDIwIDIwIiBmaWxsPSJjdXJyZW50Q29sb3IiPgogIDxyZWN0IHg9IjAiIHk9IjAiI\ + HdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgcng9IjAwIiByeT0iMDAiIGZpbGw9IndoaXRlIiAvPgogIDxwYXRoIGQ9Ik0xMyA2YTMgMyAwIDExLTYgMCAzIDMgMCAwMTYgMHpNMTggOGEyIDIgMCAxMS00IDAgMiAyIDAgMDE0IDB6TTE0IDE1YTQgNCAw\ + IDAwLTggMHYzaDh2LTN6TTYgOGEyIDIgMCAxMS00IDAgMiAyIDAgMDE0IDB6TTE2IDE4di0zYTUuOTcyIDUuOTcyIDAgMDAtLjc1LTIuOTA2QTMuMDA1IDMuMDA1IDAgMDExOSAxNXYzaC0zek00Ljc1IDEyLjA5NEE1Ljk3MyA1Ljk3MyAwIDAwNCA\ + xNXYzSDF2LTNhMyAzIDAgMDEzLjc1LTIuOTA2eiIgLz4KPC9zdmc+ + """; + public enum Type { USER, GROUP } @@ -27,8 +39,8 @@ protected AuthorityDto(String id, Type type, String name, String pictureUrl) { this.type = type; this.name = name; this.pictureUrl = Objects.requireNonNullElseGet(pictureUrl, () -> switch (type) { - case USER -> "/user-icon.svg"; - case GROUP -> "/group-icon.svg"; + case USER -> DEFAULT_USER_DATA_IMAGE; + case GROUP -> DEFAULT_GROUP_DATA_IMAGE; }); } diff --git a/frontend/public/group-icon.svg b/frontend/public/group-icon.svg deleted file mode 100644 index 64a8f4c7..00000000 --- a/frontend/public/group-icon.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/frontend/public/user-icon.svg b/frontend/public/user-icon.svg deleted file mode 100644 index 705395cb..00000000 --- a/frontend/public/user-icon.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file