From 38fcf574249e3a39a404061be5d2bd64021cc54a Mon Sep 17 00:00:00 2001 From: kxtzownsu Date: Fri, 7 Mar 2025 06:55:22 +0000 Subject: [PATCH] shutup --- server.py | 9 ++++----- start_server.sh | 10 ++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/server.py b/server.py index e0ca209..cf9c3f8 100644 --- a/server.py +++ b/server.py @@ -6,12 +6,10 @@ import socket from urllib import parse class A(BaseHTTPRequestHandler): def do_POST(self): - - dat = self.rfile.read(int(self.headers.get('Content-Length'))) dmr = device_management_pb2.DeviceManagementRequest() dmr.ParseFromString(dat) - print(dmr) + # print(dmr) if (dmr.HasField('device_state_retrieval_request')): # Expecting a device state response print("intercepting") @@ -44,11 +42,12 @@ class A(BaseHTTPRequestHandler): self.end_headers() dmr = device_management_pb2.DeviceManagementResponse() dmr.ParseFromString(con.content) - print(dmr) + # print(dmr) self.wfile.write(dmr.SerializeToString()) # self.wfile.close() -print("Starting internal server!") + +print("Starting dmbackend!") hs = HTTPServer(("0.0.0.0", 3040), A,bind_and_activate=False) hs.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True) hs.server_bind() diff --git a/start_server.sh b/start_server.sh index 6334de0..36c97d3 100644 --- a/start_server.sh +++ b/start_server.sh @@ -1,13 +1,11 @@ #!/bin/bash -echo "$@" -SCRIPTDIR=$(readlink -f "$(dirname "$0")") -pushd "${SCRIPTDIR}" || exit +SCRIPT_DIR=$(dirname "$0") +SCRIPT_DIR=${SCRIPT_DIR:-"."} if [ ! -e ".venv" ] then python3 -m venv .venv fi source .venv/bin/activate -pip3 install -r requirements.txt -python3 "$SCRIPTDIR"/server.py -popd || exit 0 +pip3 install -r requirements.txt &> /dev/null +python3 "$SCRIPT_DIR"/server.py