Module utils

Source

Structs§

Author
Award
Awards
Comment
ErrorTemplate
Flags
Flair
FlairPart
GalleryMedia
InfoTemplate
Media
NSFWLandingTemplate
Template for NSFW landing page. The landing page is displayed when a page’s content is wholly NSFW, but a user has not enabled the option to view NSFW posts.
Params
Poll
PollOption
Post
Preferences
Subreddit
ThemeAssets
User

Enums§

ResourceType
Identifies whether or not the page is a subreddit, a user page, or a post. This is used by the NSFW landing template to determine the mesage to convey to the user.

Functions§

catch_random
deflate_compress
deflate_decompress
disable_indexing
Returns true if the config/env variable REDLIB_ROBOTS_DISABLE_INDEXING carries the value on.
enable_rss
Returns true if the config/env variable REDLIB_ENABLE_RSS is set to “on”. If this variable is set as such, the instance will enable RSS feeds. Otherwise, the instance will not provide RSS feeds.
error
Renders a generic error landing page.
filter_posts
Filters a Vec<Post> by the given HashSet of filters (each filter being a subreddit name or a user name). If a Post’s subreddit or author is found in the filters, it is removed.
format_num
format_url
get_filters
Gets a HashSet of filters from the cookie in the given Request.
get_post_url
info
Renders a generic info landing page.
nsfw_landing
Renders the landing page for NSFW content when the user has not enabled “show NSFW posts” in settings.
param
parse_post
Creates a Post from a provided JSON.
redirect
render_bullet_lists
rewrite_emotes
rewrite_urls
setting
setting_or_default
sfw_only
Returns true if the config/env variable REDLIB_SFW_ONLY carries the value on.
should_be_nsfw_gated
template
time
url_path_basename
val