Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIP-96: no transform #1262

Merged
merged 2 commits into from
May 27, 2024
Merged

NIP-96: no transform #1262

merged 2 commits into from
May 27, 2024

Conversation

v0l
Copy link
Member

@v0l v0l commented May 27, 2024

@fishcakeday
Copy link

LGTM! Ship it!
I assume we can use existing error codes to communicate rejection.

@nostrband
Copy link
Collaborator

ACK

@quentintaranpino
Copy link

Simple and effective, it solves a need. I'm in

96.md Outdated Show resolved Hide resolved
@sant0s12
Copy link
Contributor

I think it is still not clear if the server can send variants if no_transform is not set.

I'll refer to my comment in the previous discussion regarding the x and xo tags:

I think the server should just return one hash that has different meanings:

  • If the uploader requests no transformation, then this is the hash of the original file and it is expected that the server will continue serving a file that matches this.
  • Otherwise (default) this is not expected to match any files served since the server might apply any transformations it wants. This can be viewed more like an id, although in practice the server may use the hash of the initially compressed file or whatever, as long as it is unique.

If it is critical for the user to make sure that the file has not changed, they can use no_transform, otherwise I think it makes more sense that the server can decide what exactly to send the client and apply optimizations (dynamically) on its end.

@fishcakeday
Copy link

I think it is still not clear if the server can send variants if no_transform is not set.

I'll refer to my comment in the previous discussion regarding the x and xo tags:

I think the server should just return one hash that has different meanings:

  • If the uploader requests no transformation, then this is the hash of the original file and it is expected that the server will continue serving a file that matches this.
  • Otherwise (default) this is not expected to match any files served since the server might apply any transformations it wants. This can be viewed more like an id, although in practice the server may use the hash of the initially compressed file or whatever, as long as it is unique.

If it is critical for the user to make sure that the file has not changed, they can use no_transform, otherwise I think it makes more sense that the server can decide what exactly to send the client and apply optimizations (dynamically) on its end.

I see no reason why not to serve variants under a separate and pre-communicated path. As long as the original file is the same, variants are irrelevant to this.

@v0l
Copy link
Member Author

v0l commented May 27, 2024

I think variants can be handled in a similar manner to #1261

Co-authored-by: Santos <34815293+sant0s12@users.noreply.github.com>
@arthurfranca
Copy link
Contributor

ACK!

@sant0s12
Copy link
Contributor

What I mean by variant is anything that is not the original file. And I think that the expected correct behavior is not clear.

Let me give an example:
Imagine a user uploads a file, the server compresses it somehow and then starts serving it. However, after some time, the server operator decides to decrease the quality of the images of free tier users (e.g., by compressing them again or decreasing the resolution). This changes the hash of the served image.
If the client assumes that the image hash will remain the same as when the image was originally uploaded, then it will probably display a warning to the user.

Is this the expected behavior?

I'd say it makes more sense that the user must not make any assumptions about the image hash unless they specify no_transform.

In any case, if you all agree on the contrary, I think it would be worth it to specify that the server is expected to serve the same transformed file onward.

@fishcakeday
Copy link

Once the file is served under one hash, it will not be touched under the same URL (that is in the NIP)

Behavior about the 301/302 is undefined, I agree. no_transform will essentially make file immutable.

@sant0s12
Copy link
Contributor

Once the file is served under one hash, it will not be touched under the same URL (that is in the NIP)

Where? I can't find it 😅

@fiatjaf fiatjaf merged commit 17593a4 into nip96-sync May 27, 2024
@fiatjaf fiatjaf deleted the nip96-no-transform branch May 27, 2024 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants