1 Commits

Author SHA1 Message Date
a7818fbebc fix(maintainability): clean up reliability issues 2026-06-25 20:36:39 +01:00
5 changed files with 6 additions and 20 deletions

3
.gitignore vendored
View File

@@ -40,8 +40,7 @@ build/
### Generated Files ###
/videos
/outputs
frontend/.flowbite-react
outputs/
generated
.mvn

View File

@@ -3,7 +3,6 @@ import { Eye, EyeOff, Copy, Check } from "lucide-react";
import Box from "../components/Box.tsx";
import { getUser } from "../utils/endpoints.ts";
import type { User } from "../utils/types.ts";
import { formatLocalDate } from "../utils/utils.ts";
const Profile = () => {
const [user, setUser] = useState<User | null>(null);
@@ -45,7 +44,7 @@ const Profile = () => {
<p className="text-sm text-gray-500">@{user.username}</p>
<p className="text-sm text-gray-500">{user.email}</p>
<p className="text-xs text-gray-400 mt-1">
Member since {formatLocalDate(user.createdAt)}
Member since {new Date(user.createdAt).toLocaleDateString(undefined, { year: "numeric", month: "long", day: "numeric" })}
</p>
</div>
</Box>

View File

@@ -7,20 +7,12 @@ function formatTime(seconds: number): string {
return `${m}:${pad(s)}`;
}
// Parses a UTC date string, appending Z if no timezone offset is present so
// the browser always interprets the value as UTC rather than local time.
function stringToDate(dateString: string): Date {
const normalized = dateString.replace(/(\.\d{3})\d+/, "$1");
const withTz = /[Zz]$|[+-]\d{2}:\d{2}$|[+-]\d{4}$/.test(normalized) ? normalized : `${normalized}Z`;
const date = new Date(withTz);
const date = new Date(dateString.substring(0, 23));
if (isNaN(date.getTime())) throw new Error("Invalid date string");
return date;
}
function formatLocalDate(dateString: string, options?: Intl.DateTimeFormatOptions): string {
return stringToDate(dateString).toLocaleDateString(undefined, options ?? { year: "numeric", month: "long", day: "numeric" });
}
function dateToTimeAgo(date: Date): string {
const secondsAgo = Math.floor((Date.now() - date.getTime()) / 1000);
const units: [number, string][] = [
@@ -40,4 +32,4 @@ function dateToTimeAgo(date: Date): string {
return `${s} second${s !== 1 ? 's' : ''} ago`;
}
export { formatTime, stringToDate, dateToTimeAgo, formatLocalDate };
export { formatTime, stringToDate, dateToTimeAgo };

View File

@@ -58,7 +58,7 @@ public class StreamController {
Optional<Stream> stream = streamService.getActiveStream();
return stream.map(value -> ResponseEntity.ok(new APIResponse<>(SUCCESS,
"Streaming status retrieved",
new StreamResponse(true, value.getId())))).orElseGet(() -> ResponseEntity.ok(new APIResponse<>(SUCCESS,
new StreamResponse(true, value.getId())))).orElseGet(() -> ResponseEntity.ok(new APIResponse<>("success",
"Streaming status retrieved",
new StreamResponse(false, null))));
}

View File

@@ -76,13 +76,9 @@ public class StreamActionsService {
progressTracker.markComplete();
return CompletableFuture.completedFuture(outputFile);
} catch (IOException e) {
} catch (IOException | InterruptedException e) {
logger.error("Failed to save section to '{}'", outputFile, e);
return CompletableFuture.failedFuture(e);
} catch (InterruptedException e) {
logger.error("Failed to save section");
Thread.currentThread().interrupt();
return CompletableFuture.failedFuture(e);
}
}
}