mirror of
https://github.com/imgfloat/server.git
synced 2026-02-05 03:39:26 +00:00
Add missing references
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="channels-shell">
|
||||
<header class="channels-header">
|
||||
<div class="brand">
|
||||
<div class="brand-mark">IF</div>
|
||||
<img class="brand-mark" alt="brand" src="/img/brand.png" />
|
||||
<div>
|
||||
<div class="brand-title">Imgfloat</div>
|
||||
<div class="brand-subtitle">Twitch overlay manager</div>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<div class="settings-shell">
|
||||
<header class="settings-header">
|
||||
<div class="brand">
|
||||
<div class="brand-mark">IF</div>
|
||||
<img class="brand-mark" alt="brand" src="/img/brand.png" />
|
||||
<div>
|
||||
<div class="brand-title">Imgfloat</div>
|
||||
<div class="brand-subtitle">Twitch overlay manager</div>
|
||||
|
||||
Reference in New Issue
Block a user