-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
2,627 additions
and
4,150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# app.py | ||
from dash import Dash, html, dcc, Input, Output, State | ||
|
||
from layouts import front_page_1, mining_page_1 | ||
from urllib.parse import quote, unquote | ||
import dash_bootstrap_components as dbc | ||
from utils.api_reader import SigmaWalletReader, PriceReader | ||
from layouts.front_page_1 import setup_front_page_callbacks | ||
# from layouts.main_page import setup_main_page_callbacks | ||
from layouts.mining_page_1 import setup_mining_page_callbacks | ||
from flask_login import LoginManager, UserMixin, login_user | ||
from flask import Flask, request, session, redirect, url_for | ||
from flask_session import Session | ||
|
||
# Initialize Flask app | ||
server = Flask(__name__) | ||
server.config['SECRET_KEY'] = 'your_super_secret_key' # Change this to a random secret key | ||
server.config['SESSION_TYPE'] = 'filesystem' # Example: filesystem-based session storage | ||
Session(server) | ||
|
||
# Initialize Flask-Login | ||
login_manager = LoginManager() | ||
login_manager.init_app(server) | ||
|
||
# Mock user database (you will replace this with your actual user authentication mechanism) | ||
class User(UserMixin): | ||
pass | ||
|
||
@login_manager.user_loader | ||
def load_user(user_id): | ||
# Load user from database or other source | ||
user = User() | ||
user.id = user_id | ||
|
||
reader = SigmaWalletReader('../conf') | ||
reader.update_data() | ||
app = Dash(__name__, url_base_pathname='/', server=server, external_stylesheets=[dbc.themes.BOOTSTRAP], suppress_callback_exceptions=True) | ||
server = app.server | ||
app.layout = html.Div([ | ||
dcc.Location(id='url', refresh=False), | ||
html.Div(id='page-content') | ||
]) | ||
|
||
@app.callback(Output('page-content', 'children'), | ||
[Input('url', 'pathname')]) | ||
def display_page(pathname): | ||
if pathname and pathname != "/": | ||
# Decode the mining address from the URL | ||
mining_address = unquote(pathname.lstrip('/')) | ||
# Use the mining address to generate the page content | ||
# This is where you might call a function to get the layout based on the mining address | ||
return mining_page_1.get_layout(reader) | ||
else: | ||
return front_page_1.get_layout(reader) | ||
|
||
# Define callback to update page content or handle business logic | ||
@app.callback( | ||
Output('url', 'pathname'), | ||
Input('start-mining-button', 'n_clicks'), | ||
State('mining-address-input', 'value') | ||
) | ||
def navigate_to_main(n_clicks, value): | ||
if n_clicks and value: | ||
# Encode the user input to ensure it's safe for URL use | ||
safe_value = quote(value) | ||
# Redirect user to a dynamic path based on their input | ||
return f'/{safe_value}' | ||
# If there's no input or the button hasn't been clicked, stay on the current page | ||
return '/' | ||
|
||
setup_front_page_callbacks(app, reader) | ||
setup_mining_page_callbacks(app, reader) | ||
|
||
if __name__ == '__main__': | ||
app.run_server(debug=True, host='0.0.0.0', port=8050) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Date,Coins/Block,% from today,Block Left,Days,New Block,Daily Emissions,$ERG to maintain | ||
Today,30,,17470,24,4/7/2024,"21,600",@ $2.29 | ||
4/7/2024,27,10%,64800,90,7/6/2024,"19,440",$2.54 | ||
7/6/2024,24,20%,64800,90,10/4/2024,"17,280",$2.86 | ||
10/4/2024,21,30%,64800,90,1/2/2025,"15,120",$3.27 | ||
1/2/2025,18,40%,64800,90,4/2/2025,"12,960",$3.82 | ||
4/2/2025,15,50%,64800,90,7/1/2025,"10,800",$4.58 | ||
7/1/2025,12,60%,64800,90,9/29/2025,"8,640",$5.73 | ||
9/29/2025,9,70%,64800,90,12/28/2025,"6,480",$7.63 | ||
12/28/2025,6,80%,64800,90,3/28/2026,"4,320",$11.45 | ||
3/28/2026,3,90%,64800,,,"2,160",$22.90 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.