chore: small fixes and updates

- formatting
- small fix in a bitcoind model
- update the fake blitz scripts
- remove some dead code (app status sub)
This commit is contained in:
fusion44 2025-04-01 20:51:57 +02:00 committed by fusion44
parent 4e038e8fc7
commit 824fa62c4d
12 changed files with 14 additions and 39 deletions

View file

@ -39,7 +39,7 @@ This software is still considered BETA and may contain bugs. Don't expose it to
Create a `.env` file with your `bitcoind` and `lnd` configuration. See the `.env_sample` file for all configuration options.
The `.env` file is expected to be at the project root folder by default.
To use a custom path, set the `BAPI_ENV_PATH` env variable to the `.env` file path.
To use a custom path, set the `BAPI_ENV_PATH` env variable to the `.env` file path.
### Dependencies

View file

@ -17,7 +17,7 @@ def config(
option: str,
default: Any | Undefined = Undefined(),
cast: Any | Undefined = Undefined(),
):
) -> Any:
if _config is None:
_setup_config()
logger.trace("Configuration was not initialized => calling setup_config()")

View file

@ -18,10 +18,6 @@ class AppsBase:
async def get_app_status_advanced(self, app_id: str) -> Result[AppStatus, Report]:
raise NotImplementedError()
@abstractmethod
async def get_app_status_sub(self):
raise NotImplementedError()
@abstractmethod
async def install_app_sub(self, app_id: str):
raise NotImplementedError()

View file

@ -24,9 +24,6 @@ class NativePythonApps(AppsBase):
async def get_app_status_advanced(self, app_id: str) -> Result[AppStatus, Report]:
raise _NotImplemented()
async def get_app_status_sub(self):
raise _NotImplemented()
async def install_app_sub(self, app_id: str):
raise _NotImplemented()

View file

@ -250,25 +250,6 @@ class RaspiBlitzApps(AppsBase):
)
)
async def get_app_status_sub(self):
switch = True
while True:
status = "online" if switch else "offline"
app_list = [
# Specter is deactivated for now because it uses its own self signed
# HTTPS cert that makes trouble in Chrome on last test
# also see: app/constants.py where specter is deactivated
# {"id": "specter", "name": "Specter Desktop", "status": status},
{"id": "sphinx", "name": "Sphinx Chat", "status": status},
{"id": "btc-pay", "name": "BTCPay Server", "status": status},
{"id": "rtl", "name": "Ride the Lightning", "status": status},
{"id": "bos", "name": "Balance of Satoshis", "status": status},
]
i = random.randint(1, len(app_list))
yield json.dumps(app_list[i - 1])
await asyncio.sleep(4)
switch = not switch
async def install_app_sub(self, app_id: str):
if app_id not in available_app_ids:
raise HTTPException(

View file

@ -5,8 +5,6 @@ from typing import List, Optional, Union
from fastapi import Query
from pydantic.main import BaseModel
from loguru import logger
class FeeEstimationMode(str, Enum):
CONSERVATIVE = "conservative"
@ -157,7 +155,7 @@ class NetworkInfo(BaseModel):
local_addresses: List[BtcLocalAddress] = Query(
[], description="List of local addresses"
)
warnings: List[str] = Query(None, description="Any network and blockchain warnings")
warnings: str = Query("", description="Any network and blockchain warnings")
@classmethod
def from_rpc(cls, r):
@ -177,7 +175,7 @@ class NetworkInfo(BaseModel):
relay_fee=r["relayfee"],
incremental_fee=r["incrementalfee"],
local_addresses=[BtcLocalAddress.from_rpc(n) for n in r["localaddresses"]],
warnings=r["warnings"],
warnings="" if "warnings" not in r else str(r["warnings"]),
)
@ -371,7 +369,7 @@ class BlockchainInfo(BaseModel):
"enabled)"
),
)
warnings: List[str] = Query(..., description="Any network and blockchain warnings")
warnings: str = Query("", description="Any network and blockchain warnings")
softforks: List[SoftFork] = Query(..., description="Status of softforks")
@classmethod
@ -401,7 +399,7 @@ class BlockchainInfo(BaseModel):
prune_target_size=(
None if "prune_target_size" not in r else int(r["prune_target_size"])
),
warnings=r["warnings"],
warnings="" if "warnings" not in r else str(r["warnings"]),
softforks=softforks,
)

View file

@ -5,7 +5,6 @@ from app.api.config import config
import click # isort:skip
@click.command()
@click.option("--port", default="5000", help="Port to run Blitz API on")
@click.option("--host", default="127.0.0.1", help="Host to run Blitz API on")

View file

@ -8,7 +8,7 @@ if [ "$1" = "status" ]; then
sleep 2s
echo "appID='albyhub'"
echo "version='${VERSION}'"
echo "installed=1"
echo "installed=0"
echo "localIP='192.168.1.18'"
echo "toraddress='toraddress'"
echo "fingerprint='fingerprint'"

View file

@ -8,7 +8,7 @@ REPO=joinmarket-webui/jam
if [ "$1" = "status" ]; then
sleep 2s
echo "version='${WEBUI_VERSION}'"
echo "installed='1'"
echo "installed='0'"
echo "localIP='192.168.1.18'"
echo "httpPort='7500'"
echo "httpsPort='7501'"

View file

@ -8,7 +8,7 @@ VERSION="${tag}"
if [ "$1" = "status" ]; then
sleep 2s
echo "version='${VERSION}'"
echo "installed=1"
echo "installed=0"
echo "localIP='192.168.1.18'"
echo "httpPort='5000'"
echo "httpsPort='5001'"

View file

@ -4,6 +4,10 @@
RTLVERSION="v0.15.2"
if [ "$1" = "status" ]; then
sleep 2s
# raise a fake error
echo "result='FAKE ERROR FOR TESTING'" >&2
exit 1
# get LNTYPE and CHAIN parameters
LNTYPE="$2" # lnd or cl

View file

@ -72,7 +72,7 @@ fi
# Needs sshpass installed
echo "# syncing local code to: ${remote}"
sshpass -p "$passwordA" rsync -rvz --exclude .git/ -e "ssh -p ${sshPort}" $local $remote
sshpass -p "$passwordA" rsync -rvz --exclude .venv/ --exclude test_env_data/ --exclude .git/ -e "ssh -p ${sshPort}" $local $remote
result=$?
echo "result(${result})"
if [ "$result" != "0" ]; then