Code Monkey home page Code Monkey logo

modrinth4j's Introduction

Hello, I'm Matt

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

Matt's GitHub stats

modrinth4j's People

Contributors

dependabot[bot] avatar masecla22 avatar thexxturboxx avatar zechiax avatar ztereohype avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

modrinth4j's Issues

Suggestion

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

EndpointException when trying to create new release. Malformed JSON/Wrong endpoint?

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?

The code used:
https://codeberg.org/Andre601/AdvancedServerList/src/branch/master/version-uploader/src/main/java/ch/andre601/advancedserverlist/versionuploader/modrinth/ModrinthVersionUploader.java

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

Recursive Dependency Scanning

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

  1. It ignores the dependency version if it is given f.ex. a certain version of fabric api is needed.
  2. It ignores the required game and loader types and versions.

Regards
Daniel

Allow setting of custom timeouts

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...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.