mirror of
https://github.com/imgfloat/server.git
synced 2026-02-05 03:39:26 +00:00
Refactor and code smells
This commit is contained in:
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class GitInfoService {
|
||||
|
||||
private static final String FALLBACK_GIT_SHA = "unknown";
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GitInfoService.class);
|
||||
private static final String COMMIT_URL_PREFIX = "https://github.com/Kruhlmann/imgfloat-j/commit/";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package dev.kruhlmann.imgfloat.service;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
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;
|
||||
|
||||
@@ -4,14 +4,12 @@ import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
public record AssetContent(byte[] bytes, String mediaType) {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
AssetContent that = (AssetContent) o;
|
||||
return Arrays.equals(bytes, that.bytes)
|
||||
&& Objects.equals(mediaType, that.mediaType);
|
||||
return Arrays.equals(bytes, that.bytes) && Objects.equals(mediaType, that.mediaType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -23,9 +21,6 @@ public record AssetContent(byte[] bytes, String mediaType) {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AssetContent{" +
|
||||
"bytes=" + Arrays.toString(bytes) +
|
||||
", mediaType='" + mediaType + '\'' +
|
||||
'}';
|
||||
return "AssetContent{" + "bytes=" + Arrays.toString(bytes) + ", mediaType='" + mediaType + '\'' + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import javax.imageio.IIOImage;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.imageio.ImageWriteParam;
|
||||
|
||||
@@ -3,24 +3,19 @@ package dev.kruhlmann.imgfloat.service.media;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
public record OptimizedAsset(
|
||||
byte[] bytes,
|
||||
String mediaType,
|
||||
int width,
|
||||
int height,
|
||||
byte[] previewBytes
|
||||
) {
|
||||
|
||||
public record OptimizedAsset(byte[] bytes, String mediaType, int width, int height, byte[] previewBytes) {
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
OptimizedAsset that = (OptimizedAsset) o;
|
||||
return width == that.width
|
||||
&& height == that.height
|
||||
&& Arrays.equals(bytes, that.bytes)
|
||||
&& Arrays.equals(previewBytes, that.previewBytes)
|
||||
&& Objects.equals(mediaType, that.mediaType);
|
||||
return (
|
||||
width == that.width &&
|
||||
height == that.height &&
|
||||
Arrays.equals(bytes, that.bytes) &&
|
||||
Arrays.equals(previewBytes, that.previewBytes) &&
|
||||
Objects.equals(mediaType, that.mediaType)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -33,12 +28,20 @@ public record OptimizedAsset(
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OptimizedAsset{" +
|
||||
"bytes=" + Arrays.toString(bytes) +
|
||||
", mediaType='" + mediaType + '\'' +
|
||||
", width=" + width +
|
||||
", height=" + height +
|
||||
", previewBytes=" + Arrays.toString(previewBytes) +
|
||||
'}';
|
||||
return (
|
||||
"OptimizedAsset{" +
|
||||
"bytes=" +
|
||||
Arrays.toString(bytes) +
|
||||
", mediaType='" +
|
||||
mediaType +
|
||||
'\'' +
|
||||
", width=" +
|
||||
width +
|
||||
", height=" +
|
||||
height +
|
||||
", previewBytes=" +
|
||||
Arrays.toString(previewBytes) +
|
||||
'}'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
const path = require("node:path");
|
||||
|
||||
const { app, BrowserWindow } = require("electron");
|
||||
const { autoUpdater } = require("electron-updater");
|
||||
const path = require("path");
|
||||
|
||||
const initialWindowWidthPx = 960;
|
||||
const initialWindowHeightPx = 640;
|
||||
|
||||
|
||||
@@ -1762,6 +1762,7 @@ button:disabled:hover {
|
||||
position: relative;
|
||||
padding-right: 48px !important;
|
||||
font-variant-numeric: tabular-nums;
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
.number-input::-webkit-outer-spin-button,
|
||||
@@ -1770,10 +1771,6 @@ button:disabled:hover {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.number-input {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
.number-input:focus {
|
||||
border-color: #7c3aed;
|
||||
box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
|
||||
|
||||
Reference in New Issue
Block a user