diff --git a/README.md b/README.md index 46a5968..748c5fd 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ Define the following required environment variables: | `IMGFLOAT_PREVIEWS_PATH` | Filesystem path to store generated image previews | /var/imgfloat/previews | | `IMGFLOAT_DB_PATH` | Filesystem path to the SQLite database file | /var/imgfloat/imgfloat.db | | `IMGFLOAT_INITIAL_TWITCH_USERNAME_SYSADMIN` | Twitch username of the initial sysadmin user | example_broadcaster | +| `IMGFLOAT_GITHUB_OWNER` | Github user or org which has the client repository | Kruhlmann | +| `IMGFLOAT_GITHUB_REPO` | Client repository name | imgfloat-j | | `SPRING_SERVLET_MULTIPART_MAX_FILE_SIZE` | Maximum upload file size | 10MB | | `SPRING_SERVLET_MULTIPART_MAX_REQUEST_SIZE` | Maximum upload request size | 10MB | | `IMGFLOAT_GITHUB_OWNER` | GitHub owner used to build desktop download links | Kruhlmann | @@ -34,5 +36,7 @@ If you want to use the default development setup your `.env` file should look li ```sh TWITCH_CLIENT_ID=... TWITCH_CLIENT_SECRET=... +IMGFLOAT_GITHUB_OWNER=... +IMGFLOAT_GITHUB_REPO=... IMGFLOAT_INITIAL_TWITCH_USERNAME_SYSADMIN=... ``` diff --git a/src/main/java/dev/kruhlmann/imgfloat/service/VersionService.java b/src/main/java/dev/kruhlmann/imgfloat/service/VersionService.java index 80d845f..197eeec 100644 --- a/src/main/java/dev/kruhlmann/imgfloat/service/VersionService.java +++ b/src/main/java/dev/kruhlmann/imgfloat/service/VersionService.java @@ -2,6 +2,7 @@ package dev.kruhlmann.imgfloat.service; import java.io.IOException; import java.io.InputStream; +import java.io.FileNotFoundException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; @@ -22,7 +23,7 @@ public class VersionService { private final String clientVersion; private final String releaseVersion; - public VersionService() { + public VersionService() throws IOException { this.serverVersion = resolveServerVersion(); this.clientVersion = resolveClientVersion(); this.releaseVersion = normalizeReleaseVersion(this.clientVersion); @@ -61,14 +62,6 @@ public class VersionService { return "unknown"; } - private String resolveClientVersion() { - try { - return getPackageJsonVersion(); - } catch (IOException e) { - throw new IllegalStateException("Client manifest is missing", e); - } - } - private String normalizeReleaseVersion(String baseVersion) throws IllegalStateException { String normalized = baseVersion.trim(); normalized = normalized.replaceFirst("(?i)^v", ""); @@ -154,10 +147,10 @@ public class VersionService { return null; } - private String getPackageJsonVersion() throws IOException { + private String resolveClientVersion() throws IOException { Path packageJsonPath = Paths.get("package.json"); if (!Files.exists(packageJsonPath) || !Files.isRegularFile(packageJsonPath)) { - return null; + throw new FileNotFoundException("package.json not found at " + packageJsonPath.toAbsolutePath()); } String packageJson = Files.readString(packageJsonPath, StandardCharsets.UTF_8); @@ -169,6 +162,6 @@ public class VersionService { } } - return null; + throw new IllegalStateException("Version not found or invalid in package.json"); } } diff --git a/src/main/resources/templates/channels.html b/src/main/resources/templates/channels.html index 9ab3439..337390c 100644 --- a/src/main/resources/templates/channels.html +++ b/src/main/resources/templates/channels.html @@ -10,7 +10,7 @@
-
IF
+ brand
Imgfloat
Twitch overlay manager
diff --git a/src/main/resources/templates/settings.html b/src/main/resources/templates/settings.html index d48d330..77c03bc 100644 --- a/src/main/resources/templates/settings.html +++ b/src/main/resources/templates/settings.html @@ -22,7 +22,7 @@
-
IF
+ brand
Imgfloat
Twitch overlay manager