Commit 497361ff authored by James Calfee's avatar James Calfee
Browse files

Add optional filename to GET url. Update docs

parent 8feaa986
......@@ -7,15 +7,28 @@ See also: `./config/index.js`
## Example upload
#### Start the server
Enable the TEST key in development mode only. The examples below are signed using this test key.
> export STEEMIT_UPLOAD_TEST_KEY=true
> npm start
#### Download the test image
#### Usage
# POST
curl -v -F "data=@<path_to_file>" http://localhost:3234/<blockchain_username>/<hex(sign(hash256(data)))>
# GET
curl http://localhost:3234/<hash256(data)>/<[optional_file_name]>
The `optional_file_name` is ignored but should be provided to help users and applications understand the URL.
#### Example Download
> curl -v http://localhost:3234/a190c0596a37398427e51bcbee7c94f1007075629828d62005735c6c2d2ffeef > $HOME/Pictures/blue_red_pill.jpg
> curl -v http://localhost:3234/a190c0596a37398427e51bcbee7c94f1007075629828d62005735c6c2d2ffeef/blue_red_pill.jpg > $HOME/Pictures/blue_red_pill.jpg
#### Upload again (user `steem` signed using a test key)
#### Example Upload (user `steem` signed using a test key)
> curl -v -F "data=@$HOME/Pictures/blue_red_pill.jpg" http://localhost:3234/steem/205d8bcafb9e0e0897e2db330aa2bd1ca4f7764ad9b1ba04a2a9651453aee72f4a685bd631ad60111f8018fd65d3fc7e951c0039476c270e859bb6760836dcb40d
......
......@@ -11,7 +11,7 @@ const requestPerHour = new RateLimit({duration: ms.hour, max: downloadIpLimit.re
const router = require('koa-router')()
router.get('/:hash', function *() {
router.get('/:hash/:filename?', function *() {
try {
const ip = getRemoteIp(this.req)
if(limit(this, requestPerHour, ip, 'Downloads', 'request')) return
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment