Exemplo n.º 1
0
    def __init__(self, config, db = None):
        self.config = config

        if db == None:
            if self.config['main']['use-pg']:
                self.db = dbPGCalls(config)
            else:
                self.db = dbCalls(config)
        else:
            self.db = db

        self.tnc = tnCalls(config, self.db)
        self.verifier = verifier(config, self.db)

        if self.config['other']['etherscan-on']:
            self.otc = etherscanCalls(config, self.db)
        else:
            self.otc = otherCalls(config, self.db)
Exemplo n.º 2
0
security = HTTPBasic()
app.mount("/static", StaticFiles(directory="static"), name="static")
templates = Jinja2Templates(directory="templates")

with open('config.json') as json_file:
    config = json.load(json_file)

if config['main']['use-pg']:
    dbc = dbPGCalls(config)
else:
    dbc = dbCalls(config)

tnc = tnCalls(config, dbc)

if config['other']['etherscan-on']:
    otc = etherscanCalls(config, dbc)
else:
    otc = otherCalls(config, dbc)

checkit = verifier(config, dbc)


def get_current_username(
        credentials: HTTPBasicCredentials = Depends(security)):
    correct_username = secrets.compare_digest(credentials.username,
                                              config["main"]["admin-username"])
    correct_password = secrets.compare_digest(credentials.password,
                                              config["main"]["admin-password"])
    if not (correct_username and correct_password):
        print("ERROR: invalid logon details")
        raise HTTPException(
Exemplo n.º 3
0
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

security = HTTPBasic()
app.mount("/static", StaticFiles(directory="static"), name="static")
templates = Jinja2Templates(directory="templates")

with open('config.json') as json_file:
    config = json.load(json_file)

tnc = tnCalls(config)

if config['other']['etherscan-on']:
    otc = etherscanCalls(config)
else:
    otc = otherCalls(config)

if config['main']['use-pg']:
    dbc = dbPGCalls(config)
else:
    dbc = dbCalls(config)

checkit = verifier(config)


def get_current_username(
        credentials: HTTPBasicCredentials = Depends(security)):
    correct_username = secrets.compare_digest(credentials.username,
                                              config["main"]["admin-username"])