Fix doc issues with some plugins
This commit is contained in:
@@ -6,10 +6,12 @@ Based on pilkit's Adjust_ processor.
|
||||
|
||||
Settings::
|
||||
|
||||
adjust_options = {'color': 1.0,
|
||||
'brightness': 1.0,
|
||||
'contrast': 1.0,
|
||||
'sharpness': 1.0}
|
||||
adjust_options = {
|
||||
'color': 1.0,
|
||||
'brightness': 1.0,
|
||||
'contrast': 1.0,
|
||||
'sharpness': 1.0
|
||||
}
|
||||
|
||||
"""
|
||||
|
||||
|
||||
@@ -1 +1,42 @@
|
||||
"""
|
||||
Plugin to protect gallery by encrypting image files using a password.
|
||||
|
||||
Options::
|
||||
|
||||
encrypt_options = {
|
||||
'password': 'password',
|
||||
'ask_password': False,
|
||||
'gcm_tag': 'randomly_generated',
|
||||
'kdf_salt': 'randomly_generated',
|
||||
'kdf_iters': 10000,
|
||||
}
|
||||
|
||||
- ``password``: The password used to encrypt the images on gallery build,
|
||||
and decrypt them when viewers access the gallery. No default value. You must
|
||||
specify a password.
|
||||
- ``ask_password``: Whether or not viewers are asked for the password to view
|
||||
the gallery. If set to ``False``, the password will be present in the HTML
|
||||
files so the images are decrypted automatically. Defaults to ``False``.
|
||||
- ``gcm_tag``, ``kdf_salt``, ``kdf_iters``: Cryptographic parameters used when
|
||||
encrypting the files. ``gcm_tag``, ``kdf_salt`` are meant to be randomly
|
||||
generated, ``kdf_iters`` defaults to 10000. Do not specify them in the config
|
||||
file unless you have good reasons to do so.
|
||||
|
||||
Note: The plugin caches the cryptographic parameters (but not the password)
|
||||
after the first build, so that incremental builds can share the same
|
||||
credentials. DO NOT CHANGE THE PASSWORD OR OTHER CRYPTOGRAPHIC PARAMETERS ONCE
|
||||
A GALLERY IS BUILT, or there will be inconsistency in encrypted files and
|
||||
viewers will not be able to see some of the images any more.
|
||||
|
||||
.. _compatibility-with-encrypt:
|
||||
|
||||
Compatibility with other plugins:
|
||||
|
||||
- ``zip_gallery``: if you enable both this plugin and the ``zip_gallery``
|
||||
plugin, the generated zip archives will contain encrypted images, which is
|
||||
generally meaningless since viewers cannot easily decrypt them outside
|
||||
a browser.
|
||||
|
||||
"""
|
||||
|
||||
from .encrypt import register
|
||||
|
||||
@@ -18,44 +18,6 @@
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
'''Plugin to protect gallery by encrypting image files using a password.
|
||||
|
||||
Options::
|
||||
|
||||
encrypt_options = {
|
||||
'password': 'password',
|
||||
'ask_password': False,
|
||||
'gcm_tag': 'randomly_generated',
|
||||
'kdf_salt': 'randomly_generated',
|
||||
'kdf_iters': 10000
|
||||
}
|
||||
|
||||
- ``password``: The password used to encrypt the images on gallery build,
|
||||
and decrypt them when viewers access the gallery. No default value. You must
|
||||
specify a password.
|
||||
- ``ask_password``: Whether or not viewers are asked for the password to view
|
||||
the gallery. If set to ``False``, the password will be present in the HTML files
|
||||
so the images are decrypted automatically. Defaults to ``False``.
|
||||
- ``gcm_tag``, ``kdf_salt``, ``kdf_iters``: Cryptographic parameters used when
|
||||
encrypting the files. ``gcm_tag``, ``kdf_salt`` are meant to be randomly generated,
|
||||
``kdf_iters`` defaults to 10000. Do not specify them in the config file unless
|
||||
you have good reasons to do so.
|
||||
|
||||
Note: The plugin caches the cryptographic parameters (but not the password) after
|
||||
the first build, so that incremental builds can share the same credentials.
|
||||
DO NOT CHANGE THE PASSWORD OR OTHER CRYPTOGRAPHIC PARAMETERS ONCE A GALLERY IS
|
||||
BUILT, or there will be inconsistency in encrypted files and viewers will not be able
|
||||
to see some of the images any more.
|
||||
|
||||
.. _compatibility-with-encrypt:
|
||||
|
||||
Compatibility with other plugins:
|
||||
|
||||
- ``zip_gallery``: if you enable both this plugin and the ``zip_gallery`` plugin,
|
||||
the generated zip archives will contain encrypted images, which is generally
|
||||
meaningless since viewers cannot easily decrypt them outside a browser.
|
||||
'''
|
||||
|
||||
import logging
|
||||
import os
|
||||
import pickle
|
||||
@@ -87,7 +49,7 @@ def get_options(settings, cache):
|
||||
if "encrypt_options" not in settings:
|
||||
logging.error("Encrypt: no encrypt_options in settings")
|
||||
raise ValueError("no encrypt_options in settings")
|
||||
|
||||
|
||||
# try load credential from cache
|
||||
try:
|
||||
options = cache["credentials"]
|
||||
@@ -108,16 +70,16 @@ def get_options(settings, cache):
|
||||
options["filtered_password"] = "" if options["ask_password"] else options["escaped_password"]
|
||||
|
||||
if "gcm_tag" not in options:
|
||||
options["gcm_tag"] = gen_rand_string()
|
||||
options["gcm_tag"] = gen_rand_string()
|
||||
options["escaped_gcm_tag"] = options["gcm_tag"].translate(table)
|
||||
|
||||
|
||||
if "kdf_salt" not in options:
|
||||
options["kdf_salt"] = gen_rand_string()
|
||||
options["escaped_kdf_salt"] = options["kdf_salt"].translate(table)
|
||||
|
||||
if "galleryId" not in options:
|
||||
options["galleryId"] = gen_rand_string(6)
|
||||
|
||||
|
||||
if "kdf_iters" not in options:
|
||||
options["kdf_iters"] = 10000
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ from datetime import datetime
|
||||
|
||||
from jinja2 import Markup
|
||||
|
||||
from feedgenerator import Atom1Feed, Rss201rev2Feed
|
||||
from sigal import signals
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -43,6 +42,7 @@ def generate_feeds(gallery):
|
||||
|
||||
|
||||
def generate_feed(gallery, medias, feed_type=None, feed_url='', nb_items=0):
|
||||
from feedgenerator import Atom1Feed, Rss201rev2Feed
|
||||
root_album = gallery.albums['.']
|
||||
cls = Rss201rev2Feed if feed_type == 'rss' else Atom1Feed
|
||||
feed = cls(
|
||||
|
||||
@@ -27,14 +27,13 @@ import os
|
||||
|
||||
from click import progressbar
|
||||
|
||||
import boto
|
||||
from boto.s3.key import Key
|
||||
from sigal import signals
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def upload_s3(gallery, settings=None):
|
||||
import boto
|
||||
upload_files = []
|
||||
|
||||
# Get local files
|
||||
@@ -86,6 +85,7 @@ def generate_cache_metadata(gallery, f):
|
||||
def upload_file(gallery, bucket, f):
|
||||
logger.debug("Uploading file %s" % (f))
|
||||
|
||||
from boto.s3.key import Key
|
||||
key = Key(bucket)
|
||||
key.key = f
|
||||
|
||||
|
||||
Reference in New Issue
Block a user