Commit Graph

8 Commits

Author SHA1 Message Date
Tim Abbott d3baa43167 thumbor: Clean up whitespace in thumbor.conf. 2018-07-15 17:52:39 +05:30
Aditya Bansal 529e4e76c8 thumbnaling: Support S3 upload backend in thumbor.
Credits for doing this goes to @sampritipanda.
2018-07-15 00:57:59 +05:30
Aditya Bansal 98a4e87e1d thumbor: Complete implementation of thumbnailing.
Various pieces of our thumbor-based thumbnailing system were already
merged; this adds the remaining pieces required for it to work:

* a THUMBOR_URL Django setting that controls whether thumbor is
  enabled on the Zulip server (and if so, where thumbor is hosted).

* Replaces the overly complicated prototype cryptography logic

* Adds a /thumbnail endpoint (supported both on web and mobile) for
  accessing thumbnails in messages, designed to support hosting both
  external URLs as well as uploaded files (and applying Zulip's
  security model for access to thumbnails of uploaded files).

* Modifies bugdown to, when THUMBOR_URL is set, render images with the
  `src` attribute pointing /thumbnail (to provide a small thumbnail
  for the image), along with adding a "data-original" attribute that
  can be used to access the "original/full" size version of the image.

There are a few things that don't work quite yet:
* The S3 backend support is incomplete and doesn't work yet.
* The error pages for unauthorized access are ugly.
* We might want to rename data-original and /thumbnail?size=original
  to use some other name, like "full", that better reflects the fact
  that we're potentially not serving the original image URL.
2018-07-15 00:39:41 +05:30
Tim Abbott 85d7ddbeca thumbor: Switch thumbor.conf to use a better system.
Previously, thumbor.conf read LOCAL_UPLOADS_DIR from
zproject/settings.py by calling get-django-setting, which ends up
importing Django (taking 250ms, and requiring a full Zulip virtualenv
to be installed on the system).

The new system (in production) just imports prod_settings.py, which
has a lot fewer dependencies and is also a lot faster.
2018-07-15 00:05:05 +05:30
Tim Abbott 50588274ff zthumbor: Use get_secret to configure thumbor.conf.
We need to use the value of SECURITY_KEY read from
/etc/zulip/zulip-secrets.conf (using get_secret), and also we disable
a few Thumbor features that we're not using. We also fix access to
secret keys by getting their values using get_secret.
2018-07-14 21:45:33 +05:30
neiljp (Neil Pilgrim) 3b28d6ab8b mypy: Rewrite sign_is_valid in zthumbor helpers.py for None secret_key. 2018-03-25 08:59:08 -07:00
neiljp (Neil Pilgrim) aa48929f66 mypy: Minor zthumbor annotation changes.
- Any->Text in helpers.py;
- Remove ignore and add generic params.

revert thumbor except type.
2018-03-12 11:23:30 -07:00
Aditya Bansal 0fcf0c5052 thumbor: Add thumbor on port 9995 in development.
For now, this does nothing in a production environment, but it should
simplify the process of doing testing on the Thumbor implementation,
by integrating a lot of dependency management logic.
2018-01-29 13:10:29 -08:00