mirror of
https://github.com/NovaOSS/nova-web.git
synced 2024-11-29 10:13:58 +01:00
Compare commits
No commits in common. "1c48174d477f6c1f1c74fd031f49addb1252455d" and "f21e6109389a487e2ce6551bb9f96e57fd5c774f" have entirely different histories.
1c48174d47
...
f21e610938
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
||||||
!.gitkeep
|
!.gitkeep
|
||||||
imprint.html
|
|
||||||
data/
|
data/
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
|
|
|
@ -9,8 +9,6 @@ from dotenv import load_dotenv
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
# cache get_finances() for 5 minutes
|
|
||||||
|
|
||||||
def get_finances():
|
def get_finances():
|
||||||
return requests.get(
|
return requests.get(
|
||||||
url=f'{os.environ["CORE_API_URL"]}/finances',
|
url=f'{os.environ["CORE_API_URL"]}/finances',
|
||||||
|
@ -20,16 +18,12 @@ def get_finances():
|
||||||
timeout=5
|
timeout=5
|
||||||
).json()
|
).json()
|
||||||
|
|
||||||
|
|
||||||
def register(app):
|
def register(app):
|
||||||
@app.route('/finances')
|
@app.route('/finances')
|
||||||
def finances_view():
|
def finances_view():
|
||||||
try:
|
data = get_finances()
|
||||||
data = get_finances()
|
|
||||||
except Exception:
|
|
||||||
return flask.Response('Error fetching finances from database. This might be cause the data is still being processed. Sorry.', status=500)
|
|
||||||
|
|
||||||
finances = {
|
finances = {
|
||||||
'last_update': data['timestamp'],
|
|
||||||
'donations_total': round(sum([i['amount_usd'] for i in data['donations']])),
|
'donations_total': round(sum([i['amount_usd'] for i in data['donations']])),
|
||||||
'donations_num': len(data['donations']),
|
'donations_num': len(data['donations']),
|
||||||
'donations_avg': round(sum([i['amount_usd'] for i in data['donations']]) / len(data['donations']), 2),
|
'donations_avg': round(sum([i['amount_usd'] for i in data['donations']]) / len(data['donations']), 2),
|
||||||
|
@ -45,13 +39,8 @@ def register(app):
|
||||||
|
|
||||||
@app.route('/finances/json')
|
@app.route('/finances/json')
|
||||||
def finances_download():
|
def finances_download():
|
||||||
try:
|
|
||||||
data = get_finances()
|
|
||||||
except Exception:
|
|
||||||
return flask.Response('Error fetching finances from database. This might be cause the data is still being processed. Sorry.', status=500)
|
|
||||||
|
|
||||||
virtual_file = io.StringIO()
|
virtual_file = io.StringIO()
|
||||||
json.dump(data, virtual_file, indent=4)
|
json.dump(get_finances(), virtual_file, indent=4)
|
||||||
name = f'finances-{time.strftime("%Y-%m-%d")}.json'
|
name = f'finances-{time.strftime("%Y-%m-%d")}.json'
|
||||||
virtual_file.seek(0)
|
virtual_file.seek(0)
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,7 @@
|
||||||
<b>API credits: </b> {{ user.credits or 0 }}<br>
|
<b>API credits: </b> {{ user.credits or 0 }}<br>
|
||||||
<b>Secret API key (click to reveal): </b>
|
<b>Secret API key (click to reveal): </b>
|
||||||
<br>
|
<br>
|
||||||
<!-- <span class="secret">{{ user.api_key or '-' }}</span> -->
|
<span class="secret">{{ user.api_key or '-' }}</span>
|
||||||
<span class="secret">{{ "API key not shown for security reasons" or '-' }}</span>
|
|
||||||
<br>(Click again to copy)
|
<br>(Click again to copy)
|
||||||
<br>
|
<br>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -3,14 +3,7 @@
|
||||||
<main>
|
<main>
|
||||||
<h1>Our finances - transparency is key!</h1>
|
<h1>Our finances - transparency is key!</h1>
|
||||||
<p>
|
<p>
|
||||||
<b>Warning</b> - no guarantees can be made that this information is 100% accurate.
|
<b>Warning</b> - no guarantees can be made that this information is 100% accurate. Crypto currency prices are updated once every hour.
|
||||||
Crypto currency prices are being updated once every hour.
|
|
||||||
<br>
|
|
||||||
<b>As of: </b> <span id="lastUpdateDisplay">Loading...</span>
|
|
||||||
<script>
|
|
||||||
const unix_timestamp = {{ finances.last_update }};
|
|
||||||
lastUpdateDisplay.innerText = new Date(unix_timestamp * 1000).toLocaleString();
|
|
||||||
</script>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<a href="/finances/json" target="_blank">
|
<a href="/finances/json" target="_blank">
|
||||||
|
@ -22,18 +15,12 @@
|
||||||
|
|
||||||
<h2>Donations</h2>
|
<h2>Donations</h2>
|
||||||
|
|
||||||
<div class="featured__facts box"><p>
|
<div class="featured__facts box"><p>We have received <b>{{ finances.donations_num }} donations</b> so far.</p></div>
|
||||||
We have received <b>{{ finances.donations_num }} donations</b> so far,
|
<div class="featured__facts box"><p>From donations, we received a total of <b>{{ finances.donations_total }} USD</b>.</p></div>
|
||||||
totaling <b>{{ finances.donations_total }} USD</b>.
|
<div class="featured__facts box"><p>The average donation has an amount of <b>{{ finances.donations_avg }} USD</b>.
|
||||||
</p></div>
|
The largest donation is <b>{{ finances.donations_max }} USD</b>.</div>
|
||||||
<div class="featured__facts box"><p>
|
<div class="featured__facts box"><p>Most people donated in <b>{{ finances.most_used_donation_currency }}</b>.</p></div>
|
||||||
The average donation has an amount of <b>{{ finances.donations_avg }} USD</b>.
|
|
||||||
Most people used <b>{{ finances.most_used_donation_currency }}</b> to donate.
|
|
||||||
</p></div>
|
|
||||||
<div class="featured__facts box"><p>
|
|
||||||
The largest donation is <b>{{ finances.donations_max }} USD</b>.
|
|
||||||
</p></div>
|
|
||||||
|
|
||||||
<!-- <img src="{{ finances.donations_chart_url }} alt="Donations chart"> -->
|
<!-- <img src="{{ finances.donations_chart_url }} alt="Donations chart"> -->
|
||||||
|
|
||||||
<h2>Expenses</h2>
|
<h2>Expenses</h2>
|
||||||
|
|
|
@ -3,18 +3,18 @@
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<h1>Free Generative AI for <span class="special-gradient">Everyone</span></h1>
|
<h1>Free Generative AI for <span class="special-gradient">Everyone</span></h1>
|
||||||
<h3>Open source</h3>
|
<h3>Open source ・ no CC required</h3>
|
||||||
<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 3,800+ members
|
Join 3,400+ members
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<!-- <a href="/login">
|
<a href="/login">
|
||||||
<button class="secondary">
|
<button class="secondary">
|
||||||
Log in <mark>beta</mark>
|
Log in <mark>beta</mark>
|
||||||
</button>
|
</button>
|
||||||
</a> -->
|
</a>
|
||||||
<br>
|
<br>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
|
|
1
web/templates/legal/imprint.html
Normal file
1
web/templates/legal/imprint.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<meta http-equiv="REFRESH" content="0; url=https://youtu.be/dQw4w9WgXcQ">
|
Loading…
Reference in a new issue