Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

Hunternif
Copy link
Contributor

@Hunternif Hunternif commented Feb 16, 2025

Use case: I want to show off the awesome szurubooru to my friend, but I don't want them to see my nsfw posts XD

This PR adds 2 privileges:

'posts:list:unsafe':    regular
'posts:view:unsafe':    regular

The view privilege restricts viewing "unsafe" posts via post_api. (But you can still see thumbnails.)
The list privilege filters out any "unsafe" posts from your query, for all queries.
Adds unit tests too.

@hujle
Copy link
Contributor

hujle commented Mar 1, 2025

That's a good feature, but I wish it wasn't pinned to unsafe category and could be applied to any of them.

On that note, an extra "hidden" category with these permissions applied to it would be better solution.

Since search queries get cached, when a search performed by a
privileged user is repeated by an unprivileged user, they will receive
a listing that erroneously includes unsafe posts. The same is true the
other way around, a tag search that is first performed by an anonymous
user will cause any hidden posts for that query to not show up for the
logged in user. This is because the initial search claims the cache key.
@po5
Copy link
Collaborator

po5 commented Mar 25, 2025

The post listing change leads to cache collisions, I submitted a PR with a fix explaining the issue. Hunternif#2

server: prevent cache key collision
@po5
Copy link
Collaborator

po5 commented Mar 27, 2025

Closes #430.

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.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.