diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-02-26 22:39:22 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-02-26 22:39:22 +0100 |
commit | 7a5d729859a2f667658532303c2616a38f781dd2 (patch) | |
tree | 189dae579b027ad0a22153e40e5b74ae5210ff20 /templates | |
parent | 2b1d2bc45cb09e0df180bcbfdf30859b5ea142c7 (diff) |
Added some requests, more details in long description.
- Files are now hashed, when you upload a file with an existing hash
you will get the existing file in return (will fix adding files to
your account at a later time).
- Username can be used instead of uid for cookies, hashing for the
identifier works the same way as before, but with username instead of
uid if username is used.
- Add api=1 to get machine-readable responses, details in are found on
the help page.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/help.tmpl | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/templates/help.tmpl b/templates/help.tmpl index 5dc096f..bdf95d4 100644 --- a/templates/help.tmpl +++ b/templates/help.tmpl @@ -3,9 +3,21 @@ #extends templates.base #def content <p>Usage: POST to <a href="$scheme://$host/u">$scheme://$host/u</a> with filedata given to "file" and original filename to "filename". - Login is sent by cookies with user id in "uid" and an identifier which is sha1(uid+sha1(password)).</p> + Login is sent by cookies with either: + <ul> + <li>user id in "uid" and an identifier which is sha1(uid+sha1(password))</li> + </ul> + or + <ul> + <li>username in "username" and an identifier which is sha1(username+sha1(password))</li> + </ul> + </p> <p>cURL example: - <code>curl -b 'uid=42; identifier=360b411581c3d516c8d55c290f039b144cea79ad' -F 'file=@image.png' -F 'filename=image.png' http://myhost/u</code> + <blockquote><code>curl -b 'uid=42; identifier=360b411581c3d516c8d55c290f039b144cea79ad' -F 'file=@image.png' -F 'filename=image.png' -F 'api=1' http://myhost/u</code></blockquote> Here user id is 42 and the password is "foobar". - If you get HTTP 417 responses, try adding:<code>-H 'Expect:'</code></p> + If you get HTTP 417 responses, try adding:<code>-H 'Expect:'</code>.</p> + <p>By adding the key-value pair "api=1" you will get machine-readable responses in the form: <code>response result</code> where <code>response</code> is either <code>ERROR</code> or <code>OK</code>, + and <code>result</code> is the file hash in the case of <code>OK</code>, or an error message in the case of <code>ERROR</code>. + The hash can be used to construct URLs in which the paths begin with <code>/f/hash</code> where <code>hash</code> is the hash received.</p> + <p>Any file extension an be appended to the hash, and for convenience the original filename (or whatever filename you prefer) can be appended after an additional slash after the hash.</p> #end def |