Enable branding without code changes (#34246)

closes #34244

Signed-off-by: Peter Skopek <pskopek@redhat.com>
This commit is contained in:
Peter Skopek 2025-09-24 07:25:40 +02:00 committed by GitHub
parent c05b84a0d2
commit 14e4e1aed2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 23 additions and 4 deletions

View File

@ -27,27 +27,33 @@ import java.util.Properties;
*/
public class Version {
public static final String UNKNOWN = "UNKNOWN";
public static final String NAME = "Keycloak";
public static final String NAME_HTML = "<div class=\"kc-logo-text\"><span>Keycloak</span></div>";
public static String VERSION;
public static String RESOURCES_VERSION;
public static String BUILD_TIME;
private static String name;
static {
try (InputStream is = Version.class.getResourceAsStream("/keycloak-version.properties")) {
Properties props = new Properties();
props.load(is);
Version.VERSION = props.getProperty("version");
Version.BUILD_TIME = props.getProperty("build-time");
name = props.getProperty("name");
Version.RESOURCES_VERSION = Version.VERSION.toLowerCase();
if (Version.RESOURCES_VERSION.endsWith("-snapshot")) {
Version.RESOURCES_VERSION = Version.RESOURCES_VERSION.replace("-snapshot", "-" + Version.BUILD_TIME.replace(" ", "").replace(":", "").replace("-", ""));
}
} catch (IOException e) {
Version.VERSION = Version.UNKNOWN;
Version.BUILD_TIME = Version.UNKNOWN;
name = "Keycloak";
}
}
public static final String NAME = name;
public static final String NAME_HTML = "<div class=\"kc-logo-text\"><span>" + name + "</span></div>";
}

View File

@ -15,4 +15,5 @@
# limitations under the License.
#
version=${project.version}
build-time=${project.build-time}
build-time=${project.build-time}
name=${project.build-name}

View File

@ -82,6 +82,17 @@
<module>downloads</module>
</modules>
</profile>
<profile>
<id>dist-api-docs</id>
<activation>
<property>
<name>dist.api.docs</name>
</property>
</activation>
<modules>
<module>api-docs-dist</module>
</modules>
</profile>
</profiles>
</project>

View File

@ -50,6 +50,7 @@
<jboss-logging-annotations.version>3.0.4.Final</jboss-logging-annotations.version> <!-- keep in sync with the version used by quarkus -->
<project.build-time>${timestamp}</project.build-time>
<project.build-name>Keycloak</project.build-name>
<!-- Following properties are used for downstream build to alter final distribution archive file name and internal base directory of the archive. -->
<dist.archive.file.prefix>keycloak</dist.archive.file.prefix>

View File

@ -1 +1 @@
Keycloak - Version ${project.version}
${project.build-name} - Version ${project.version}