diff options
| author | jvoisin | 2019-02-22 20:31:27 +0100 |
|---|---|---|
| committer | jvoisin | 2019-02-22 20:31:27 +0100 |
| commit | 12be535945cbfbf0aa8ca149348b0eb683a23d5b (patch) | |
| tree | bfd7549c0be8dc2fbb27dc9348085d030cc53cd6 | |
| parent | 1837b53ece60a0a9f6106480ec05ec92c7cf62bf (diff) | |
Add a way to display the supported fileformats
| -rw-r--r-- | main.py | 1 | ||||
| -rw-r--r-- | static/style.css | 18 | ||||
| -rw-r--r-- | templates/index.html | 14 |
3 files changed, 29 insertions, 4 deletions
| @@ -42,7 +42,6 @@ def upload_file(): | |||
| 42 | mimetypes = set() | 42 | mimetypes = set() |
| 43 | for parser in parser_factory._get_parsers(): | 43 | for parser in parser_factory._get_parsers(): |
| 44 | mimetypes = mimetypes | parser.mimetypes | 44 | mimetypes = mimetypes | parser.mimetypes |
| 45 | mimetypes = ', '.join(mimetypes) | ||
| 46 | 45 | ||
| 47 | if request.method == 'POST': | 46 | if request.method == 'POST': |
| 48 | if 'file' not in request.files: # check if the post request has the file part | 47 | if 'file' not in request.files: # check if the post request has the file part |
diff --git a/static/style.css b/static/style.css index 5f854a4..0d78cbd 100644 --- a/static/style.css +++ b/static/style.css | |||
| @@ -39,3 +39,21 @@ a { | |||
| 39 | a:hover { | 39 | a:hover { |
| 40 | text-decoration: underline; | 40 | text-decoration: underline; |
| 41 | } | 41 | } |
| 42 | |||
| 43 | li { | ||
| 44 | margin-bottom: 0; | ||
| 45 | } | ||
| 46 | |||
| 47 | details > summary:before { | ||
| 48 | content: "▶ "; | ||
| 49 | } | ||
| 50 | details[open] > summary:before { | ||
| 51 | content: "▼ "; | ||
| 52 | } | ||
| 53 | |||
| 54 | .fakelink { | ||
| 55 | color: #1EAEDB; | ||
| 56 | } | ||
| 57 | .fakelink:hover { | ||
| 58 | text-decoration: underline; | ||
| 59 | } | ||
diff --git a/templates/index.html b/templates/index.html index 1e05c82..e9aea92 100644 --- a/templates/index.html +++ b/templates/index.html | |||
| @@ -3,14 +3,22 @@ | |||
| 3 | 3 | ||
| 4 | <h2>» Remove metadata</h2> | 4 | <h2>» Remove metadata</h2> |
| 5 | <p> | 5 | <p> |
| 6 | Upload your image, get a <em>cleaned</em> one in response.<br> | 6 | Upload your file, get a <em>cleaned</em> one in response. |
| 7 | <br> | 7 | <br><br> |
| 8 | Please note that while we do not keep a copy of your image,<br> | 8 | Please note that while we do not keep a copy of your image,<br> |
| 9 | there is no way that you could be certain about this: act accordingly. | 9 | there is no way that you could be certain about this: act accordingly. |
| 10 | </p> | 10 | </p> |
| 11 | <details> | ||
| 12 | <summary>Click <span class='fakelink'>here</span> so see the supported formats</summary> | ||
| 13 | <ul> | ||
| 14 | {% for mimetype in mimetypes %} | ||
| 15 | <li>{{ mimetype }}</li> | ||
| 16 | {% endfor %} | ||
| 17 | </ul> | ||
| 18 | </details> | ||
| 11 | <br> | 19 | <br> |
| 12 | <form class='b' method=post enctype=multipart/form-data> | 20 | <form class='b' method=post enctype=multipart/form-data> |
| 13 | <input type=file name=file id="upload_file" accept="{{ mimetypes }}"> | 21 | <input type=file name=file id="upload_file" accept="{{ mimetypes | join(', ') }}"> |
| 14 | <input type=submit value=Upload> | 22 | <input type=submit value=Upload> |
| 15 | </form> | 23 | </form> |
| 16 | {% endblock %} | 24 | {% endblock %} |
