Commit Graph

717 Commits

Author SHA1 Message Date
evazion
da6a61b4e7 css: switch to SVG sprites for icons.
Switch to using SVG sprites for icons, instead of using a combination of icon fonts and inline SVG elements.

This means there's a single icons.svg file containing all icons, and icons are referenced like
`<svg><use href="/icons.svg#arrow-alt-up"/></svg>`.

This should make icons more efficient since a) it replaces an 80kb icon font file with a 8kb SVG
file and b) it replaces repeated inline copies of the same icon with references to the sprite sheet.
This most notably affects the upvote and downvote buttons.

This also updates icons from Font Awesome 5 to Font Awesome 6, which fixes a few minor icon
alignment issues in some places.

ref: https://fontawesome.com/docs/web/add-icons/svg-sprites
2022-12-11 02:16:01 -06:00
evazion
f0bd57af98 media assets: fix paginator positioning on mobile.
On the media assets show page, fix the styling and positioning of the paginator on mobile.
2022-12-09 22:43:32 -06:00
evazion
16c9e906b2 media assets: scroll to position on zoom.
On the media asset show page, make it so that when you click an image to zoom in, the page scrolls
to the clicked position. For example, if you click on the bottom of an image, scroll down so that
the bottom of the zoomed image is in view.

This makes it easier to view very tall images by letting you click on the part of the image you want
to see.
2022-12-09 18:23:32 -06:00
evazion
aefa7586fd media assets: refactor media asset component. 2022-12-09 15:17:45 -06:00
evazion
062a67086e media assets: fix sidebar overflow on Chrome.
Fix bug on the media assets show page where very long EXIF values wouldn't be word-broken, so they
could cause the sidebar to become wider than the screen. This only affected Chrome, not Firefox or
Safari.

Example: https://danbooru.donmai.us/media_assets/7167264
2022-12-06 19:46:41 -06:00
evazion
756362f89e Fix #4990: Allow admins to delete uploads.
Allow admins to delete media asset files.

This only deletes the image file itself, not the upload or media asset record. The upload will still
be in the user's upload list, but the image will be gone. The media asset page will still exist, but
it will only show the file's metadata, not the image itself. We don't delete the metadata so we have
a record of what the file's MD5 was and who uploaded it, to prevent the file from being uploaded
again and to take action against the user if necessary.
2022-11-29 19:10:08 -06:00
evazion
695568e08b media assets: add options to download or reverse search the image. 2022-11-29 19:10:08 -06:00
evazion
937e6df7f7 media assets: show sources on show page.
Show sources on the media asset show page. An asset can have more than one source if the same
file is uploaded from multiple sites.

Only sources from known sites are shown. Sources from unknown sites aren't shown because they
could potentially contain private information or identify the uploader in some way.

Known issue: Twitter posts often show two sources, the direct image URL and the page URL. This is
because someone uploaded the direct image URL first, and we're not able to tell that the image URL
and the page URL are for the same tweet.
2022-11-28 00:17:16 -06:00
evazion
3a42866a20 media assets: fix show page to play Flash files. 2022-11-27 22:03:07 -06:00
evazion
a5d4af332d media assets: redesign show page.
Redesign the media assets show page to:

* Include sidebar with AI tags and image metadata.
* Include next and previous image buttons.
* Make the image use 100% of the available screen space and to scroll with the window.
2022-11-27 21:32:45 -06:00
evazion
81e8ac1fa8 notes: fix text boxes not being 100% width.
Fixup for 5559219f0.
2022-11-24 03:05:05 -06:00
evazion
5559219f0a ui: hide DText "Formatting help" link in dialog boxes.
Hide the "Formatting help" link for single-line DText fields in dialog boxes, such as after the
"Reason" field in the flag, appeal, and report dialog boxes.
2022-11-21 14:23:49 -06:00
evazion
bbe32f5e5d feedbacks: update messaging about negative feedbacks.
Update wording about negative feedbacks on the new feedback page, and on the Dmail you receive when
you receive a negative feedback.
2022-11-20 17:10:20 -06:00
evazion
d63d0b1adc uploads: add archives filetypes to file upload component. 2022-11-20 14:30:02 -06:00
evazion
d7005c6b3d Fix #5195: Export ArtistCommentary Javascript Functions. 2022-11-12 22:11:04 -06:00
evazion
5456a2ea29 Merge pull request #5306 from nonamethanks/new-roles
Users: add Contributor and Approver user levels
2022-10-30 03:27:18 -05:00
evazion
81d9cf4b96 uploads: add .avif and .webp extensions to file picker dialog. 2022-10-26 04:15:37 -05:00
evazion
203067b5ed reports: add non-timeseries charts.
Add bar charts for non-timeseries data. For example, a bar chart of the
top 10 uploaders overall in the last month, rather than a timeseries
chart of the number of uploads per day for the last month.
2022-10-23 04:42:51 -05:00
evazion
f73d2e3956 reports: add ability to group reports by column.
Add ability to group reports by various columns. For example, you can see
the posts by the top 10 uploaders over time, or posts grouped by rating
over time.
2022-10-22 04:05:10 -05:00
nonamethanks
ca31e7a47c Users: add Contributor and Approver user levels 2022-10-21 20:52:31 +02:00
evazion
79d9ca3215 Merge pull request #5300 from nonamethanks/default-colored
Users: display colored usernames by default
2022-10-21 01:01:08 -05:00
evazion
7646521d0f Add basic tables and graphs for various tables.
Add basic tables and graphs for viewing things like uploads over time, new users
over time, comments over time, etc. Located at https://betabooru.donmai.us/reports.

The graphing uses Apache ECharts: https://echarts.apache.org/en/index.html.
2022-10-20 05:20:22 -05:00
nonamethanks
cadb657c5e Users: display colored usernames by default
The previous behavior can be replicated by putting the following in the
custom css:

    .user { color: var(--link-color) !important }
2022-10-19 16:52:17 +02:00
evazion
4001701d18 js: drop typopro-web package.
Drop the typopro-web Javascript package that we used to import the Comic
Relief and Kalam fonts. Include these fonts directly in our own repo
instead. This drops a bunch of unnecessary Javascript dependencies.
Fixes Dependabot alerts about security issues in random Javascript
dependencies pulled in by the typopro-web package.
2022-10-18 20:13:43 -05:00
evazion
395a3e45f6 css: add more utility classes. 2022-10-11 17:31:19 -05:00
evazion
73cc0f65c2 ugoira: remove legacy browser workarounds from JS player.
Remove various fallbacks and workarounds from the Ugoira Javascript
player for legacy browser issues.

* Remove fallbacks for URL, Blob, and ArrayBuffer (these have been
  supported in most browsers for years).
* Remove workaround for iOS <6 not supporting Blob URLs.
* Remove workaround for a bug in Safari's handling of the Range HTTP
  header. This was fixed in 2015.
* Remove support for playing a list of image URLs instead of playing
  images from the .zip file (this was never used).
* Remove support for limiting loadahead of images (it was hardcoded to
  always use unlimited loadahead anyways).
2022-10-09 18:47:15 -05:00
evazion
16f3250067 ugoira: fix player to only use list of frame delays.
The frame data for Ugoira files is stored like this:

    [{"file"=>"000000.jpg", "delay"=>65},
    {"file"=>"000001.jpg", "delay"=>65},
    {"file"=>"000002.jpg", "delay"=>65},
    {"file"=>"000003.jpg", "delay"=>65},
    {"file"=>"000004.jpg", "delay"=>65},
    {"file"=>"000005.jpg", "delay"=>65},
    {"file"=>"000006.jpg", "delay"=>65},
    {"file"=>"000007.jpg", "delay"=>65},
    {"file"=>"000008.jpg", "delay"=>65},
    {"file"=>"000009.jpg", "delay"=>65},
    {"file"=>"000010.jpg", "delay"=>65}]

This is stored in the pixiv_ugoira_frame_data table in YAML format. This
is a problem because a) we only need the frame delays to play the Ugoira,
not the filenames, and b) storing the data in YAML format is a security
issue that's blocking the upgrade to Rails 7.0.4 (see [1]).

This commit changes the Ugoira Javascript player so that it only uses
the list of frame delays, not the filenames, to play the Ugoira. This
paves the way for storing the frame delays as a simple integer array
instead as a serialized YAML object.

This assumes that the images in a Ugoira zip file are stored in the same
order they should be played back in. This was confirmed by checking every
zip file and verifying that files are actually stored in filename order.

[1]: https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017
2022-10-09 18:47:10 -05:00
evazion
04f98d3b8c Merge pull request #5246 from NamelessContributor/fix-long-tag-overflow
Fix some long tags / wiki links overflowing their container
2022-09-15 03:44:15 -05:00
evazion
1968c9c69d autocomplete: lowercase searches clientside.
Lowercase searches clientside before sending them to the server. This is
to improve cache hit rates when users accidentally type in uppercase,
especially on mobile where the first letter often gets capitalized.
2022-09-03 23:54:28 -05:00
NamelessContributor
9ea3ffb10e sidebar: fix overflow of some long links.
136e2777cb didn't account for the
wiki_pages sidebar.
2022-09-03 12:37:24 +02:00
NamelessContributor
743989262d post tooltips: fix long tags causing tag list to overflow.
The default min-width for flex items is auto instead of 0.
2022-09-03 11:40:49 +02:00
evazion
3d831f7e1c autocomplete: limit width of autocomplete menu.
Limit the width of the autocomplete menu to 480px. This is so that
stupidly long isekai titles don't blow out the size of the menu when
searching for common words.

For example, when searching for "look", one of the results is:

   no_matter_how_you_look_at_it_it's_your_fault_that_i'm_not_popular! -> watashi_ga_motenai_no_wa_dou_kangaetemo_omaera_ga_warui!
2022-09-02 13:56:53 -05:00
evazion
350009fd15 autocomplete: increase number of results returned from 10 to 20.
The new autocomplete system tends to return more results, so increase
the number of tags shown from 10 to 20. This is useful so you can do things
like search for 'skirt' during tagging to find all skirt-related tags.
2022-09-02 13:56:52 -05:00
evazion
cf13ab1540 autocomplete: render html server-side.
Render the HTML for autocomplete results server-side instead of in
Javascript. This is cleaner than building HTML in Javascript, but it may
hurt caching because the HTTP responses are larger.

Fixes #4698: user autocomplete contains links to /posts

Also fixes a bug where tag counts in the autocomplete menu were different
from tag counts displayed elsewhere because of differences in rounding.
2022-08-30 01:26:02 -05:00
evazion
3f10eeb954 Fix #5227: Error on note previews due to URL length limit
Allow either GET or POST for /note_previews.
2022-08-24 16:27:05 -05:00
evazion
0d953e2492 related tags: add AI tags to related tags section.
Add a Suggested tags list to the Related Tags box. The suggested tags
are just the AI tags for the post.

Suggested tags are currently hidden in CSS for beta testing. Use custom
CSS to unhide them.
2022-07-02 05:29:59 -05:00
evazion
5795a651f1 ai tags: fix add/remove button size.
Fix it so the Add/Remove button stays the same size and doesn't shift
the layout when transitioning between states.
2022-06-26 01:29:42 -05:00
evazion
e5879f0def ai tags: add buttons for quickly adding and removing tags on the /ai_tags page.
Add "Add" and "Remove" buttons beneath thumbnails on the /ai_tags page.
These let you add the tag to the post if it's correct, or remove it if
it's wrong.
2022-06-26 00:43:57 -05:00
evazion
e7c507b7fc css: adjust spacing around header on mobile. 2022-05-21 14:57:49 -05:00
evazion
d89db73c2f Add site logo to header. 2022-05-21 13:30:21 -05:00
evazion
141044d352 posts: refactor hardcoded ratings.
Refactor ratings to not be hardcoded in various places. Make it so
all ratings are defined in Post::RATINGS.

Also make it so that you can search multiple ratings at once with `rating:q,e`.
2022-05-18 13:04:15 -05:00
NamelessContributor
1fd6abe047 related tags: fix wiki link adding "undefined" tag
Fix #5154
Only add `toggle_tag` listener to links with the `search-tag` class,
add `target="_blank"` to wiki links to prevent accidentally leaving the
edit form.
2022-05-05 12:39:23 +02:00
evazion
031ab1e833 Fix #4752: Category metatags show up as errors in tag edit box.
Fix category prefix metatags not working in autocomplete. Now typing
e.g. `copy:t` will show tags starting with 't' in autocomplete.

Also fix it so that tags beginning with a '(' work in autocomplete.
Typing e.g. `-(tou` will show `touhou` in autocomplete.

This also fixes it so that when you type a negated tag in autocomplete,
e.g. `-touhou`, it sends `touhou` in the autocomplete API call, rather
than `-touhou`. This makes caching more effective since negated tags
will be cached the same as non-negated tags.
2022-04-29 21:47:41 -05:00
evazion
98b313f8de Remove NewRelic integration.
Remove the NewRelic integration in preparation for migrating to Elastic APM instead.
2022-04-11 01:46:30 -05:00
evazion
f27a85e879 Merge pull request #5092 from NamelessContributor/issue-5084
Add auto theme preference (fix #5084)
2022-04-09 03:48:39 -05:00
NamelessContributor
91a9153764 css: prevent acidentally opening spoilered links
A small delay on the pointer-events property prevents accidentally
opening a link inside a spoiler when tapping to reveal the spoiler on
mobile.
2022-04-07 11:43:17 +02:00
evazion
8055c4f172 Fix stale site icons.
Fix artist URLs still showing old cached site icons because the URL
didn't change when the file was updated. Use `image_pack_tag` so that
the filename includes the hash, so that the URL changes when the file
changes.
2022-04-03 22:41:50 -05:00
NamelessContributor
8ea514ad1c css: add auto theme preference. fixes #5084
This is the new default. Users who previously used the light theme will
be migrated to the auto setting.
2022-04-03 18:05:34 +02:00
NamelessContributor
db5918a783 css: rename base/040_colors.css -> scss 2022-04-03 17:39:30 +02:00
evazion
6ad7df0ded news updates: fix updates not being visible. 2022-04-02 18:19:50 -05:00