Small fixes

This commit is contained in:
Reckless_Satoshi 2023-05-01 10:24:48 -07:00
parent f6f6a9244c
commit a1f0a85646
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
6 changed files with 35 additions and 20 deletions

View File

@ -20,20 +20,20 @@ from . import verrpc_pb2 as verrpc
from . import verrpc_pb2_grpc as verrpcstub
#######
# Works with LND (c-lightning in the future for multi-vendor resiliance)
# Works with LND (c-lightning in the future for multi-vendor resilience)
#######
# Read tls.cert from file or .env variable string encoded as base64
try:
CERT = open(os.path.join(config("LND_DIR"), "tls.cert"), "rb").read()
with open(os.path.join(config("LND_DIR"), "tls.cert"), "rb") as f:
CERT = f.read()
except Exception:
CERT = b64decode(config("LND_CERT_BASE64"))
# Read macaroon from file or .env variable string encoded as base64
try:
MACAROON = open(
os.path.join(config("LND_DIR"), config("MACAROON_path")), "rb"
).read()
with open(os.path.join(config("LND_DIR"), config("MACAROON_path")), "rb") as f:
MACAROON = f.read()
except Exception:
MACAROON = b64decode(config("LND_MACAROON_BASE64"))

View File

@ -7,7 +7,8 @@ from django.utils import timezone
class Currency(models.Model):
currency_dict = json.load(open("frontend/static/assets/currencies.json"))
with open("frontend/static/assets/currencies.json") as f:
currency_dict = json.load(f)
currency_choices = [(int(val), label) for val, label in list(currency_dict.items())]
currency = models.PositiveSmallIntegerField(

View File

@ -35,7 +35,7 @@ services:
- .:/usr/src/robosats
- ./node/lnd:/lnd
network_mode: service:tor
command: python3 -Wa -u manage.py runserver 0.0.0.0:8000
command: python3 -u manage.py runserver 0.0.0.0:8000
frontend:
build: ./frontend

View File

@ -105,7 +105,7 @@ const RobotAvatar: React.FC<Props> = ({
border: '0.3px solid #55555',
filter: 'dropShadow(0.5px 0.5px 0.5px #000000)',
...imageStyle,
onLoad: setTimeout(() => setActiveBackground(false), 300),
onLoad: setTimeout(() => setActiveBackground(false), 1000),
}}
/>
</div>

View File

@ -2,6 +2,7 @@ import os
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from decouple import config
from django.core.asgi import get_asgi_application
import chat.routing
@ -11,14 +12,15 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "robosats.settings")
# is populated before importing code that may import ORM models.
django_asgi_app = get_asgi_application()
application = ProtocolTypeRouter(
{
"http": django_asgi_app,
"websocket": AuthMiddlewareStack(
URLRouter(
chat.routing.websocket_urlpatterns,
# TODO add api.routing.websocket_urlpatterns when Order page works with websocket
)
),
}
protocols = {}
protocols["websocket"] = AuthMiddlewareStack(
URLRouter(
chat.routing.websocket_urlpatterns,
# add api.routing.websocket_urlpatterns when Order page works with websocket
)
)
if config("DEVELOPMENT", default=False):
protocols["http"] = django_asgi_app
application = ProtocolTypeRouter(protocols)

View File

@ -36,7 +36,7 @@ STATIC_ROOT = "/usr/src/static/"
# SECURITY WARNING: don't run with debug turned on in production!
if os.environ.get("DEVELOPMENT"):
if config("DEVELOPMENT", default=False):
DEBUG = True
STATIC_ROOT = "frontend/static/"
@ -53,7 +53,19 @@ ALLOWED_HOSTS = [
]
CORS_ALLOW_ALL_ORIGINS = True
CSRF_TRUSTED_ORIGINS = ["http://*", "https://*"]
CSRF_TRUSTED_ORIGINS = [
f'http://{config("HOST_NAME")}',
f'http://{config("HOST_NAME2")}',
f'http://{config("I2P_ALIAS")}',
f'http://{config("I2P_LONG")}',
f'http://{config("LOCAL_ALIAS")}',
"http://localhost",
"http://*.onion",
"http://*",
"https://*.com",
"https://*",
]
# Allows Session Cookie to be read by Javascript on Client side.
SESSION_COOKIE_HTTPONLY = False