mirror of
https://github.com/RoboSats/robosats.git
synced 2025-07-19 17:23:19 +00:00
Small fixes
This commit is contained in:
@ -20,20 +20,20 @@ from . import verrpc_pb2 as verrpc
|
|||||||
from . import verrpc_pb2_grpc as verrpcstub
|
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
|
# Read tls.cert from file or .env variable string encoded as base64
|
||||||
try:
|
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:
|
except Exception:
|
||||||
CERT = b64decode(config("LND_CERT_BASE64"))
|
CERT = b64decode(config("LND_CERT_BASE64"))
|
||||||
|
|
||||||
# Read macaroon from file or .env variable string encoded as base64
|
# Read macaroon from file or .env variable string encoded as base64
|
||||||
try:
|
try:
|
||||||
MACAROON = open(
|
with open(os.path.join(config("LND_DIR"), config("MACAROON_path")), "rb") as f:
|
||||||
os.path.join(config("LND_DIR"), config("MACAROON_path")), "rb"
|
MACAROON = f.read()
|
||||||
).read()
|
|
||||||
except Exception:
|
except Exception:
|
||||||
MACAROON = b64decode(config("LND_MACAROON_BASE64"))
|
MACAROON = b64decode(config("LND_MACAROON_BASE64"))
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@ from django.utils import timezone
|
|||||||
|
|
||||||
class Currency(models.Model):
|
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_choices = [(int(val), label) for val, label in list(currency_dict.items())]
|
||||||
|
|
||||||
currency = models.PositiveSmallIntegerField(
|
currency = models.PositiveSmallIntegerField(
|
||||||
|
@ -35,7 +35,7 @@ services:
|
|||||||
- .:/usr/src/robosats
|
- .:/usr/src/robosats
|
||||||
- ./node/lnd:/lnd
|
- ./node/lnd:/lnd
|
||||||
network_mode: service:tor
|
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:
|
frontend:
|
||||||
build: ./frontend
|
build: ./frontend
|
||||||
|
@ -105,7 +105,7 @@ const RobotAvatar: React.FC<Props> = ({
|
|||||||
border: '0.3px solid #55555',
|
border: '0.3px solid #55555',
|
||||||
filter: 'dropShadow(0.5px 0.5px 0.5px #000000)',
|
filter: 'dropShadow(0.5px 0.5px 0.5px #000000)',
|
||||||
...imageStyle,
|
...imageStyle,
|
||||||
onLoad: setTimeout(() => setActiveBackground(false), 300),
|
onLoad: setTimeout(() => setActiveBackground(false), 1000),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,6 +2,7 @@ import os
|
|||||||
|
|
||||||
from channels.auth import AuthMiddlewareStack
|
from channels.auth import AuthMiddlewareStack
|
||||||
from channels.routing import ProtocolTypeRouter, URLRouter
|
from channels.routing import ProtocolTypeRouter, URLRouter
|
||||||
|
from decouple import config
|
||||||
from django.core.asgi import get_asgi_application
|
from django.core.asgi import get_asgi_application
|
||||||
|
|
||||||
import chat.routing
|
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.
|
# is populated before importing code that may import ORM models.
|
||||||
django_asgi_app = get_asgi_application()
|
django_asgi_app = get_asgi_application()
|
||||||
|
|
||||||
application = ProtocolTypeRouter(
|
protocols = {}
|
||||||
{
|
protocols["websocket"] = AuthMiddlewareStack(
|
||||||
"http": django_asgi_app,
|
URLRouter(
|
||||||
"websocket": AuthMiddlewareStack(
|
chat.routing.websocket_urlpatterns,
|
||||||
URLRouter(
|
# add api.routing.websocket_urlpatterns when Order page works with websocket
|
||||||
chat.routing.websocket_urlpatterns,
|
)
|
||||||
# TODO add api.routing.websocket_urlpatterns when Order page works with websocket
|
|
||||||
)
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if config("DEVELOPMENT", default=False):
|
||||||
|
protocols["http"] = django_asgi_app
|
||||||
|
|
||||||
|
application = ProtocolTypeRouter(protocols)
|
||||||
|
@ -36,7 +36,7 @@ STATIC_ROOT = "/usr/src/static/"
|
|||||||
|
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
if os.environ.get("DEVELOPMENT"):
|
if config("DEVELOPMENT", default=False):
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
STATIC_ROOT = "frontend/static/"
|
STATIC_ROOT = "frontend/static/"
|
||||||
|
|
||||||
@ -53,7 +53,19 @@ ALLOWED_HOSTS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
CORS_ALLOW_ALL_ORIGINS = True
|
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.
|
# Allows Session Cookie to be read by Javascript on Client side.
|
||||||
SESSION_COOKIE_HTTPONLY = False
|
SESSION_COOKIE_HTTPONLY = False
|
||||||
|
Reference in New Issue
Block a user