Skip to content

Commit

Permalink
Fix user agent stripping not working
Browse files Browse the repository at this point in the history
  • Loading branch information
LostLuma committed Apr 16, 2024
1 parent 5006187 commit ff64dc9
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public static void checkForUpdates() {
List<String> loaders = ModMenu.runningQuilt ? List.of("fabric", "quilt") : List.of("fabric");

String mcVer = SharedConstants.getGameVersion().getName();
String[] splitVersion = FabricLoader.getInstance().getModContainer(ModMenu.MOD_ID)
.get().getMetadata().getVersion().getFriendlyString().split("\\+", 1); // Strip build metadata for privacy
final var modMenuVersion = splitVersion.length > 1 ? splitVersion[1] : splitVersion[0];
String version = FabricLoader.getInstance().getModContainer(ModMenu.MOD_ID)
.get().getMetadata().getVersion().getFriendlyString();
final var modMenuVersion = version.split("\\+", 2)[0]; // Strip build metadata for privacy
final var userAgent = "%s/%s (%s/%s%s)".formatted(ModMenu.GITHUB_REF, modMenuVersion, mcVer, primaryLoader, environment);
String body = ModMenu.GSON_MINIFIED.toJson(new LatestVersionsFromHashesBody(modHashes.keySet(), loaders, mcVer));
LOGGER.debug("User agent: " + userAgent);
Expand Down

0 comments on commit ff64dc9

Please sign in to comment.