Commit Graph

326 Commits

Author SHA1 Message Date
rr- 8d8165a0d7 server/tags: fix order of aliases in export
fixes #112
2017-01-08 22:29:05 +01:00
rr- 036fa9ee39 server/uploads: add file upload api 2017-01-08 10:25:29 +01:00
rr- 4cb613a5c9 server/posts: change reverse image search API
Add exact duplicates search; refactor to use classes over dictionaries
2017-01-07 14:07:31 +01:00
rr- 9edaaffec2 server/posts: fix post relations
Trying to relate post to itself resulted in 500 ISE.
2017-01-03 21:37:38 +01:00
rr- 627574a9c2 server: make pylint happier 2017-01-03 21:35:08 +01:00
rr- 902a0d3fe0 server/db: fix closing DB sessions
Certain exception scenarios led to small disasters. Moved database
session management directly to router, since it's that sensitive.
2017-01-03 21:29:48 +01:00
rr- ef079121a9 server/rest: simplify error handling flow 2017-01-03 21:17:41 +01:00
rr- f301ca9a8a server/image-hash: fix handling invalid input 2016-12-26 19:03:04 +01:00
rr- a7a5cc8180 server/posts: expose reverse image search 2016-12-26 15:00:16 +01:00
rr- 1a59a74d63 server/image-hash: add image search engine 2016-12-26 15:00:16 +01:00
rr- 42666706d9 server/util: fix API queries for empty ?options 2016-11-20 16:02:45 +01:00
rr- c0d484689b server: postpone circular dependency evaluation
Hopefully this improves importing with python 3.4
2016-11-07 19:28:54 +01:00
rr- 141c9fcdc9 server/tags: merge also tag relations 2016-10-22 18:02:50 +02:00
rr- 995cd4610d server: drop old style class declarations 2016-10-22 14:43:52 +02:00
rr- e71718c50d server/posts: add replaceContent to post merging 2016-10-21 22:34:45 +02:00
rr- 9d6a0e0173 server/posts: add post merging 2016-10-21 21:48:38 +02:00
rr- b853caf6f5 server/posts: fix relation updating
Fixes #103
2016-10-02 17:21:15 +02:00
rr- b0c5031001 client+server/posts: reverse next/prev post role
In the post list, when we navigate to the page with ">" button, we
navigate to older posts.
In the post view, when we navigate to the page with ">" button, we
navigate to older posts as well.

However, in the post list, the ">" button is called "next page".
At the same time, in the post view, the ">" button was called "previous
post". Now it's called "next post".

The difference isn't visible to normal users nor even API consumers as
the "get posts around post X" request isn't documented.

The change is motivated not only by consistency, but to also improve
compatibility with Vimperator's `[[` and `]]`. Vimperator assumes the
word "next" refers to ">" and the word "previous" refers to "<".
2016-10-02 17:07:08 +02:00
rr- 049a0dc351 server/mime: fix GIF animation heuristics
Closes #100
2016-09-29 12:59:40 +02:00
rr- e8c93cd735 server: fix constructing of HTTP errors
When I added error codes, I missed these exceptions.
2016-09-26 22:51:07 +02:00
rr- 0c61e85340 server: fix lint 2016-09-26 22:51:00 +02:00
rr- 560a7d6839 server/search: prefer arrays over ranges
(No, it doesn't work recursively.)
Also fix tests.
2016-09-26 22:48:09 +02:00
rr- 1e65622daf server/search: don't be a hardass about strings
Let range criteria (values that contain ..) that end up being used as
strings, to be used as if they were simple criteria. So let the user
search for "when_you_see_it..." and don't throw a warning.
2016-09-26 22:48:09 +02:00
rr- 1bd8af47b0 server/search: match only [a-z-]* for named tokens
Adds ability to search for *:* for example. Still not perfect, but it's
a start.
2016-09-26 22:06:18 +02:00
rr- 0e31e1fd14 server/search: fix underscores and percentages
Escape them for LIKE statements.
2016-09-26 21:58:27 +02:00
rr- 71a4ce8764 server/func: handle download errors 2016-09-25 14:52:47 +02:00
rr- d1cad99e87 server/middleware: fix reporting auth errors 2016-09-24 08:38:15 +02:00
rr- 42b7a9b94f server/errors: fix serializing errors 2016-09-10 15:28:32 +02:00
rr- 16d04adde0 server/errors: add and document error codes 2016-09-10 11:36:01 +02:00
rr- 8674c8b50e server/posts: report duplicate post ID and URL 2016-09-10 10:16:14 +02:00
rr- 0a19e7bbd0 server/errors: allow extra info in errors 2016-09-10 10:16:14 +02:00
rr- c516030c66 server/tests: fix info api tests 2016-09-10 10:12:43 +02:00
rr- 7fa8593b0a client/general: improve URL escaping
Specifically, cater for /, + and % in URL components.
2016-09-04 02:07:22 +02:00
rr- a22fe306d1 server/posts: fix deleting posts with relations 2016-08-31 22:49:45 +02:00
rr- eff0e002f2 server/info: increase hdd usage cache time to 48h 2016-08-31 22:22:06 +02:00
rr- 243ab15b85 server/tags: add order to tag names
The better implementation of a224297.

Fixes ability to reorder tag aliases, especially - the ability to change
the tag's primary name after it was created. Until now, both of these
scenarios needed sad workarounds on the user part.
2016-08-28 20:00:50 +02:00
rr- c366b608da server/search: fix negating complex searches
Entering:

    miko -miko

is a contradiction that shouldn't have been returning any matches, but
it has nonetheless. This change fixes the construction of negated
expressions that use subqueries.
2016-08-28 18:43:05 +02:00
rr- 3c5878cb16 server/tags: improve tag list performance 2016-08-27 22:19:01 +02:00
rr- ef0f74297f server/tag-categories: fix default categories
- Don't cache default category in its entirety - cache only its name
- Purge cache on category name changes and default category changes
- Lock records for updates where applicable
2016-08-27 12:39:59 +02:00
rr- 06ab98fa70 server/search: fix sort:random breaking tags
Using sqlalchemy's subqueryload to fetch tags works like this:

1. Get basic info about posts with query X
2. Copy query X
3. SELECT all tags WHERE post_id IN (SELECT post_ids FROM query X)
4. Associate the resulting tags with the posts

When original query contains .order_by(func.random()), it looks like
this:

1. SELECT post.* FROM post ORDER BY random() LIMIT 10
2. Copy "ORDER BY random() LIMIT 10"
3. SELECT tag.* FROM tag WHERE tag.post_id IN (
       SELECT id FROM post ORDER BY random() LIMIT 10)
4. Disaster! Each post now has completely arbitrary tags!

To circumvent this, we replace eager loading with lazy loading. This
generates one extra query for each result row, but it has no chance of
producing such anomalies. This behavior is activated only for
queries containing "sort:random" and derivatives so it shouldn't hit
performance too much.
2016-08-27 01:21:59 +02:00
rr- f8e91a10e8 server/search: refactor query factories 2016-08-27 01:19:29 +02:00
rr- 6d26b5c37a server/search: fix sort:random 2016-08-26 23:27:33 +02:00
rr- fa60b42f65 server/search: improve post list performance 2016-08-26 17:57:20 +02:00
rr- 422b99ac8d server/search: add content-checksum 2016-08-26 16:26:06 +02:00
rr- ffb87f1650 server/posts: defer flush; save content lazily
Rather than flushing the post right away only to find out that there
were validation errors, try to postpone flushing for as long as
possible.

The previous behavior has led to too eager spending of post IDs - each
flush calls nextval(post_id_seq), and postgres sequences are not
affected by transaction rollbacks, so each erroneous post creation
discarded a post ID, which has led to gaps in post IDs.
2016-08-26 15:09:08 +02:00
rr- bb369efa99 server/general: disable autoflush 2016-08-26 14:41:05 +02:00
rr- 280a55046a server/db: make query counter thread-local 2016-08-24 12:31:55 +02:00
rr- 73a8542220 server/posts: make anon snapshots for anon uploads 2016-08-22 20:07:39 +02:00
rr- 61d084cc66 server/search: support 'submit:' for anon uploads 2016-08-22 19:45:25 +02:00
rr- b7e9cbd541 server/posts: allow tagless posts 2016-08-21 23:40:01 +02:00