mirror of
https://github.com/NovaOSS/nova-web.git
synced 2024-11-25 18:23:58 +01:00
Added docs
This commit is contained in:
parent
9ebba26b0b
commit
b068225c72
27
README.md
27
README.md
|
@ -1,2 +1,29 @@
|
||||||
# nova-web
|
# nova-web
|
||||||
🌐 [Website](https://nova-oss.com) of project Nova.
|
🌐 [Website](https://nova-oss.com) of project Nova.
|
||||||
|
|
||||||
|
## Set up your `.env` file
|
||||||
|
|
||||||
|
```bash
|
||||||
|
CORE_API_URL="Used for accessing the database from nova-api. Usually, it's http://localhost:2333 (and :2332 for testing)."
|
||||||
|
CORE_API_KEY="The CORE_API_KEY set in the .env of nova-api."
|
||||||
|
CONTACT_EMAIL="The E-Mail address displayed on the website. Used for accessing databases."
|
||||||
|
TOS_VERIFICATION_KEY="Generate a password without special symbols and put it in here. Used in nova-cord."
|
||||||
|
DISCORD_CLIENT_ID="For 'auth using Discord' in the account dashboard. Get this from the Discord developer portal"
|
||||||
|
DISCORD_CLIENT_SECRET="For 'auth using Discord' in the account dashboard. Get this from the Discord developer portal"
|
||||||
|
FLASK_SECRET_KEY="Generate a password without special symbols and put it in here. It is used to encrypt the session cookie etc."
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running
|
||||||
|
### Production
|
||||||
|
```bash
|
||||||
|
sh screen.sh
|
||||||
|
````
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
python web
|
||||||
|
```
|
||||||
|
|
||||||
|
### Development
|
||||||
|
```bash
|
||||||
|
python web/app.py
|
||||||
|
````
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import flask
|
import flask
|
||||||
import requests
|
import requests
|
||||||
import functools
|
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from requests_oauthlib import OAuth2Session
|
from requests_oauthlib import OAuth2Session
|
||||||
|
|
|
@ -26,7 +26,7 @@ def create_app() -> flask.Flask:
|
||||||
account.register(app)
|
account.register(app)
|
||||||
finances.register(app)
|
finances.register(app)
|
||||||
|
|
||||||
# max 100 MB
|
# max file size 100 MB (cloudflare limit)
|
||||||
app.config['MAX_CONTENT_LENGTH'] = 100 * 1024 * 1024
|
app.config['MAX_CONTENT_LENGTH'] = 100 * 1024 * 1024
|
||||||
|
|
||||||
@app.context_processor
|
@app.context_processor
|
||||||
|
|
|
@ -13,20 +13,24 @@ load_dotenv()
|
||||||
# cache get_finances() for 5 minutes
|
# cache get_finances() for 5 minutes
|
||||||
|
|
||||||
def get_finances():
|
def get_finances():
|
||||||
return requests.get(
|
res = requests.get(
|
||||||
url=f'{os.environ["CORE_API_URL"]}/finances',
|
url=f'{os.environ["CORE_API_URL"]}/finances',
|
||||||
headers={
|
headers={
|
||||||
'Authorization': f'{os.environ["CORE_API_KEY"]}'
|
'Authorization': f'{os.environ["CORE_API_KEY"]}'
|
||||||
},
|
},
|
||||||
timeout=5
|
timeout=5
|
||||||
).json()
|
)
|
||||||
|
res.raise_for_status()
|
||||||
|
|
||||||
|
return res.json()
|
||||||
|
|
||||||
def register(app):
|
def register(app):
|
||||||
@app.route('/finances')
|
@app.route('/finances')
|
||||||
def finances_view():
|
def finances_view():
|
||||||
try:
|
try:
|
||||||
data = get_finances()
|
data = get_finances()
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
|
print(exc)
|
||||||
return flask.Response('Error fetching finances from database. This might be cause the data is still being processed. Please allow up to a few minutes.', status=500)
|
return flask.Response('Error fetching finances from database. This might be cause the data is still being processed. Please allow up to a few minutes.', status=500)
|
||||||
|
|
||||||
donations = data['donations']
|
donations = data['donations']
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<a href="https://discord.nova-oss.com" target="_blank">
|
<a href="https://discord.nova-oss.com" target="_blank">
|
||||||
<button class="special">
|
<button class="special">
|
||||||
<i class="bi bi-discord"></i>
|
<i class="bi bi-discord"></i>
|
||||||
Join 5,000+ members
|
Join 6,000+ members
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<!-- <a href="https://chat.nova-oss.com" target="_blank">
|
<!-- <a href="https://chat.nova-oss.com" target="_blank">
|
||||||
|
|
Loading…
Reference in a new issue