Commit Graph

62 Commits

Author SHA1 Message Date
Shyam Sunder 0c05330cfc server/tests: fix failing tests 2019-09-28 18:58:45 -04:00
rr- b1a20a7134 tests: fix failing tests
Regression caused by changing the way images are converted to grayscale
in 9730aa5c
2018-07-25 19:53:37 +02:00
ReAnzu 2a69f0193f server/auth: add token authentication
* Users are only authenticated against their password on login,
  and to retrieve a token
* Passwords are wiped from the GUI frontend and cookies
  after login and token retrieval
* Tokens are revoked at the end of the session/logout
* If the user chooses the "remember me" option,
  the token is stored in the cookie
* Tokens correctly delete themselves on logout
* Tokens can expire at user-specified date
* Tokens have their last usage time
* Tokens can have user defined descriptions
* Users can manage login tokens in their account settings
2018-03-25 22:23:29 +02:00
ReAnzu 3f52aceca4 server/users: harden password hashes
- Changed password setup to use libsodium and argon2id (regular SHA256
  hashing for passwords is inadequate as modern GPU's can hash generate
  billions of hashes per second).
- Added code to auto migrate old passwords to the new password_hash if
  the existing password_hash matches either of the legacy password
  generation schemes (SHA1 or SHA256).
- Added migration to support new password_hash format length
- Added column password_revision. This field will default to 0, which
  all passwords will have till they're updated. After that each password
  hash method has a revision.
2018-03-08 23:40:47 +01:00
ReAnzu 7519e071e7 server/posts: deleting a post purges its artifacts
Specifically, its thumbnail and post source.
2018-03-08 23:37:37 +01:00
rr- 1c4c5c5f91 remove tags.json 2017-10-01 21:48:00 +02:00
rr- 4afece8d50 server/posts: add non-guessable IDs to post URLs 2017-08-24 17:17:09 +02:00
rr- 4bc58a3c95 server: lint 2017-04-24 23:30:53 +02:00
rr- 8e5798ab8c server/tests: fix content sync tests on postgres 2017-04-24 22:36:41 +02:00
rr- 5681fd11ef server/net: make the user-agent configurable
Fixes #127
2017-03-03 17:27:23 +01:00
rr- ad842ee8a5 server: refactor + add type hinting
- Added type hinting (for now, 3.5-compatible)
- Split `db` namespace into `db` module and `model` namespace
- Changed elastic search to be created lazily for each operation
- Changed to class based approach in entity serialization to allow
  stronger typing
- Removed `required` argument from `context.get_*` family of functions;
  now it's implied if `default` argument is omitted
- Changed `unalias_dict` implementation to use less magic inputs
2017-02-05 16:34:45 +01:00
rr- abf1fc2b2d server: make linters happier 2017-02-03 22:42:14 +01:00
rr- fd30675124 server/image-hash: do not depend on image-match
While I hold this library in great esteem for its excellent work on
implementing the original paper, I have several problems with it:

- as of this commit, it (again) has bug fixes unreleased on pip
- its code is badly structured
    - forces OOP and then proceeds @staticmethod everything
    - bad class design, parameters are repeated in several places
    - terrible contract of make_record() and generate_signature()
    - ambiguous parameters: path vs. image path vs. image content
    - doesn't adhere to PEP-8
- depends on cairo just to render svg images almost no one uses this
  library with
2017-02-03 21:20:52 +01:00
rr- 894cd29511 server/tests: test image hash 2017-02-03 19:53:10 +01:00
rr- e92bd2fd80 server/tags: fix getting default category name
No categories? Should have thrown an error rather than returning None.
2017-02-02 20:04:09 +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- 1a59a74d63 server/image-hash: add image search engine 2016-12-26 15:00:16 +01:00
rr- 141c9fcdc9 server/tags: merge also tag relations 2016-10-22 18:02:50 +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- 8674c8b50e server/posts: report duplicate post ID and URL 2016-09-10 10:16:14 +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- 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- 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- 28bcbd33b9 server/posts: use SHA1 checksums
This changes the checksums to ones that are compatible with 1.x, which
relieves the migration script from recalculating the checksums for all
the posts.
2016-08-20 13:06:19 +02:00
rr- 80af79779d server/snapshots: rewrite 2016-08-16 21:51:25 +02:00
rr- 87b1ee4564 server/tests: use real database
I'm experimenting with snapshots and found following limitation of
SQLite: https://www.sqlite.org/isolation.html
2016-08-16 17:22:33 +02:00
rr- ef4af697c4 server/tags: fix tag sorting
Brainfart from d6942121e5
2016-08-14 17:54:15 +02:00
rr- 9aea55e3d1 server/general: embrace most of PEP8
Ignored only the rules about continuing / hanging indentation.

Also, added __init__.py to tests so that pylint discovers them. (I don't
buy pytest's BS about installing your package.)
2016-08-14 16:44:03 +02:00
rr- d102c9bdba server/tests: update func.posts tests 2016-08-14 16:43:35 +02:00
rr- 264f9ee70b server/tests: update func.mime tests 2016-08-14 16:43:35 +02:00
rr- c23c401c4d server/tests: add func.tags tests 2016-08-14 16:43:35 +02:00
rr- 53e96ba41f server/tests: add func.tag_categories tests 2016-08-14 16:43:35 +02:00
rr- 81dfbaec98 server/tests: add func.users tests 2016-08-14 16:43:35 +02:00
rr- 03c74cb5a3 server/tests: add func.comments tests 2016-08-14 16:43:35 +02:00
rr- f6f07a35df server/general: authenticated_user->auth_user 2016-08-14 16:43:04 +02:00
rr- bb86e9bf56 server/posts: add more safety checks for notes 2016-08-14 16:43:04 +02:00
rr- 2b3d193b7c server/tags: don't auto-create tag categories 2016-08-14 11:38:59 +02:00
rr- 8d04df38fd server/general: add entity versions 2016-08-07 09:55:51 +02:00
rr- 5092c2c587 server/posts: respect tag creating privilege 2016-08-02 12:44:38 +02:00
rr- b7f2982c9e server/posts: fix relations bidirectionality 2016-07-17 21:14:03 +02:00
rr- c472229bae server/posts: add relationCount field 2016-07-03 18:30:32 +02:00
rr- c21494be25 server/posts: make relations bidirectional 2016-07-03 18:30:32 +02:00
rr- b28f689077 server/posts: add ownFavorite field to posts 2016-06-08 22:38:35 +02:00
rr- 805ca845e3 server/users: reduce user fields footprint 2016-06-03 20:14:01 +02:00
rr- 78612e1da1 server/posts: add new fields 2016-05-30 23:23:22 +02:00
rr- d0314813cb server/general: move extra details to resources 2016-05-30 22:54:33 +02:00
rr- 4d1f745e38 server/notes: fix note serialization 2016-05-29 12:40:36 +02:00