summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorJF2019-07-09 14:56:21 -0700
committerjvoisin2019-07-09 14:56:21 -0700
commit06346e19464c376c0c2ca13ef4218559f9df4212 (patch)
tree94db98bcfbcd68dffdec0fa60239baef278510a8 /README.md
parent9d155d171e916cd3c2c34f6c50955745f8929e79 (diff)
added a docker dev environment
Signed-off-by: Jan Friedli <jan.friedli@immerda.ch>
Diffstat (limited to 'README.md')
-rw-r--r--README.md62
1 files changed, 62 insertions, 0 deletions
diff --git a/README.md b/README.md
index 0ee91ac..98b82bd 100644
--- a/README.md
+++ b/README.md
@@ -52,6 +52,11 @@ Nginx is the recommended web engine, but you can also use Apache if you prefer,
52by copying [this file](https://0xacab.org/jvoisin/mat2-web/tree/master/config/apache2.config) 52by copying [this file](https://0xacab.org/jvoisin/mat2-web/tree/master/config/apache2.config)
53to your `/etc/apache2/sites-enabled/mat2-web` file. 53to your `/etc/apache2/sites-enabled/mat2-web` file.
54 54
55Then configure the environment variable: `MAT2_ALLOW_ORIGIN_WHITELIST=https://myhost1.org https://myhost2.org`
56Note that you can add multiple hosts from which you want to accept API requests. These need to be separated by
57a space.
58**IMPORTANT:** The default value if the variable is not set is: `Access-Control-Allow-Origin: *`
59
55Finally, restart uWSGI and your web server: 60Finally, 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 `
85Every code change triggers a restart of the app. 90Every code change triggers a restart of the app.
86If you want to add/remove dependencies you have to rebuild the container. 91If 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
109The `file_name` parameter takes the file name.
110The `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
90You can override the default templates from `templates/` by putting replacements 152You can override the default templates from `templates/` by putting replacements