Basic API doc, add discord logo back, add icynet git logo

This commit is contained in:
Evert Prants 2019-04-16 20:21:39 +03:00
parent 03f98849ee
commit 558e92f2af
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 255 additions and 0 deletions

120
API.md Normal file
View File

@ -0,0 +1,120 @@
# IcyNet.eu API Documentation
## `/oauth2`
OAuth 2.0 Authorization endpoints
### `GET /authorize` **+session**
OAuth 2.0 Authorization dialog.
The following query parameters are expected:
* `redirect_uri` - Client redirection URI, must match the redirection URI defined by client.
* `client_id` - Client redirection ID.
* `response_type` - Response type. Pretty much always `code`.
* `scope` *(optional)* - Request additional resources. Available scopes are: `privilege`, `email`, `image`.
* `state` *(optional)* - A forwarded token to prevent request forgery.
### `POST /token`
Get an Access Token from `code`.
The following must be passed in the request body:
* `grant_type` - One of `authorization_code`, `client_credentials` or `refresh_token`.
* `scope` *(optional)* - See `/authorize`.
Successful response:
```
{
token_type: 'bearer',
access_token: <access token>,
[refresh_token: <refresh token>,]
expires_in: <seconds till token expiry>
}
```
A `Authorization: Basic base64(client_id:client_secret)` header must be present **OR** `client_id` and `client_secret` can also be passed in the request body. Both variants are supported by the API.
### `POST /introspect`
Check for the validity of an Access Token.
The following must be passed in the request body:
* `token` - The Access Token to introspect.
Successful response:
```
{
token_type: 'bearer',
token: <access token>,
expires_in: <seconds till token expiry>
}
```
Requires client authentication, see `POST /token`.
### `GET /user`
Get user information using an access token. Access token can be provided via querystring or header.
Successful response:
```
{
id: <user id>,
uuid: <user uuid>,
username: <user username>,
display_name: <user display_name>,
[email: <user email address>] (requires email scope),
[image: <URL to user's avatar file>] (requires image scope),
[privilege: <user privilege level>] (requires privilege scope)
}
```
## `/api`
Internal API endpoints.
### `/external`
Authentication callbacks.
### `GET /news`
Icy Network News.
#### `GET /news/:id`
Get a news article by it's ID.
#### `POST /news/edit/:id` **+session**
Edit a news article by it's ID. **Requires a special privileged user**
#### `GET /news/all/:page`
Get all news articles on `:page`.
### `POST /avatar` **+session**
Change the avatar of the currently logged in user.
#### `POST /remove` **+session**
Remove the avatar of the currently logged in user.
#### `POST /gravatar` **+session**
Set the avatar of the currently logged in user to their Gravatar avatar.
### `GET /avatar` **+session**
Get the avatar of the currently logged in user.
#### `GET /gravatar` **+session**
Get the Gravatar avatar of the currently logged in user, if applicable.
#### `GET /:id`
Get the avatar of the user with ID `:id`.
### `/oauth2`
Special OAuth 2.0 management endpoints.
#### `GET /authorized-clients` **+session**
Get the authorized OAuth 2.0 clients of the currently logged in user.
##### `POST /revoke` **+session**
Revoke an authorized OAuth 2.0 client. Requires `client_id` in the body.
### `GET /donations`
List the donations given to Icy Network.
#### `GET /user` **+session**
List the donations given to Icy Network by the currently logged in user.
### `POST /paypal/ipn`
PayPal Payment Notification endpoint.

1
static/image/discord.svg Normal file
View File

@ -0,0 +1 @@
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><style>.st0{fill:#FFFFFF;}</style><path class="st0" d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zM140.9 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="29.898235mm"
height="29.898235mm"
viewBox="0 0 29.898235 29.898235"
version="1.1"
id="svg8"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
sodipodi:docname="icynet-icon-git.svg"
inkscape:export-filename="/home/diamond/IcyNetwork/IcyNet.eu/static/image/icynet-icon-large.png"
inkscape:export-xdpi="460.05008"
inkscape:export-ydpi="460.05008">
<defs
id="defs2">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath877">
<rect
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#6fefff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="rect879"
width="24.856066"
height="24.856066"
x="2.5211489"
y="2.5227857"
transform="rotate(2.4309033e-4)" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.3312427"
inkscape:cx="28.418921"
inkscape:cy="80.641272"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1920"
inkscape:window-height="1021"
inkscape:window-x="0"
inkscape:window-y="31"
inkscape:window-maximized="1"
inkscape:object-paths="true"
inkscape:snap-intersection-paths="true"
inkscape:snap-smooth-nodes="false"
inkscape:object-nodes="true" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-1.2029979e-7,-0.00176382)">
<rect
transform="rotate(-3.5293181)"
y="3.4147503"
x="1.5723678"
height="24.856066"
width="24.856066"
id="rect1083"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#00a1b5;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;font-variant-east_asian:normal" />
<rect
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#00e1fd;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;font-variant-east_asian:normal"
id="rect815"
width="24.856066"
height="24.856066"
x="0.13787289"
y="4.5749965"
transform="rotate(-8.5307657)" />
<rect
transform="rotate(2.4309033e-4)"
y="2.5227857"
x="2.5211489"
height="24.856066"
width="24.856066"
id="rect817"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#6fefff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<path
style="fill:none;fill-opacity:1;stroke:#03a9f4;stroke-width:2.63730979;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 5.0038362,0.64767494 6.6339828,6.39015866 8.36023,8.3602304"
id="path827"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc"
clip-path="url(#clipPath877)" />
<path
style="fill:none;fill-opacity:1;stroke:#03a9f4;stroke-width:2.63730979;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 11.637819,7.0378336 V 22.098787"
id="path831"
inkscape:connector-curvature="0" />
<circle
style="fill:#03a9f4;fill-opacity:1;stroke:none;stroke-width:1.29379058;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path833"
cx="11.637817"
cy="7.0378332"
r="3.0074615" />
<path
style="opacity:1;vector-effect:none;fill:#03a9f4;fill-opacity:1;stroke:none;stroke-width:1.29379058;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 24.135889,16.54294 a 3.0074614,3.0074614 0 0 1 -3.007462,3.007461 3.0074614,3.0074614 0 0 1 -3.007461,-3.007461 3.0074614,3.0074614 0 0 1 3.007461,-3.007462 3.0074614,3.0074614 0 0 1 3.007462,3.007462 z"
id="path833-3"
inkscape:connector-curvature="0" />
<circle
style="fill:#03a9f4;fill-opacity:1;stroke:none;stroke-width:1.29379058;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path833-6"
cx="11.637819"
cy="22.204615"
r="3.0074615" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.9 KiB