diff options
| author | JF | 2019-07-09 14:56:21 -0700 |
|---|---|---|
| committer | jvoisin | 2019-07-09 14:56:21 -0700 |
| commit | 06346e19464c376c0c2ca13ef4218559f9df4212 (patch) | |
| tree | 94db98bcfbcd68dffdec0fa60239baef278510a8 /README.md | |
| parent | 9d155d171e916cd3c2c34f6c50955745f8929e79 (diff) | |
added a docker dev environment
Signed-off-by: Jan Friedli <jan.friedli@immerda.ch>
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 62 |
1 files changed, 62 insertions, 0 deletions
| @@ -52,6 +52,11 @@ Nginx is the recommended web engine, but you can also use Apache if you prefer, | |||
| 52 | by copying [this file](https://0xacab.org/jvoisin/mat2-web/tree/master/config/apache2.config) | 52 | by copying [this file](https://0xacab.org/jvoisin/mat2-web/tree/master/config/apache2.config) |
| 53 | to your `/etc/apache2/sites-enabled/mat2-web` file. | 53 | to your `/etc/apache2/sites-enabled/mat2-web` file. |
| 54 | 54 | ||
| 55 | Then configure the environment variable: `MAT2_ALLOW_ORIGIN_WHITELIST=https://myhost1.org https://myhost2.org` | ||
| 56 | Note that you can add multiple hosts from which you want to accept API requests. These need to be separated by | ||
| 57 | a space. | ||
| 58 | **IMPORTANT:** The default value if the variable is not set is: `Access-Control-Allow-Origin: *` | ||
| 59 | |||
| 55 | Finally, restart uWSGI and your web server: | 60 | Finally, restart uWSGI and your web server: |
| 56 | 61 | ||
| 57 | ``` | 62 | ``` |
| @@ -85,6 +90,63 @@ the docker dev environment. Mat2-web is now accessible on your host machine at ` | |||
| 85 | Every code change triggers a restart of the app. | 90 | Every code change triggers a restart of the app. |
| 86 | If you want to add/remove dependencies you have to rebuild the container. | 91 | If you want to add/remove dependencies you have to rebuild the container. |
| 87 | 92 | ||
| 93 | # RESTful API | ||
| 94 | |||
| 95 | ## Upload Endpoint | ||
| 96 | |||
| 97 | **Endpoint:** `/api/upload` | ||
| 98 | |||
| 99 | **HTTP Verbs:** POST | ||
| 100 | |||
| 101 | **Body:** | ||
| 102 | ```json | ||
| 103 | { | ||
| 104 | "file_name": "my-filename.jpg", | ||
| 105 | "file": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==" | ||
| 106 | } | ||
| 107 | ``` | ||
| 108 | |||
| 109 | The `file_name` parameter takes the file name. | ||
| 110 | The `file` parameter is the base64 encoded file which will be cleaned. | ||
| 111 | |||
| 112 | **Example Response:** | ||
| 113 | ```json | ||
| 114 | { | ||
| 115 | "output_filename": "fancy.cleaned.jpg", | ||
| 116 | "key": "81a541f9ebc0233d419d25ed39908b16f82be26a783f32d56c381559e84e6161", | ||
| 117 | "meta": { | ||
| 118 | "BitDepth": 8, | ||
| 119 | "ColorType": "RGB with Alpha", | ||
| 120 | "Compression": "Deflate/Inflate", | ||
| 121 | "Filter": "Adaptive", | ||
| 122 | "Interlace": "Noninterlaced" | ||
| 123 | }, | ||
| 124 | "meta_after": {}, | ||
| 125 | "download_link": "http://localhost:5000/download/81a541f9ebc0233d419d25ed39908b16f82be26a783f32d56c381559e84e6161/fancy.cleaned.jpg" | ||
| 126 | } | ||
| 127 | ``` | ||
| 128 | |||
| 129 | ## Supported Extensions Endpoint | ||
| 130 | |||
| 131 | **Endpoint:** `/api/extension` | ||
| 132 | |||
| 133 | **HTTP Verbs:** GET | ||
| 134 | |||
| 135 | **Example Response (shortened):** | ||
| 136 | ```json | ||
| 137 | [ | ||
| 138 | ".asc", | ||
| 139 | ".avi", | ||
| 140 | ".bat", | ||
| 141 | ".bmp", | ||
| 142 | ".brf", | ||
| 143 | ".c", | ||
| 144 | ".css", | ||
| 145 | ".docx", | ||
| 146 | ".epub" | ||
| 147 | ] | ||
| 148 | ``` | ||
| 149 | |||
| 88 | # Custom templates | 150 | # Custom templates |
| 89 | 151 | ||
| 90 | You can override the default templates from `templates/` by putting replacements | 152 | You can override the default templates from `templates/` by putting replacements |
