Commit Graph

14 Commits

Author SHA1 Message Date
evazion
d053dc7356 Fix #5143: Allow name changes with same name but changed case. 2022-11-12 23:04:45 -06:00
evazion
c133866cb7 users: don't allow users to choose reserved names.
Don't allow users to choose names that conflict with search syntax, like `any` or `none`, or names
that impersonate user levels, like `Admin`, `Moderator`, `Anonymous`, etc.
2022-11-06 16:00:07 -06:00
evazion
c96d60a840 uploads: add support for uploading .avif files.
Features of AVIF include:

* Lossless and lossy compression.
* High dynamic range (HDR) images
* Wide color gamut images (i.e. 10- and 12-bit color depths)
* Transparency (through alpha planes).
* Animations (with an optional cover image).
* Auxiliary image sequences, where the file contains a single primary
  image and a short secondary video, like Apple's Live Photos.
* Metadata rotation, mirroring, and cropping.

The AVIF format is still relatively new and some of these features aren't well
supported by browsers or other software:

* Animated AVIFs aren't supported by Firefox or by libvips.
* HDR images aren't supported by Firefox.
* Rotated, mirrored, and cropped AVIFs aren't supported by Firefox or Chrome.
* Image grids, where the file contains multiple images that are tiled
  together into one big image, aren't supported by Firefox.
* AVIF as a whole has only been supported for a year or two by Chrome
  and Firefox, and less than a year by Safari.

For these reasons, only basic AVIFs that don't use animation, rotation,
cropping, or image grids can be uploaded.
2022-10-25 03:29:58 -05:00
evazion
74d6b4e81e users: don't allow names ending with file extensions.
This is so in the future we can have URLs like https://danbooru.donmai.us/users/evazion
without problems caused by names like https://danbooru.donmai.us/users/evazion.json
2022-03-07 04:39:00 -06:00
evazion
a160a3acce users: add stricter username rules.
Add stricter username rules:

* Only allow usernames to contain basic letters, numbers, CJK characters, underscores, dashes and periods.
* Don't allow names to start or end with punctuation.
* Don't allow names to have multiple underscores in a row.
* Don't allow active users to have names that look like deleted users (e.g. "user_1234").
* Don't allow emoji or any other Unicode characters except for Chinese, Japanese, and Korean
  characters. CJK characters are currently grandfathered in but will be disallowed in the future.

Users with an invalid name will be shown a permanent sitewide banner until they change their name.
2022-03-05 01:08:53 -06:00
evazion
b4620f561c users: lower max username length to 25 characters.
The median username length is 8 characters. The 99% percentile is 18
characters. The 99.9% percentile is 24 characters. About 750 users have
a name more than 24 characters long.

This doesn't do anything about existing users with long usernames.

Note that this is the length in Unicode codepoints, not grapheme
clusters. Some Unicode characters and emoji may be a single glyph but
composed of multiple codepoints.
2022-03-01 21:23:21 -06:00
evazion
a7dc05ce63 Enable frozen string literals.
Make all string literals immutable by default.
2021-12-14 21:33:27 -06:00
evazion
ed302fdf4d docs: add documentation for various classes in app/logical. 2021-06-23 06:23:29 -05:00
evazion
8d87b1a0c0 models: fix deprecated errors[:base] << "message" calls.
Replace the idiom `errors[:base] << "message"` with
`errors.add(:base, "message")`. The former is deprecated in Rails 6.1.
2020-12-13 04:10:48 -06:00
evazion
6d615001e4 users: add user name blacklist. 2020-04-06 14:13:22 -05:00
evazion
309821bf73 rubocop: fix various style issues. 2019-12-22 21:23:37 -06:00
r888888888
26267cd238 add fix script for user names 2017-03-06 16:59:24 -08:00
r888888888
51c752be2f do not normalize name before validating 2017-03-06 16:54:24 -08:00
evazion
6966b74e18 Disallow unicode whitespace in usernames (#2894). 2017-02-25 01:51:33 -06:00