I'm a passionate mainly Java developer that has been working with various technologies over the years. My favourite things to build are
- centralized systems for parallel computing
- dynamic systems for scaling computing instances
A fully-compliant Java wrapper for the Modrinth API
License: MIT License
This works:
var version = api.versions().files().getVersionByHash(FileHash.SHA1, hash).join()
but using FileHash.SHA256
doesn't and I don't think Modrinth currently stores SHA-256 file hashes, only SHA-1 and SHA-512 looking at the documentation
There currently seems to be no way of setting a custom timeout for the http requests. This is problematic because if the API takes longer than the default timeout (Which I assume is 10 seconds here like it usually is) to respond will the client report a timeout and fail, even tho it did succeed.
I had this very issue myself: Client reports timeout but the releases were all uploaded properly to modrinth...
I'm getting the below exception when trying to create a new release for my project. Given the Exception name, I assume the endpoint is no longer accurate?
GitHub Mirror should codeberg have loading issues:
https://github.com/Andre601/AdvancedServerList/blob/master/version-uploader/src/main/java/ch/andre601/advancedserverlist/versionuploader/modrinth/ModrinthVersionUploader.java
[ 20.09.2023 22:48:03 WARN ] [ForkJoinPool.commonPool-worker-1] [ModrinthVersionUploader] - Encountered an exception while uploading a new release to Modrinth!
java.util.concurrent.CompletionException: EndpointException(error=invalid_input, description=Error while parsing JSON: Base62 decoding overflowed at line 1 column 1379)
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:649)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1810)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: masecla.modrinth4j.exception.EndpointException: null
at masecla.modrinth4j.endpoints.generic.Endpoint.checkBodyForErrors(Endpoint.java:176)
at masecla.modrinth4j.endpoints.version.CreateVersion.lambda$sendRequest$0(CreateVersion.java:174)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
... 8 common frames omitted
I found your project yesterday and it's really useful for me, but there's one thing I'm missing: Recursive dependencies. The problem is that mods' dependencies can also have dependencies that are not found by calling client.projects().getProjectDependencies(projectId).join().getProjects();
.
Perhaps you could modify the existing method so that it automatically gets all dependencies? for compatibility with older versions you could add an optional argument called int depth
which would specify the maximum recursion depth and if not set or 0 then it would be like the current method. The code I am currently using for this (if it helps) is this:
private Map<String, String> resolveDependencies(String projectId, String versionId) {
List<Project> thisProjectDependencies = client.projects().getProjectDependencies(projectId).join().getProjects();
// For each dependency of the project
for (Project dependency : thisProjectDependencies) {
// Skip if dependency has already been added
if (!dependencies.containsKey(dependency.getId())) {
List<ProjectVersion> versions = client.versions().getProjectVersions(dependency.getId(), GetProjectVersions.GetProjectVersionsRequest.builder().build()).join();
String latestVersionId = versions.get(versions.size() - 1).getId();
// Add dependency to map
dependencies.put(dependency.getId(), latestVersionId);
// If dependency has any subdependencies then call this method again
if (client.versions().getVersion(latestVersionId).join().getDependencies() != null) {
resolveDependencies(dependency.getId() , latestVersionId);
}
}
}
return dependencies;
}
Also there are still problems with this code but I hope it helps anyway
Regards
Daniel
There should be an option to get all of the project's versions without getting the project, like versions().getProjectVersions() but without resticting to only featured of unfeatured versions
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.