modrinth / labrinth

Our Rust-based backend utilizing the actix-web framework to serve Modrinth's API.
https://modrinth.com
GNU Affero General Public License v3.0
532 stars 74 forks source link

Unable to set my mod as "client optional" #883

Open enjarai opened 7 months ago

enjarai commented 7 months ago

Describe the bug

It seems like the backend on the main Modrinth website isn't allowing my mod to be set as "server: required, client: optional", always reverting an "optional" setting back to "unsupported". When trying to change these values, the frontend reflects the changes properly, but upon reloading the page, these properties revert.

This can also be recreated by directly using the Modrinth API.

Steps to reproduce

  1. Open the settings page of an owned mod project.
  2. In the general tab, set "Client-side" to "Optional" using the dropdown.
  3. Save the changes.
  4. Navigate back to the mod page, observe that the client property had changed to "Optional".
  5. Reload the page.
  6. Observe that the client property has been changed to "Unsupported".

Alternatively:

  1. Prepare a PATCH request to https://api.modrinth.com/v2/project/<slug>
  2. Set your Content-Type and Authorization headers appropriately.
  3. Use the following payload:
    {
      "client_side": "optional"
    } 
  4. Send the request, observe that it succeeds with a 204 status code.
  5. Reload the mod page.
  6. Observe that the client property has been changed to "Unsupported".

Expected behavior

I would expect the "Client-side" property to be set to "Optional", to properly indicate the nature of my mod to potential users.

Additional context

No response

RubixDev commented 6 months ago

I can confirm this. I only recently noticed that my mod said "client side: unsupported" and then found out that it's impossible to set it as client optional and server required. I think maybe this function may be the cause?

https://github.com/modrinth/labrinth/blob/decfcb6c272b4c4faed225f9a79ec8f1ee623964/src/routes/v2_reroute.rs#L233-L272

squeek502 commented 5 months ago

Same problem here, can't set server_side to optional with client_side set to required, it always reverts server_side to unsupported.

mega12345mega commented 1 month ago

I'm also having this problem for the client required, server optional case. Additionally, it looks like this issue was also recently reported here: https://github.com/modrinth/code/issues/2153

It seems like the core of the issue is that, in my case, the mod being required on the client and optional on the server is confusing, since by "required on the client" I mean "to access the functionality of the mod, you must install it in the client regardless of if it is installed on the server" rather than "you cannot join a server with this installed unless it is also on the client". The latter would imply both the client and the server being required, since it seems unlikely that a mod like that would support client only (though there may also be a use-case for that).

As a result, it might make more sense to somehow differentiate between the two meanings of "required on the client" (unsure what words to use).

For more details on why this is useful, my mod is setup so that you can access some of the features when it is installed on the client (specifically, editing items in your inventory), but can then have its functionality extended when it is installed on the server (editing items anywhere, editing blocks, editing entities). Anyone without the mod installed on the client can't do anything special, but are allowed to join the server.

This type of change also relates to https://github.com/modrinth/labrinth/issues/895.