- Update registration and login to include web3 options

- Add nonce endpoint doc
- Add registration endpoint
- Update some param docs to "query parameters" instead of incorrect/misleading "query parameters".
- Update postpassword docs with much more detail
- Update post object doc
master
Thomas Lynch 8 months ago
parent 8c00039356
commit 6f24162586
Signed by: fatchan
GPG Key ID: A7E5E8B7E11EE92D
  1. 95
      source/index.html.md.erb

@ -536,7 +536,7 @@ Returns a thread with all replies.
`GET https://fatchan.org/{board}/thread/{threadId}.json`
### Query Parameters
### URL Parameters
Parameter | Description
--------- | -----------
@ -682,7 +682,7 @@ Returns a list of threads with preview replies from a page of a board.
`GET https://fatchan.org/{board}/{page}.json`
### Query Parameters
### URL Parameters
Parameter | Description
--------- | -----------
@ -796,7 +796,7 @@ Returns a list of all threads on a board.
`GET https://fatchan.org/{board}/catalog.json`
### Query Parameters
### URL Parameters
Parameter | Description
--------- | -----------
@ -849,7 +849,7 @@ Returns a list of objects each containing a date (day, month, year) and number o
`GET https://fatchan.org/{board}/logs.json`
### Query Parameters
### URL Parameters
Parameter | Description
--------- | -----------
@ -948,7 +948,7 @@ Returns a list of log entries for a board ona a particular date.
`GET https://fatchan.org/{board}/logs/{mm}-{dd}-{yyyy}.json`
### Query Parameters
### URL Parameters
Parameter | Description
--------- | -----------
@ -999,7 +999,7 @@ Returns the data for a board custom page.
`GET https://fatchan.org/{board}/custompage/{page}.json`
### Query Parameters
### URL Parameters
Parameter | Description
--------- | -----------
@ -1039,7 +1039,7 @@ Returns a list of board banner file names. Full path of a banner is `/banner/{bo
`GET https://fatchan.org/{board}/banners.json`
### Query Parameters
### URL Parameters
Parameter | Description
--------- | -----------
@ -1104,7 +1104,7 @@ Returns some publicly available board settings.
`GET https://fatchan.org/{board}/settings.json`
### Query Parameters
### URL Parameters
Parameter | Description
--------- | -----------
@ -1257,13 +1257,14 @@ name | string | Name
message | string | Message
subject | string | Subject
email | string | Email, or special values such as 'sage'.
postpassword | string | Password required to delete the post later.
postpassword | string | Post password lets users action posts e.g. delete, spoiler, remove files after posting. It's useful to let anonymous users manage their own posts without requiring an account. Users can set it manually, or if they have JavaScript enabled one is randomly generated and stored in localstorage. If the post password is left empty, the post can only be actioned by staff. Staff can also action any post without needing the post password. The ability for anonymous users to action their posts can be disabled on a per-board level.
file | file(s) | One or more files, multipart form data.
spoiler | array(string) | Array of sha256 hash of files to be spoilered.
spoiler_all | boolean | Whether to spoiler all files.
strip_filename | array(string) | Array of sha256 hash of files to have filenames stripped.. The sha256 hash will be used instead. Note: the server will still receive the original filenames before stripping.
customflag | string or null | Name of custom flag to be used. If null, will use no flag unless the board also has geoip flags enabled, then it will use the geo flag.
captcha | array(number) or string | See <a href='#captcha-block-bypass'>Captcha/block bypass</a>
signature | string | Signature output of a web3 eth personal_sign request with the content of the `message` parameter. Will add a signature and the recovered address to the bottom of the post.
## Post actions (delete, report, etc)
@ -1288,7 +1289,7 @@ checkedposts | array(number) | Array of `postId`'s to action against.
delete | boolean | Delete the selected posts.
spoiler | boolean | Spoiler all files in the selected posts.
unlink_file | boolean | Unlink files from the selected posts. If there are other copies of the file in other posts, or the global settings do not immediately prune unlinked files, the file may remain on disk.
postpassword | string | Password for anonymous users, the same one used to create the posts.
postpassword | string | Post password lets users action posts e.g. delete, spoiler, remove files after posting. It's useful to let anonymous users manage their own posts without requiring an account. Users can set it manually, or if they have JavaScript enabled one is randomly generated and stored in localstorage. If the post password is left empty, the post can only be actioned by staff. Staff can also action any post without needing the post password. The ability for anonymous users to action their posts can be disabled on a per-board level.
report | boolean | Report the selected posts to board staff.
global_report | boolean | Report the selected posts to global staff.
report_reason | string | Reason for reporting, if report or global_report.
@ -1324,7 +1325,7 @@ name | string | Name
message | string | Message
subject | string | Subject
email | string | Email, or special values such as 'sage'.
postpassword | string | Password required to delete the post later.
postpassword | string | Post password lets users action posts e.g. delete, spoiler, remove files after posting. It's useful to let anonymous users manage their own posts without requiring an account. Users can set it manually, or if they have JavaScript enabled one is randomly generated and stored in localstorage. If the post password is left empty, the post can only be actioned by staff. Staff can also action any post without needing the post password. The ability for anonymous users to action their posts can be disabled on a per-board level.
file | file(s) | One or more files, multipart form data.
spoiler | array(string) | Array of sha256 hash of files to be spoilered.
spoiler_all | boolean | Whether to spoiler all files.
@ -1355,7 +1356,7 @@ delete | boolean | Delete the selected posts.
spoiler | boolean | Spoiler all files in the selected posts.
unlink_file | boolean | Unlink files from the selected posts. If there are other copies of the file in other posts, or the global settings do not immediately prune unlinked files, the file may remain on disk.
delete_file | boolean | Forcefully delete files from the selected posts, ignoring other references or server settings for delayed file pruning.
postpassword | string | Password for anonymous users, the same one used to create the posts.
postpassword | string | Post password lets users action posts e.g. delete, spoiler, remove files after posting. It's useful to let anonymous users manage their own posts without requiring an account. Users can set it manually, or if they have JavaScript enabled one is randomly generated and stored in localstorage. If the post password is left empty, the post can only be actioned by staff. Staff can also action any post without needing the post password. The ability for anonymous users to action their posts can be disabled on a per-board level.
report | boolean | Report the selected posts to board staff.
global_report | boolean | Report the selected posts to global staff.
report_reason | string | Reason for reporting, if report or global_report.
@ -1442,6 +1443,12 @@ Returns a list of the most recent posts made on a specific board.
`GET https://fatchan.org/{board}/manage/recent.json`
### URL Parameters
Parameter | Type | Description
--------- | ------- | -----------
board | string | The board to fetch recent posts from.
### Query Parameters
Parameter | Default | Description
@ -1790,6 +1797,38 @@ Filters used in conjunction will AND together. That is, filter_unlited=true&filt
# Authentication
## Register
```shell
curl -v 'https://fatchan.org/forms/register' -X POST \
-H 'Referer: https://fatchan.org/registration.html' -H 'x-using-xhr: true' \
--data "username=admin" --data "password=hunter2" --data "passwordconfirm=hunter2" --data "captcha=abc123"
# if the account is created successfully, 302 redirect to login.
...
< HTTP/2 302
< location: /login.html
...
```
Registers a new account.
### HTTP Request
`POST https://fatchan.org/forms/register`
### Parameters
Parameter | Type | Description
--------- | ---- | -----------
username | string | Account username
password | string | Account password
passwordconfirm | string | Account password repeated
captcha | array(number) or string | See <a href='#captcha-block-bypass'>Captcha/block bypass</a>
nonce | string | Optional, for web3 registration: the nonce fetched from the nonce endpoint
address | string | Optional, for web3 registration: eth address
signature | string | Optional, for web3 registration: web3 signature output of signing the nonce
## Login
```shell
@ -1825,6 +1864,9 @@ Parameter | Type | Description
--------- | ---- | -----------
username | string | Account username
password | string | Account password
nonce | string | Optional, for web3 login: the nonce fetched from the nonce endpoint
address | string | Optional, for web3 login: eth address
signature | string | Optional, for web3 login: web3 signature output of signing the nonce
## Logout
@ -1879,6 +1921,31 @@ curl -v 'https://fatchan.org/captcha'
...
```
## Web3 Nonce
```shell
curl -v 'https://fatchan.org/nonce/{address}.json' -X POST \
-H 'Referer: https://fatchan.org/login.html' \
# Returns json with the nonce
...
< HTTP/2 200 OK
...
< {"nonce":"diPRlfjSVQs78DGE3YKcENb4pgRqB1Bdlv3RH/yiE6Y="}
...
Fetches a nonce used as part of the web3 login process.
### HTTP Request
`GET https://fatchan.org/nonce/{address}.json`
### URL Parameters
Parameter | Type | Description
--------- | ---- | -----------
address | string | Ethereum address e.g. 0x68b637f227953eeb081a3b591c218adbeaa4c489
### Captcha cookie
To solve a captcha, you need a `captchaid` cookie.
@ -2070,7 +2137,7 @@ Other examples:
<%= image_tag "images/text-captcha-2.jpg" %> Solution: `3dhm6f`.
<%= image_tag "images/text-captcha-3.jpg" %> Solution: `lcvpyz`.
<%= image_tag "images/text-captcha-3.jpg" %> Solution: `lcvpya`.
<%= image_tag "images/text-captcha-4.jpg" %> Solution: `xnkosc`.
@ -2251,6 +2318,8 @@ postId | number | The post number, increasing by 1 for each post.
thread | number of null | For threads, null. For replies, a number equal to the `postId` of the thread.
email | string or null | The poster email. Not necessarily an email, can be any string or special values like "sage" meaning the post will not bump a thread.
spoiler | boolean | Whether all files in a post are spoilered.
signature | string or null | Web3 eth personal_sign signature of signed message content.
address | string or null | Recovered ethereum address from web3 signature.
banmessage | string or null | The public ban message attached to a post, optionally set when a staff member bans the poster without deleting the post.
userId | string or null | The user ID which is a substring of a hash of poster IP + server side per-thread secret e.g. substring(hash(poster IP + thread secret)).
files | array(<a href='#file'>File</a>) | Array of files, explained in the File subsection

Loading…
Cancel
Save