enable ASYNC, DTZ, YTT and EM lints
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import argparse
|
||||
import datetime
|
||||
import os
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import timedelta
|
||||
from pathlib import Path
|
||||
|
||||
from cryptography import hazmat, x509
|
||||
@@ -29,8 +30,10 @@ def generate_certificate(private_key: rsa.RSAPrivateKey) -> bytes:
|
||||
.issuer_name(issuer)
|
||||
.public_key(private_key.public_key())
|
||||
.serial_number(x509.random_serial_number())
|
||||
.not_valid_before(datetime.utcnow())
|
||||
.not_valid_after(datetime.utcnow() + timedelta(days=365 * 20))
|
||||
.not_valid_before(datetime.datetime.now(tz=datetime.UTC))
|
||||
.not_valid_after(
|
||||
datetime.datetime.now(tz=datetime.UTC) + timedelta(days=365 * 20)
|
||||
)
|
||||
.add_extension(
|
||||
x509.SubjectAlternativeName([x509.DNSName("localhost")]),
|
||||
critical=False,
|
||||
|
||||
@@ -9,10 +9,9 @@ from .uri import parse_moonlight_uri
|
||||
|
||||
|
||||
def send_join_request(host: str, port: int, cert: str) -> bool:
|
||||
tries = 0
|
||||
max_tries = 3
|
||||
response = False
|
||||
for tries in range(max_tries):
|
||||
for _tries in range(max_tries):
|
||||
response = send_join_request_api(host, port)
|
||||
if response:
|
||||
return response
|
||||
|
||||
@@ -126,7 +126,8 @@ def add_app(
|
||||
def get_moonlight_certificate() -> str:
|
||||
config = load_state()
|
||||
if config is None:
|
||||
raise FileNotFoundError("Moonlight state file not found.")
|
||||
msg = "Moonlight state file not found."
|
||||
raise FileNotFoundError(msg)
|
||||
certificate = config.get("General", "certificate")
|
||||
certificate = convert_bytearray_to_string(certificate)
|
||||
return certificate
|
||||
|
||||
@@ -10,7 +10,8 @@ def parse_moonlight_uri(uri: str) -> (str, str):
|
||||
print(uri)
|
||||
parsed = urlparse(uri)
|
||||
if parsed.scheme != "moonlight":
|
||||
raise ValueError(f"Invalid moonlight URI: {uri}")
|
||||
msg = f"Invalid moonlight URI: {uri}"
|
||||
raise ValueError(msg)
|
||||
hostname = parsed.hostname
|
||||
port = parsed.port
|
||||
return (hostname, port)
|
||||
|
||||
@@ -29,8 +29,8 @@ def generate_certificate(private_key: rsa.RSAPrivateKey) -> bytes:
|
||||
.issuer_name(issuer)
|
||||
.public_key(private_key.public_key())
|
||||
.serial_number(61093384576940497812448570031200738505731293357)
|
||||
.not_valid_before(datetime.datetime(2024, 2, 27))
|
||||
.not_valid_after(datetime.datetime(2044, 2, 22))
|
||||
.not_valid_before(datetime.datetime(2024, 2, 27, tzinfo=datetime.UTC))
|
||||
.not_valid_after(datetime.datetime(2044, 2, 22, tzinfo=datetime.UTC))
|
||||
.add_extension(
|
||||
x509.SubjectAlternativeName([x509.DNSName("localhost")]),
|
||||
critical=False,
|
||||
|
||||
Reference in New Issue
Block a user