Commit Graph

9461 Commits

Author SHA1 Message Date
evazion
8b5b320be7 docker: fix file permission problems.
Store the app in /home/danbooru/app instead of in /app so that we have
permission to write inside the app dir. /app was owned by root, which
prevented the danbooru user from writing to it.
2020-06-09 17:50:47 -05:00
evazion
15799f8af7 Fix #4260: Unable to replace cdn.donmai.us images?
Bug: Replacing posts hosted on cdn.donmai.us didn't work.

Cause: Original files on cdn.donmai.us are hosted under /var/www/danbooru/original/, but replacements
were trying to store them directly under /var/www/danbooru, which failed with a permission error.
We were trying to store them in the wrong directory because we didn't respect the `original_subdir`
option when generating file paths.
2020-06-09 15:57:43 -05:00
evazion
20abd8a5fd Fix build failure in nokogumbo.
Nokogumbo-2.0.2 fails to build when Nokogiri-1.11.0 is installed.
Nokogiri introduced some changes that are apparently incompatible with
Nokogumbo.

ref: https://nokogiri.org/CHANGELOG.html#versioninfo-and-the-output-of-nokogiri-v
2020-06-09 13:20:46 -05:00
evazion
8b5ffb4c43 uploads: allow admins to upload videos more than 2 minutes long.
At some point the ability for admins to bypass the video length
restriction got lost.

ref: https://danbooru.donmai.us/forum_topics/14647
2020-06-09 03:08:06 -05:00
evazion
d002701bc1 Merge pull request #4494 from nonamethanks/fix_deviantart_api_downloads
Deviantart: fix api downloads
2020-06-09 01:37:03 -05:00
evazion
1ea0141ae1 Merge pull request #4499 from BrokenEagle/fix-4408
Fix notes having absolute coordinates upon creation
2020-06-09 01:36:44 -05:00
evazion
38f385d1ca js, css: fix eslint and stylelint warnings. 2020-06-09 01:35:44 -05:00
evazion
b1f22df4ab Upgrade ruby version to 2.7.1. 2020-06-09 01:35:40 -05:00
evazion
470c3edd94 Upgrade ruby gems and yarn packages. 2020-06-09 01:21:56 -05:00
evazion
3a8d894154 Merge pull request #4498 from danbooru/dependabot/bundler/websocket-extensions-0.1.5
build(deps): bump websocket-extensions from 0.1.4 to 0.1.5
2020-06-09 01:11:41 -05:00
evazion
f1581789ac Merge pull request #4500 from danbooru/dependabot/npm_and_yarn/websocket-extensions-0.1.4
build(deps): bump websocket-extensions from 0.1.3 to 0.1.4
2020-06-09 01:10:49 -05:00
evazion
3033bb4530 Update danbooru Dockerfile.
Split into build stage and runtime stage to reduce image size.
2020-06-09 01:07:42 -05:00
evazion
eacb4d4df3 models: factor out api_attributes to policies.
Refactor models so that we define attribute API permissions in policy
files instead of directly in models.

This is cleaner because a) permissions are better handled by policies
and b) which attributes are visible to the API is an API-level concern
that models shouldn't have to care about.

This fixes an issue with not being able to precompile CSS/JS assets
unless the database was up and running. This was a problem when building
Docker images because we don't have a database at build time. We needed
the database because `api_attributes` was a class-level macro in some
places, which meant it ran at boot time, but this triggered a database
call because api_attributes used database introspection to get the list
of allowed API attributes.
2020-06-08 18:38:02 -05:00
evazion
b6ed63841d footer: fix exception if git hash isn't defined.
The git hash may be undefined when running in a Docker container.
2020-06-08 18:12:32 -05:00
evazion
6d78d22571 Update docker test configuration. 2020-06-07 17:14:41 -05:00
dependabot[bot]
1f16ec67ba build(deps): bump websocket-extensions from 0.1.3 to 0.1.4
Bumps [websocket-extensions](https://github.com/faye/websocket-extensions-node) from 0.1.3 to 0.1.4.
- [Release notes](https://github.com/faye/websocket-extensions-node/releases)
- [Changelog](https://github.com/faye/websocket-extensions-node/blob/master/CHANGELOG.md)
- [Commits](https://github.com/faye/websocket-extensions-node/compare/0.1.3...0.1.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-06 22:52:37 +00:00
BrokenEagle
6f7530533a Fix notes having absolute coordinates upon creation
Notes are not given percent coordinates when created, however moving
or resizing would update the coordinates to percentage. This is why
it was appearing as if the type of coordinates given were random.
2020-06-05 21:53:00 +00:00
evazion
aa9d34a3f0 config: make danbooru_local_config.rb optional.
Make it so that if danbooru_local_config.rb doesn't exist, we continue
with the default config instead of failing.
2020-06-05 15:49:51 -05:00
dependabot[bot]
6e265ffa60 build(deps): bump websocket-extensions from 0.1.4 to 0.1.5
Bumps [websocket-extensions](https://github.com/faye/websocket-extensions-ruby) from 0.1.4 to 0.1.5.
- [Release notes](https://github.com/faye/websocket-extensions-ruby/releases)
- [Changelog](https://github.com/faye/websocket-extensions-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/faye/websocket-extensions-ruby/compare/0.1.4...0.1.5)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-05 15:57:14 +00:00
evazion
82c09858f2 Remove unused data attributes from <body> tag.
Fixup for 647556761.
2020-06-03 11:51:21 -05:00
evazion
647556761b Fix antiproxying (again).
Fuck it, just hardcode it. They rewrite certain parts of our markup so
we can't rely on anything in the html.
2020-06-02 23:30:15 -05:00
evazion
bfa76abb56 layouts/default: move <script> tag from header to footer.
* Inline Javascript in the <head> is a minor bottleneck because it
  blocks page rendering.
* Fix antiproxying protection (proxy sites like to strip <script> tags
  from the header).
2020-06-02 22:09:44 -05:00
evazion
91640447c0 Fix antiproxying config options.
Don't embed config options directly in Javascript. Including them in the
Javascript forces us to recompile the Javascript whenever these options
change, which requires us to redeploy the entire site instead of just
restarting the app server.
2020-06-02 20:50:39 -05:00
evazion
18ce552dae tests: fix upload controller tests.
We can't use the name `test_file_upload` because then the helper method
gets treated like it's a test case.
2020-06-02 18:25:45 -05:00
evazion
276f23ba8d config: refactor remove_tag_after_replacement? config option. 2020-06-02 18:25:45 -05:00
evazion
47e6821a31 config: remove customize_new_user config option. 2020-06-02 18:25:45 -05:00
evazion
484eacfd3b config: remove is_unlimited_metatag? config option. 2020-06-02 18:25:42 -05:00
evazion
9997db44d8 config: remove banned_ip_for_download? option.
* Remove `banned_ip_for_download?` config option. This isn't something that usually needs
  to be configured.
* Replace the `ipaddress` gem with `ipaddress_2`. The `ipaddress` gem has several methods
  we need (`link_local?`, etc) that are only available in master because the gem hasn't had
  an official release in several years. `ipaddress_2` is a fork that is more actively
  maintained.
2020-06-02 15:32:19 -05:00
evazion
63f675b7d6 config: remove enable_post_search_counts option.
Enable by default if reportbooru is configured, otherwise disable.
2020-06-02 14:41:06 -05:00
evazion
ed41fd77e5 config: remove unused config options. 2020-06-02 14:33:44 -05:00
evazion
a8389c74d8 uploads: fix dropzone previews being stretched. 2020-06-02 03:04:36 -05:00
evazion
565e02c7ab Revert "search: temporarily raise tag limit to 12 for Danbirthday celebration."
This reverts commit af50e10c3a.
2020-06-01 23:32:25 -05:00
evazion
8b46d00b9b Add antiproxying protection.
Try to prevent malicious sites like danbooru.me or idanbooru.com from
proxying our site and inserting ads. If we detect that we're not running
on the real site, then we redirect to the real site.
2020-06-01 13:41:15 -05:00
evazion
6b490cacba Update ruby gems and yarn packages. 2020-06-01 13:03:28 -05:00
nonamethanks
25b801619f Deviantart: fix api downloads 2020-05-31 07:01:43 +02:00
evazion
2113b89f9b artists: don't show "Status Active" for undeleted artists.
An "active" artist entry is one that isn't deleted. Saying that every
undeleted artist is "active" confuses people.
2020-05-29 19:01:42 -05:00
evazion
855e31ac90 nijie: fetch commentary as html instead of plaintext.
Fix regression in #4475. Fetch the commentary as html instead of
plaintext so that we don't lose links or other formatting.

Also fix it so that /jump.php redirect links are replaced with the
actual url.
2020-05-29 15:36:21 -05:00
evazion
206ac7dd9a dtext#from_html: convert basic links to <url> syntax.
Convert

    <a href="https://www.example.com">https://www.example.com</a>

to

    <https://www.example.com>

instead of

    "https://www.example.com":[https://www.example.com]
2020-05-29 15:36:21 -05:00
evazion
9ca848d732 tests: fix more ruby 2.7 deprecation warnings. 2020-05-29 15:36:21 -05:00
evazion
29740f0bee tests: fix hentai foundry artist url test. 2020-05-29 15:36:21 -05:00
evazion
88d9fc4e5e sources: simplify artist finder url normalization.
Get rid of `normalized_for_artist_finder?` and `normalizable_for_artist_finder?`.
This was legacy bullshit that was originally designed to avoid API calls
when saving artist entries containing old Pixiv direct image urls that
had already been normalized, or that couldn't be normalized because they
were bad id.

Nowadays we store profile urls in artist entries instead of direct image
urls, so we don't normally need to do any API calls to normalize the
profile url. Strategies should take care to avoid triggering API calls
inside `profile_url` when possible.
2020-05-29 15:35:15 -05:00
evazion
9ba6d60ad3 Merge pull request #4489 from nonamethanks/add_weibo_normalization
Weibo: add source normalization
2020-05-29 11:29:40 -05:00
evazion
fb19bf06ce Merge pull request #4490 from BrokenEagle/fix-embedded-notes
Fix embedded notes not being re-editable after note creation
2020-05-29 11:29:12 -05:00
evazion
7a819b0060 artists: hide banned artist pages from anonymous users.
Hide banned artist pages from anonymous (logged out) users. Partial
revert of 6b066f2ca. Artists sometimes ask us to remove all their
information from the site, including their artist profile. It's easier
to hide their profile than to explain to Japanese artists that a) we're
under no obligation to remove their profile and b) we need to keep it to
maintain the ban on their content that they asked for.
2020-05-29 11:27:59 -05:00
BrokenEagle
a6c64bb69a Fix embedded notes not being re-editable after note creation
The issue is that the body of the embedded notes were being set to
the value which tells the script not to read the original body after
saving a note. This was a poor system prone to issues, so instead a
DOM class is now explicitly added to the notes on note creation and
cleared whenever a note gets saved.

Additionally, the embedded note bodies were standardized to use the
same initial value as non-embedded notes as well.
2020-05-27 23:59:19 +00:00
nonamethanks
d339947647 Weibo: add source normalization 2020-05-28 01:05:11 +02:00
evazion
feeea6602c Merge pull request #4488 from nonamethanks/add_weibo_support
Add Weibo support
2020-05-27 16:53:14 -05:00
evazion
2c60a51f64 Merge pull request #4475 from nonamethanks/refactor_source_normalizing
Refactor source normalization
2020-05-27 16:52:17 -05:00
evazion
71f4e5b82a artstation: add tests for #4480. 2020-05-27 15:49:04 -05:00
evazion
241894428a Merge pull request #4480 from BrokenEagle/fix-artstation
Fixes issues with Artstation source strategy
2020-05-27 15:37:23 -05:00