Skip to content

Commit

Permalink
Add new URL /cmd/commands as text
Browse files Browse the repository at this point in the history
  • Loading branch information
back-to committed Jun 17, 2022
1 parent 802852b commit 2ccd08b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions liveproxy/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from shutil import which
from socketserver import ThreadingMixIn
from time import time
from urllib.parse import unquote

ACCEPTABLE_ERRNO = (
errno.ECONNABORTED,
Expand Down Expand Up @@ -68,6 +69,12 @@ def do_GET(self):
log.error(f"invalid base64 URL: {err}")
self._headers(404, "text/html", connection="close")
return
elif self.path.startswith(("/cmd/")):
# http://127.0.0.1:53422/cmd/streamlink https://example best/
self.path = self.path[5:]
if self.path.endswith("/"):
self.path = self.path[:-1]
arglist = shlex.split(unquote(self.path))
else:
self._headers(404, "text/html", connection="close")
return
Expand Down

0 comments on commit 2ccd08b

Please sign in to comment.