Commit Graph

698 Commits

Author SHA1 Message Date
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
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
evazion
10e3416c95 related tags: better tag name selector.
Cherry-picked April Fool's day fix.
2022-04-02 18:19:46 -05:00
evazion
8705b8ec89 Merge pull request #5053 from NamelessContributor/fix-5052
posts: fix sidebar min-width on small screens (fix #5052)
2022-03-22 03:42:41 -05:00
NamelessContributor
3b05abc012 posts: fix sidebar min-width on small screens
fix #5052
2022-03-20 03:09:07 +01:00
NamelessContributor
c3a5ce9019 simple_form: Don't hide hints on mobile. Fix #4997
Hints are displayed below their fields on small screens.
2022-03-15 14:39:37 +01:00
NamelessContributor
3b63174525 post_mode_menu: update preview link selector
Fixes the post-score link triggering the mode menu action as well as
all three score links getting the blue border on hover.
2022-03-09 10:01:09 +01:00
evazion
dcbc9b3140 js: fix Alpine Warning: Unable to initialize.
Fix this Javascript warniing:

    Alpine Warning: Unable to initialize. Trying to load Alpine before
    `<body>` is available. Did you forget to add `defer` in Alpine's
    `<script>` tag?
2022-03-09 01:35:02 -06:00
evazion
ca98e218a1 users: don't bold usernames in comments and forum posts.
Make usernames in comments and forum posts take up less space.
2022-03-01 21:23:21 -06:00
evazion
2d4106154b Merge pull request #5025 from NamelessContributor/patch-1
Limit the width of usernames in tables
2022-03-01 20:45:07 -06:00
evazion
68c92b4536 js: fix Javascript failures in Seamonkey/Palemoon.
Fix site Javascript failing to load in Seamonkey, Palemoon, and other
older browsers.

The @alpinejs/morph library uses public instance fields, which is ES2022
syntax not supported in older browsers. This is the code:

    var DomManager = class {
        el = void 0; // `el` is a public instance field
    }
    // => SyntaxError: bad method definition

The fix here is to separate the Alpine code into a separate bundle so
that a failure to load it doesn't cause the rest of the site's
Javascript to fail to load.

A better fix would be to either transpile the @alpinejs/morph library to
ES5 (which seems difficult to do in webpacker), or to fix the library
upstream to not use this syntax.

* https://inspiredwebdev.com/everything-new-in-es2022/
* https://blog.saeloun.com/2021/10/21/ecmacscript-public-instance-fields-and-private-instance-fields.html
* https://caniuse.com/?search=public%20class%20fields
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Public_class_fields#public_instance_fields
2022-03-01 19:40:15 -06:00
NamelessContributor
a43291018a Limit the width of usernames in tables
Fixes the layout issues caused very long usernames in the forum and elsewhere.
2022-03-01 14:59:58 +01:00
evazion
8ef05ec69b Fix #5021: Downvoting/upvoting a revealed hidden comment will hide it again.
Fix it so that upvoting or downvoting a revealed thresholded comment
doesn't hide it again.

The fix is to explicitly store a `data-show-thresholded` flag on the
comment, instead of manually hiding elements with jQuery, and to morph
the comment HTML instead of replacing it so that the state isn't lost
after voting. Alpine.js is used for this, which isn't strictly necessary,
but is useful to test the library before adopting it on a wider scale.

https://alpinejs.dev/start-here
2022-02-28 20:11:22 -06:00
evazion
68ba447494 uploads: remove batch upload page.
* Make /uploads/batch redirect to /uploads/new.
* Remove /uploads/image_proxy.
2022-02-21 00:03:43 -06:00
evazion
3da9c1574f Merge pull request #5010 from nonamethanks/add-mod-report-link
Moderation Reports: add link for moderators to navbar
2022-02-20 22:45:30 -06:00
evazion
202dfe5d87 uploads: allow uploading multiple files from your computer at once.
Allow uploading multiple files from your computer at once.

The maximum limit is 100 files at once. There is still a 50MB size limit
that applies to the whole upload. This limit is at the Nginx level.

The upload widget no longer shows a thumbnail preview of the uploaded
file. This is because there isn't room for it in a multi-file upload,
and because the next page will show a preview anyway after the files are
uploaded.

Direct file uploads are processed synchronously, so they may be slow.

API change: the `POST /uploads` endpoint now expects the param to be
`upload[files][]`, not `upload[file]`.
2022-02-19 00:00:56 -06:00
evazion
e37dd3a6d0 uploads: change loading indicator for thumbnails.
Use a spinner icon instead of the word "Loading" for thumbnails that are
being processed in the background in a batch upload.

Also use morphdom to update thumbnails so we only update the parts of
the DOM that actually changed.
2022-02-18 16:03:43 -06:00
evazion
77515915a4 uploads: change loading indicator for upload widget.
Change the loading indicator from a progress bar to a spinner. Fixes
issue with the <progress> element having a different appearance on
different browsers.
2022-02-18 03:39:08 -06:00
evazion
093a808a36 Fix #4986: Add ability to filter images in /media_assets and /uploads depending on if they have become posts 2022-02-18 03:39:08 -06:00
evazion
f54fac74c8 Add image icon next to thumbnail size dropdown menu. 2022-02-17 20:31:59 -06:00
evazion
0b8d042c06 uploads: allow changing thumbnail size on My Uploads / All Uploads pages.
* Add a "Size" menu to the My Uploads / All Uploads pages to allow
  changing the thumbnail size.
* Make the My Uploads / All Uploads pages use the same thumbnail size as
  the post index page.
* Change the "Gallery | Table" links on the My Uploads page to icons.
2022-02-16 16:39:28 -06:00