Commit Graph

3731 Commits

Author SHA1 Message Date
evazion
de289ee5d3 Fix XSS in /artist_versions.
1) Put `<script>alert("xss 1")</script>` in the Other Names field in an
   artist entry.
2) Put `<script>alert("xss 2")</script>` in the URLs field.
3) Trick someone into the viewing the history page for that artist.
2014-10-17 15:22:51 -05:00
Albert Yi
232742e2b6 Merge pull request #2265 from evazion/misc/disable-submit-buttons
Disable comment submit button to prevent double posting.
2014-10-16 16:00:26 -07:00
Toks
1919bbf07e Update mod queue post previews for consistency with rest of site
Fixes display of borders on the previews and such. Also fix the yellow
duplicate background not always working because Post#has_dup_tag? didn't
return a boolean.
2014-10-14 13:14:36 -04:00
Toks
bff823e113 Merge branch 'master' of https://github.com/r888888888/danbooru 2014-10-14 13:09:37 -04:00
Toks
4fcf382ccf Fixminor bug with displaying parent border 2014-10-14 12:48:54 -04:00
Toks
400e09a252 Merge pull request #2267 from evazion/fix/ordpool-excerpt
Show pool excerpt for ordpool:1234 searches.
2014-10-13 20:14:34 -04:00
evazion
ee87fbd56f Show Pool excerpt for ordpool:1234 searches. 2014-10-13 18:15:38 -05:00
Toks
ed6b08e65b Make large wiki/artist/pool title link to tag search 2014-10-13 17:44:40 -04:00
r888888888
af4810bcd0 disable account upgrades for now 2014-10-10 13:52:44 -07:00
r888888888
2d03f45a1b new version 2014-10-07 17:46:53 -07:00
r888888888
ec6b2406b6 remove artist post previews 2014-10-07 17:46:16 -07:00
evazion
b56d7bdfa8 Disable comment submit button to prevent double posting. 2014-10-07 13:52:28 -05:00
Toks
4281d1a48f #2234 comment out post previews 2014-10-05 16:40:13 -04:00
Toks
3f6e03b726 Case-insensitive regex 2014-10-05 16:33:06 -04:00
Toks
2e8230f92a Merge pull request #2263 from evazion/new-pixiv-urls-fixes
Fix artist finder and URL rewriting for new Pixiv URLs
2014-10-05 16:16:04 -04:00
evazion
c75d2d208e normalize_for_artist_finder!: Don't crash on bad URLs
If we can't normalize the URL (because of bad IDs, it's malformed, or
the HTML page changed), just return the unnormalized URL.
2014-10-05 14:11:32 -05:00
evazion
dcbe061809 Move normalize_for_artist_finder! into model.
Move the call to normalize_for_artist_finder! from the artist
controller into Artist#find_all_by_url. This makes testing easier.
It also makes it so that URLs are normalized when using the search
form on the artist listing page.
2014-10-05 14:11:32 -05:00
evazion
7f3b98969f Refactor normalize_for_artist_finder!
Refactors things such that Sources::Site has a normalize_for_artist_finder!
method that delegates to the strategy for the appropriate site. This way
any site that needs to normalize URLs for the artist finder can do so.
2014-10-05 14:11:31 -05:00
evazion
a36472f35b Add artist finding tests for new Pixiv URLs.
* Add tests for finding artists using the new Pixiv URLs in Artist#find_all_by_url.
* Add tests for the artist finder JSON API in ArtistsController#finder.
* Add tests for the artist page search form in ArtistsController#index.
2014-10-05 14:11:31 -05:00
evazion
8e2be03a6b Fix upload tests to use VCR. 2014-10-05 14:11:31 -05:00
Toks
f4529e73e3 Cache seiga and nijie sessions 2014-10-05 12:11:08 -04:00
evazion
f22cb52dde Regenerate VCR cassettes for new tests. 2014-10-04 12:45:37 -05:00
evazion
339e88584d Rewrite tests for downloading new Pixiv URLs.
* Test that downloading the HTML page downloads the full size image
  instead.
* Test that downloading a small or medium size image downloads the
  full size instead.
* Test the above for both single illustrations and for manga galleries,
  for new and old posts (i.e. uploaded before the Pixiv URL changes versus
  after), and for different file extensions.
* Test trying to download ugoira zip files. These tests are expected to
  fail because we don't support ugoira yet.
* Also add some more tests for fetching source data.
2014-10-04 12:45:37 -05:00
evazion
268f79c3d9 Make VCR disallow unexpected HTTP requests.
This makes it so that tests fail when they make HTTP requests they
aren't expected to. Update these tests so that they use VCR like they
should.
2014-10-04 12:45:37 -05:00
evazion
ec0f226f46 Make the artist finder work with new Pixiv URLs. 2014-10-04 12:45:37 -05:00
evazion
58f0ec3dec Use the normalized source in the upload form.
This makes it so you can use the bookmarklet to upload from any of these Pixiv pages:

* http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45792845
* http://www.pixiv.net/member_illust.php?mode=big&illust_id=45792845
* http://www.pixiv.net/member_illust.php?mode=manga&illust_id=45792845
* http://www.pixiv.net/member_illust.php?mode=manga_big&illust_id=45792845&page=0

and the source field in the upload form will be filled in with the
actual image URL (e.g. http://i2.pixiv.net/img18/img/ringo78/45792845_big_p0.jpg),
and it will also be used for the "This post was already uploaded" check.
2014-10-04 12:45:37 -05:00
evazion
964b5efcd3 Rewrite Pixiv small/medium images to full size images.
There are two kinds of thumbnails that need to be rewritten. First case:
new /img-master/ URLs need to be rewritten to /img-original/ URLs like this:

    http://i2.pixiv.net/c/600x600/img-master/img/2014/10/04/03/59/52/46337015_p0_master1200.jpg
    => http://i2.pixiv.net/img-original/img/2014/10/04/03/59/52/46337015_p0.png

This is what `rewrite_new_medium_images` does. In order to do this, it
has to use the Pixiv API to get the correct file extension.

Second case: Old small/medium size URLs need to be rewritten to full
size URLs like this:

    http://i2.pixiv.net/img18/img/evazion/14901720_m.png
    => http://i2.pixiv.net/img18/img/evazion/14901720.png

But when the medium size URL is actually for a manga image, it needs to be
rewritten to the big manga URL instead:

    http://i2.pixiv.net/img04/img/syounen_no_uta/46170939_m.jpg
    => http://i2.pixiv.net/img04/img/syounen_no_uta/46170939_big_p0.jpg

But we can't tell whether it's a manga image from the URL, so we have to
use the manga page count from either the HTML page or the API to
determine whether it's part of a manga gallery.

So in order to make this work, `rewrite_old_small_and_medium_images`
takes an `is_manga` flag. `Sources::Strategies::Pixiv#get` gets the
page count from the HTML and passes the `is_manga` flag on down through
the call chain until `rewrite_old_small_and_medium_images` gets it.

When `rewrite_old_small_and_medium_images` is called from
`Downloads::Strategies::Pixiv#rewrite_thumbnails`, the `is_manga` flag
isn't passed in because we didn't scrape the HTML. This causes
`rewrite_old_small_and_medium_images` to look it up in the API instead.
2014-10-04 12:45:37 -05:00
evazion
daf196bd0e Rewrite old Pixiv small manga images correctly.
This prevents incorrectly rewriting these new Pixiv URLs:

* http://i1.pixiv.net/c/600x600/img-master/img/2014/09/24/23/25/08/46168376_p0_master1200.jpg
* http://i1.pixiv.net/img-original/img/2014/09/25/23/09/29/46183440_p0.jpg
2014-10-04 12:45:37 -05:00
evazion
36a78361d7 Normalize URLs to the mode=medium page correctly.
This handles a few new cases that weren't handled correctly previously.

* http://i1.pixiv.net/img-zip-ugoira/img/2014/10/03/17/29/16/46323924_ugoira1920x1080.zip
* http://i1.pixiv.net/c/600x600/img-master/img/2014/10/02/13/51/23/46304396_p0_master1200.jpg
* http://www.pixiv.net/member_illust.php?mode=manga&illust_id=18557054
* http://www.pixiv.net/member_illust.php?mode=manga_big&illust_id=18557054&page=1
* http://www.pixiv.net/i/18557054
2014-10-04 12:45:36 -05:00
evazion
f889dbf10f Add get_metadata_from_spapi! 2014-10-04 12:45:36 -05:00
evazion
7f98b370ec Fix scraping the Pixiv artist username.
The artist's username is no longer contained in the image thumbnail URL on the
HTML page. Get it from the Feed link instead.
2014-10-04 12:45:36 -05:00
evazion
74c116ffb7 Fix for scraping the manga page count.
The string for the page count has changed. It now looks like "複数枚投稿 3P"
on all Pixiv posts I've checked.
2014-10-04 12:45:36 -05:00
Toks
4b9605075b Rewrite tumblr cdn urls 2014-10-03 14:36:37 -04:00
Toks
685d65ffdb Merge branch 'master' of https://github.com/r888888888/danbooru 2014-10-03 14:35:53 -04:00
Toks
d499bb4d04 Remove tumblr 1280w -> 500h source rewriting
It was thought that 500h was always the biggest size when it exists, but
it seems it can actually be either bigger or smaller than 1280w.
2014-10-03 14:21:53 -04:00
Albert Yi
2aa8a1cd4b Merge pull request #2259 from evazion/bump-rmagick
Bump rmagick to 2.13.3.
2014-10-01 16:49:38 -07:00
r888888888
53476eaabf new version 2014-09-30 17:25:22 -07:00
r888888888
74e1355728 fix tests 2014-09-30 17:24:54 -07:00
Toks
6dce66f33d Cache pixiv session 2014-09-29 01:38:53 -04:00
Toks
6e80d77a89 #2261 source redirection and pixiv_id for thumbnails 2014-09-24 23:09:54 -04:00
Toks
fd290076fe fixes #2241 2014-09-24 13:28:56 -04:00
Toks
6b9e0fca12 #2245 add search form 2014-09-24 13:14:03 -04:00
Toks
4db0c3c0e5 fixes #2249 2014-09-24 13:11:54 -04:00
Toks
ae49c7c016 #2261: fix source redirection, fix pixiv_id parsing 2014-09-24 12:25:14 -04:00
Toks
4b4e3dc87b #2245 Display more of title
originally from commit 719343cea5
2014-09-20 15:28:03 -04:00
Toks
6d523153fa Change automatic tags to be added before aliases/implications
This allows aliases and implications to work on tags added automatically
2014-09-20 15:10:49 -04:00
Toks
fac385ffcb fix #2237 for webm and flash 2014-09-20 14:52:49 -04:00
Toks
87d3cc31b3 fixes #2257 2014-09-20 14:50:52 -04:00
Toks
cbdc78d606 #2245 make gallery obey user's per page setting 2014-09-07 00:03:23 -04:00
Toks
4f0a83f996 #2245 allow anonymous to view gallery 2014-09-06 23:58:00 -04:00