Commit Graph

10387 Commits

Author SHA1 Message Date
evazion
b9ea9d2f5a css: fix styling of selected post in parent/child box.
* On the post show page, in the parent/child box, change it so that
  currently selected post is more visible. Use a light blue outline
  around the current post instead of a dark semi-transparent border.

* Fix it so that there's less empty space around thumbnails in the
  parent/child box.
2021-02-22 02:38:26 -06:00
evazion
40712fb726 css: add red border around input fields with validation errors.
The .field_with_errors class is added by Simple Form to <input> fields
with validation errors.
2021-02-22 02:38:26 -06:00
evazion
1c1d784547 css: rework color scheme to use new color palette.
Add a new color palette and rework all site colors (both light mode and dark mode) to
use the new palette.

This ensures that colors are used consistently, from a carefully designed color palette,
instead of being chosen at random.

Before, colors in light mode were chosen on an ad-hoc basis, which resulted in a lot of
random colors and inconsistent design.

The new palette has 7 hues: red, orange, yellow, green, blue, azure (a lighter blue), and
purple. There's also a greyscale. Each hue has 10 shades of brightness, which (including
grey) gives us 80 total colors.

Colors are named like this:

    var(--red-0);    /* very light red */
    var(--red-2);    /* light red */
    var(--red-5);    /* medium red */
    var(--red-7);    /* dark red */
    var(--red-9);    /* very dark red */
    var(--green-7);  /* dark green */
    var(--blue-5);   /* medium blue */
    var(--purple-3); /* light purple */
                     /* etc */

The color palette is designed to meet the following criteria:

* To have close equivalents to the main colors used in the old color scheme,
  especially tag colors, so that changes to major colors are minimized.
* To produce a set of colors that can be used as as main text colors, as background
  colors, and as accent colors, both in light mode and dark mode.
* To ensure that colors at the same brightness level have the same perceived brightness.
  Green-4, blue-4, red-4, purple-4, etc should all have the same brightness and contrast
  ratios. This way colors look balanced. This is actually a difficult problem, because human
  color perception is non-linear, so you can't just scale brightness values linearly.

There's a color palette test page at https://danbooru.donmai/static/colors

Notable changes to colors in light mode:

* Username colors are the same as tag colors.
* Copyright tags are a deeper purple.
* Builders are a deeper purple (fixes #4626).
* Moderators are green.
* Gold users are orange.
* Parent borders are a darker green.
* Child borders are a darker orange.
* Unsaved notes have a thicker red border.
* Selected notes have a thicker blue (not green) border.
2021-02-22 02:32:49 -06:00
evazion
b598a11f02 css: add [hidden] rule. 2021-02-22 01:50:02 -06:00
evazion
d32501944c Merge pull request #4729 from nonamethanks/fix_bur_form
Updates the BUR form to reference the new commands
2021-02-18 20:19:49 -06:00
evazion
150bcccb41 posts: make Enter key shortcut show deprecation message (#4661). 2021-02-18 19:25:45 -06:00
evazion
4ef30844f6 views: factor out humanized_number helper.
* Render counts in the user profile tooltip the same way as tag counts.
* Render tag counts in the tags index page the same way as tag counts in
  the tags list.
2021-02-18 19:16:41 -06:00
evazion
bcca0ca53a Update Ruby gems and Yarn packages. 2021-02-18 19:11:21 -06:00
evazion
981d56c97c paginator: fix switching to sequential pagination.
Fix a bug where the paginator didn't correctly switch to sequential
pagination when reaching the page limit.
2021-02-18 19:01:45 -06:00
evazion
4e6dff782d paginator: fix page 1 shown twice in empty searches.
Fix a bug where page 1 was shown twice (once for the current page, and
once for the last page) in searches that returned 0 results.
2021-02-18 18:55:27 -06:00
nonamethanks
4a4053d2d7 Updates the BUR form to reference the new commands 2021-02-19 00:46:31 +01:00
evazion
b63d8207a9 forum: automatically post new forum posts to Discord. 2021-02-18 07:08:45 -06:00
evazion
93f6e935a8 search: fix underestimation of page count for blank searches.
Bug: In Postgres 13, getting the count of a blank search underestimated
the page count by a large margin (~700,000 posts).

The query we were executing was this:

    EXPLAIN (FORMAT JSON) SELECT * FROM posts ORDER BY id DESC

The `ORDER BY id DESC` clause triggered a parallel seq scan query plan
in Postgres 13, which for some reason causes Postgres to underestimate
the row count by large amount in each parallel branch.

Getting rid of the ORDER BY clause makes it do a regular seq scan, which
gives an accurate estimate.
2021-02-18 04:37:27 -06:00
evazion
af84314c38 posts: remove dead has_ugoira_webm? code. 2021-02-18 04:05:18 -06:00
evazion
e165ad3213 notes: enable spellcheck in note edit box. 2021-02-18 04:04:06 -06:00
evazion
013fd38175 tests: add baraag credentials to github CI. 2021-02-18 03:53:33 -06:00
evazion
c1805cc4e0 views: factor out paginator component.
* Refactor the paginator into a ViewComponent.
* Fix inconsistent spacing between paginator items.
* Fix a bug where the sequential paginator generated the wrong next /
  previous page links in the <link rel="{next|prev}"> tags in the <head>.
* Always include the final page as a hidden html element, so that it can
  be unhidden with custom CSS.
* Make it easier to change the pagination window.
2021-02-18 02:47:21 -06:00
evazion
8b8a3f3836 Merge pull request #4723 from nonamethanks/pawoo2mastodon
Convert pawoo strategy into mastodon; add baraag.net support
2021-02-16 18:22:20 -06:00
evazion
2fccf203bd Merge pull request #4719 from nonamethanks/fanbox-r18
Fanbox: fix tests and a bug with image ordering in the bookmarklet
2021-02-16 18:18:04 -06:00
evazion
0ef28c2401 Merge pull request #4708 from nonamethanks/fix-4706
Fix page title in case of no copyright tag
2021-02-16 18:16:34 -06:00
evazion
cf24a3a1de Merge pull request #4707 from nonamethanks/sample_size
Use correct post limit in the sample links for mods in user profiles
2021-02-16 18:16:10 -06:00
evazion
6620e34a02 Merge pull request #4709 from nonamethanks/fix-4705
IP Bans: format reason via dtext
2021-02-16 18:15:56 -06:00
evazion
075cb73774 Merge pull request #4724 from nonamethanks/underused-cosplay
Don't mark cosplay/style tags as low post count
2021-02-16 18:13:57 -06:00
evazion
003b39271b Merge pull request #4726 from nonamethanks/reorder_levels
Fix ordering of user levels in user search
2021-02-16 18:11:44 -06:00
nonamethanks
877be220f6 Fix ordering of user levels in user search 2021-02-17 00:40:06 +01:00
evazion
75b0c9e9aa iqdb: block crawling of Find Similar links. 2021-02-16 15:32:43 -06:00
evazion
1fa049a18e related tags: remove artist urls; move artist tag to translated tags.
* Remove artist URLs from related tags.
* Move the artist tag to the top of the translated tags list.
2021-02-16 09:28:38 -06:00
evazion
19aea560db css: add box-sizing: border-box to base css.
This makes it so that an element's width includes borders and padding,
so that borders or padding don't cause an element to exceed its
specified width. This is a standard part of most CSS resets.

https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
2021-02-16 09:28:38 -06:00
evazion
7b3322bfd1 css: increase IBM Plex Mono font weight.
Increase the font weight from 200 to 400 for the IBM Plex Mono font used
in notes. 400 is the standard weight we use for other fonts. 200 made
the font too thin and hard to read at normal font sizes.
2021-02-16 09:28:38 -06:00
evazion
b8d95ace64 css: adjust form input box sizes.
Adjust input boxes to fit the screen better on mobile, and to use
consistent sizes throughout the site (no ad-hoc overrides to make
certain input boxes a bit bigger in random places).

On desktop, this makes most input boxes a bit taller and narrower. On
mobile, it makes input boxes the full width of the screen.

This most notably affects the tag edit box, the comment and forum
post box, the wiki page edit box, and the commentary box.
2021-02-16 09:28:38 -06:00
evazion
e215fd1c47 css: factor out recent posts component. 2021-02-16 09:28:38 -06:00
evazion
1e80540a04 css: refactor CSS to use Tailwind-style utility classes.
Refactor CSS to use standard Tailwind-style utility classes instead of
ad-hoc rules. This eliminates a lot of single-purpose rules for specific
UI elements and standardizes margins to be more consistent throughout
the site.

Utility classes are defined manually on an as-needed basis instead of
importing Tailwind as a whole. Naming conventions mostly follow
Tailwind's conventions, otherwise they follow Bootstrap.

* https://tailwindcss.com/docs/
* https://getbootstrap.com/docs/5.0/utilities/spacing/
2021-02-16 09:28:38 -06:00
evazion
7b0fee6333 css: eliminate dead css. 2021-02-16 09:03:38 -06:00
evazion
5be2d420f6 tags: adjust post count style on /tags index.
Make the /tags index display post counts the same way as they're
displayed in regular tag lists (to the right of the tag, and greyed
out).
2021-02-16 04:42:53 -06:00
evazion
99fd0a585d ip addresses: replace Google Maps with Bing Maps.
Replace the Google map on the IP address show page with a Bing map. Bing
doesn't require an API key, which makes it easier to deploy. The Google
Maps API requires to you to whitelist the IP addresses and domains you
plan to use with your API key, which is inconvenient for development
because it means maps won't display unless you whitelist your
development IPs.
2021-02-16 03:02:11 -06:00
evazion
3798a2d29e logins: don't return api_token field in API.
Remove the api_token field from the response to the login action (POST
/sessions). This doesn't make sense in the presence of multiple API
keys, and is also not generally useful; if you need an API key, create
one yourself and write it down.
2021-02-15 14:28:31 -06:00
nonamethanks
182d4e1927 Don't mark cosplay/style tags as low post count 2021-02-15 20:05:51 +01:00
nonamethanks
ffe8f8c92d Add baraag.net support 2021-02-15 13:51:52 +01:00
nonamethanks
5366b0781e Convert pawoo strategy to mastodon 2021-02-15 13:51:49 +01:00
evazion
206ff2b836 tests: fix ip geolocation test. 2021-02-15 00:38:59 -06:00
evazion
3d01febcf7 api keys: require reauthentication when working with API keys.
Require the user to re-enter their password before they can view,
create, update, or delete their API keys.

This works by tracking the timestamp of the user's last password
re-entry in a `last_authenticated_at` session cookie, and redirecting
the user to a password confirmation page if they haven't re-entered
their password in the last hour.

This is modeled after Github's Sudo mode.
2021-02-15 00:17:31 -06:00
evazion
d99985160a api keys: add API key usage tracking.
Track when an API key was last used, which IP address last used it, and
how many times it's been used overall.

This is so you can tell when an API key was last used, so you know if
the key is safe to delete, and so you can tell if an unrecognized IP has
used your key.
2021-02-14 21:02:07 -06:00
evazion
25fda1ecc2 api keys: add IP whitelist and API permission system.
Add the ability to restrict API keys so that they can only be used with
certain IP addresses or certain API endpoints.

Restricting your key is useful to limit damage in case it gets leaked or
stolen. For example, if your key is on a remote server and it gets
hacked, or if you accidentally check-in your key to Github.

Restricting your key's API permissions is useful if a third-party app or
script wants your key, but you don't want to give full access to your
account.

If you're an app or userscript developer, and your app needs an API key
from the user, you should only request a key with the minimum
permissions needed by your app.

If you have a privileged account, and you have scripts running under
your account, you are highly encouraged to restrict your key to limit
damage in case your key gets leaked or stolen.
2021-02-14 21:02:07 -06:00
evazion
a6707fbfa2 api keys: allow users to have multiple API keys.
This is useful if you have multiple programs and want to give them
different API keys, or if you want to rotate keys for a single program.
2021-02-14 04:09:47 -06:00
evazion
37061f95a6 api keys: rework API key UI.
* Add an explanation of what an API key is and how to use it.
* Make it possible for the site owner to view all API keys.
* Remove the requirement to re-enter your password before you can view
  your API key (to be reworked).
* Move the API key controller from maintenance/user/api_keys_controller.rb
  to a top level controller.
2021-02-14 04:09:47 -06:00
evazion
ae204df4ca css: factor out button css.
Factor out the buttons from the user upgrades page into a general
UI component.
2021-02-14 02:56:19 -06:00
evazion
f42fe5f1f7 Upgrade font packages.
The `typefaces` project has been deprecated in favor of `fontsource`.

https://github.com/KyleAMathews/typefaces
https://github.com/fontsource/fontsource
2021-02-13 18:51:51 -06:00
evazion
db8991babf Update ruby gems and yarn packages. 2021-02-13 18:22:28 -06:00
evazion
23a06aff1d Fix #4720: Pixiv commentary links all create invalid urls.
Regression caused by the switch from the mobile API to the Ajax API. In
the Ajax API, commentaries have /jump.php?<url> links that we have to strip out.
2021-02-13 17:41:01 -06:00
nonamethanks
482c1e4c7c Fanbox: fix tests and image ordering
* fix the test for R18 posts, which are now supported
* replace the dead post for the imageMap test with an active one
* fix the ordering of images: it was possible to get the wrong image in
some cases when not using the batch bookmarklet, because of how fanbox
orders imageMap posts
* fix a bug where the sample wasn't properly replaced with the full
size
* rename test file to match the rest of the other files
2021-02-10 16:53:22 +01:00