Commit Graph

121 Commits

Author SHA1 Message Date
evazion
a7755a7469 Update Ruby gems and Yarn packages. 2022-07-01 16:43:16 -05:00
evazion
b02dbf1a43 Fix broken Docker build.
terser-webpack-plugin 5.3.2 was a bad release, which broke the Docker build.
2022-06-01 21:26:20 -05:00
evazion
2e249103e1 Update Ruby gems and Yarn packages. 2022-06-01 20:20:12 -05:00
evazion
c73ff4fbd9 Update Ruby gems and Yarn packages. 2022-05-11 00:23:53 -05:00
evazion
47b4e6df2f Update Ruby gems and Yarn packages. 2022-04-25 18:43:17 -05:00
evazion
474ea5a6f0 Update Ruby gems and Yarn packages. 2022-04-13 01:39:38 -05:00
evazion
f2cdc5fd73 Update Ruby gems and Yarn packages. 2022-03-31 03:26:47 -05:00
evazion
1028bb1c71 Update Ruby gems and Yarn packages. 2022-03-07 04:03:01 -06: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
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
d7649dbd70 Update Ruby gems and Yarn packages.
Upgrade Rails to 7.0.2.2 and Puma to 5.6.2 to fix this CVE:

* https://rubyonrails.org/2022/2/11/Rails-7-0-2-2-6-1-4-6-6-0-4-6-and-5-2-6-2-have-been-released
* https://github.com/rails/rails/security/advisories/GHSA-wh98-p28r-vrc9
* https://discuss.rubyonrails.org/t/cve-2022-23633-possible-exposure-of-information-vulnerability-in-action-pack/80016

This fixes a bug in Puma <5.6.2 that caused ActiveSupport::CurrentAttributes
to not be reset between requests in certain cases, which could allow
state to be leaked between requests.
2022-02-11 17:30:40 -06:00
evazion
1032a60d4b Update Ruby gems and Yarn packages. 2022-02-05 22:29:50 -06:00
evazion
bb65a95a86 Fix #4981: ruffle broken :(
* Switch to the official Ruffle NPM package.
* Fix `core.ruffle.$hash.js` not being imported.
2022-01-31 14:39:30 -06:00
evazion
abdab7a0a8 uploads: rework upload process.
Rework the upload process so that files are saved to Danbooru first
before the user starts tagging the upload.

The main user-visible change is that you have to select the file first
before you can start tagging it. Saving the file first lets us fix a
number of problems:

* We can check for dupes before the user tags the upload.
* We can perform dupe checks and show preview images for users not using the bookmarklet.
* We can show preview images without having to proxy images through Danbooru.
* We can show previews of videos and ugoira files.
* We can reliably show the filesize and resolution of the image.
* We can let the user save files to upload later.
* We can get rid of a lot of spaghetti code related to preprocessing
  uploads. This was the cause of most weird "md5 confirmation doesn't
  match md5" errors.

(Not all of these are implemented yet.)

Internally, uploading is now a two-step process: first we create an upload
object, then we create a post from the upload. This is how it works:

* The user goes to /uploads/new and chooses a file or pastes an URL into
  the file upload component.
* The file upload component calls `POST /uploads` to create an upload.
* `POST /uploads` immediately returns a new upload object in the `pending` state.
* Danbooru starts processing the upload in a background job (downloading,
  resizing, and transferring the image to the image servers).
* The file upload component polls `/uploads/$id.json`, checking the
  upload `status` until it returns `completed` or `error`.
* When the upload status is `completed`, the user is redirected to /uploads/$id.
* On the /uploads/$id page, the user can tag the upload and submit it.
* The upload form calls `POST /posts` to create a new post from the upload.
* The user is redirected to the new post.

This is the data model:

* An upload represents a set of files uploaded to Danbooru by a user.
  Uploaded files don't have to belong to a post. An upload has an
  uploader, a status (pending, processing, completed, or error), a
  source (unless uploading from a file), and a list of media assets
  (image or video files).

* There is a has-and-belongs-to-many relationship between uploads and
  media assets. An upload can have many media assets, and a media asset
  can belong to multiple uploads. Uploads are joined to media assets
  through a upload_media_assets table.

  An upload could potentially have multiple media assets if it's a Pixiv
  or Twitter gallery. This is not yet implemented (at the moment all
  uploads have one media asset).

  A media asset can belong to multiple uploads if multiple people try
  to upload the same file, or if the same user tries to upload the same
  file more than once.

New features:

* On the upload page, you can press Ctrl+V to paste an URL and immediately upload it.
* You can save files for upload later. Your saved files are at /uploads.

Fixes:

* Improved error messages when uploading invalid files, bad URLs, and
  when forgetting the rating.
2022-01-28 04:13:22 -06:00
evazion
54dbf1a436 Update Ruby gems and Yarn packages. 2022-01-17 10:49:04 -06:00
evazion
fd2db2ff23 Update Ruby gems and Yarn packages. 2022-01-10 11:32:59 -06:00
evazion
bb60a59001 css: remove postcss-flexbugs-fixes plugin.
Remove a PostCSS plugin used to workaround bugs in the `flex` CSS
property. Most of these bugs are no longer relevant and only affected
ancient browsers like IE 10 or 11.

https://github.com/philipwalton/flexbugs
2022-01-08 11:54:45 -06:00
evazion
0e778f0972 Update Ruby gems and Yarn packages. 2021-12-28 09:47:34 -06:00
evazion
4e730a145d Update Ruby gems and Yarn packages. 2021-12-14 21:33:27 -06:00
evazion
45dbc7582c Update Ruby gems and Yarn packages. 2021-12-08 03:01:54 -06:00
evazion
a58aa8efa7 Update Ruby gems and Yarn packages. 2021-10-21 03:27:59 -05:00
evazion
206a4b5de5 docker: avoid rebuilding CSS/JS assets on every commit.
Restructure the Dockerfile and the CSS/JS files so that we only rebuild
the CSS and JS when they change, not on every commit.

Before it took several minutes to rebuild the Docker image after every
commit, even when the JS/CSS files didn't change. This also made pulling
images slower.

This requires refactoring the CSS and JS to not use embedded Ruby (ERB)
templates, since this made the CSS and JS dependent on the Ruby
codebase, which is why we had to rebuild the assets after every Ruby
change.
2021-10-13 02:48:30 -05:00
evazion
4b15e56909 Update Ruby gems and Yarn packages. 2021-10-12 03:00:24 -05:00
evazion
33f3a12dd1 Update Ruby gems and Yarn packages. 2021-09-30 08:24:51 -05:00
evazion
9552b41c0a Update Ruby gems and Yarn packages. 2021-09-14 05:39:18 -05:00
evazion
38edbb0512 Update Yarn packages. 2021-08-28 04:53:33 -05:00
evazion
c8d7f94d7e Update Ruffle version. 2021-08-21 04:01:24 -05:00
Seedgou
35c9eff5bc fix ruffle-mirror version 2021-08-15 02:16:57 -05:00
evazion
7fab2231c0 Update Ruby gems and Yarn packages. 2021-06-23 06:23:29 -05:00
evazion
3c79888610 Update Ruby gems and Yarn packages. 2021-06-17 04:56:42 -05:00
evazion
aab19a8cbb Update Ruby gems and Yarn packages. 2021-05-25 15:09:53 -05:00
evazion
ca8bfb9149 Update Ruby gems and Yarn packages. 2021-05-15 02:48:13 -05:00
evazion
9b0fcec7d0 Update Ruby gems and Yarn packages. 2021-04-06 15:51:01 -05:00
evazion
d58a0bf1e4 Fix #4781: Danbooru Javascript object is broken.
Downgrade Webpack from 5.28.0 to 5.26.3. Breakage was introduced at
5.27.0. It's unclear if this is a regression of issue 12742 in Webpack
or if we're doing something else wrong.

hxxps://github.com-webpack-webpack-issues-12742
hxxps://github.com-webpack-webpack-issues-12851
2021-04-01 03:10:44 -05:00
evazion
55980c6fbf Add Ruffle support for Flash files.
Allow viewing Flash posts with the Ruffle emulator.

Known issues:

* Many flash files aren't fully supported.
* In development it sometimes spazzes out and starts triggering random
  keyboard shortcuts when you press any key. This doesn't happen with
  the browser extension.
* We have to put the .wasm file in the public/packs/js directory because
  Ruffle is hardcoded to search for it there.
* If you're running Nginx, you need to make sure you're serving the
  right MIME type for .wasm files or it won't work.
* We're using Some Random Guy's unofficial NPM package for Ruffle, since the
  Ruffle project doesn't publish an official package themselves. We
  should build our own package.

References:

* https://github.com/ruffle-rs/ruffle
* https://github.com/ruffle-rs/ruffle/wiki/Using-Ruffle#configure-webassembly-mime-type
* https://www.npmjs.com/package/ruffle-mirror
2021-03-31 20:20:22 -05:00
evazion
07720b04a5 Update Ruby gems and Yarn packages. 2021-03-29 03:01:02 -05:00
evazion
1fd23c344a Update ruby gems and yarn packages. 2021-03-18 21:35:17 -05:00
evazion
250e7657b5 Update Ruby gems and Yarn packages. 2021-03-07 18:34:40 -06:00
evazion
3be72bdb3b Upgrade to Yarn 2. 2021-03-01 00:39:47 -06:00
evazion
340eeec023 Update Ruby gems and Yarn packages. 2021-02-28 17:48:30 -06:00
evazion
b2a423af64 Fix #4731: Tag counter in edit boxes should only count unique tags, not repeated.
Just use the `uniq` function from lodash. Adds ~1kb to the build.

Also rename `Utility.regexp_split` to `Utility.splitWords`.
2021-02-23 19:00:58 -06:00
evazion
bcca0ca53a Update Ruby gems and Yarn packages. 2021-02-18 19:11:21 -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
12c61860e1 Update ruby gems and yarn packages. 2021-02-07 23:28:50 -06:00
evazion
3f6e7ff6b5 Fix #4701: Odd behavior on older versions of Chrome.
Regression caused by the upgrade to Webpacker 6.0 in 90cd3293e. This
caused various Javascript errors in old versions of Chrome, which
somehow resulted in the keyboard shortcut for visiting the next page
being triggered when you pressed any key.

Specifically, the mobx library (used by the TagCounter component) called
`Object.entries`, which isn't available in Chrome 49, and for some
unknown reason this triggered the buggy shortcut behavior.

`Object.entries` is supposed to be automatically polyfilled by Babel to
support old browsers, but something changed in Webpacker 6 that broke
this and I couldn't get it working again. The probable cause is that
Webpacker 6 no longer transpiles code inside ./node_modules by default,
which means that any libraries we use that use new Javascript features
won't get transpiled down to support old browsers, but even after fixing
that it still didn't work. The workaround is to just drop mobx and
preact entirely to avoid the issue.
2021-02-07 05:53:32 -06:00
evazion
e90f792e20 Update ruby gems and yarn packages. 2021-02-03 21:12:33 -06:00
evazion
90cd3293eb Upgrade to Webpacker 6.0. 2021-01-28 00:22:49 -06:00
evazion
2eeee446a5 js: upgrade to MobX 6.0. 2021-01-27 17:46:17 -06:00
evazion
3137284292 Update ruby gems and yarn packages. 2021-01-27 00:02:35 -06:00