From af87cc6cad714f3957be092fdfcec3776e544aca Mon Sep 17 00:00:00 2001 From: Matheus Date: Sat, 6 Jun 2020 22:42:57 -0300 Subject: [PATCH] 0.5 --- PandoraRun.py | 41 ++++++++++++++++++++++++++++++++++------- README.md | 16 +++++++++++++--- logo.txt | 9 +++++++++ 3 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 logo.txt diff --git a/PandoraRun.py b/PandoraRun.py index ef56afc..4e22ac5 100644 --- a/PandoraRun.py +++ b/PandoraRun.py @@ -1,11 +1,38 @@ +# +# _ __ ,---. .-._ _,.---._ ,---. +# .-`.' ,`..--.' \ /==/ \ .-._ _,..---._ ,-.' , - `. .-.,.---. .--.' \ +# /==/, - \==\-/\ \ |==|, \/ /, /==/, - \ /==/_, , - \ /==/ ` \ \==\-/\ \ +# |==| _ .=. /==/-|_\ | |==|- \| ||==| _ _\==| .=. |==|-, .=., |/==/-|_\ | +# |==| , '=',\==\, - \ |==| , | -||==| .=. |==|_ : ;=: - |==| '=' /\==\, - \ +# |==|- '..'/==/ - ,| |==| - _ ||==|,| | -|==| , '=' |==|- , .' /==/ - ,| +# |==|, | /==/- /\ - \|==| /\ , ||==| '=' /\==\ - ,_ /|==|_ . ,'./==/- /\ - \ +# /==/ - | \==\ _.\=\.-'/==/, | |- ||==|-, _`/ '.='. - .' /==/ /\ , )==\ _.\=\.-' +# `--`---' `--` `--`./ `--``-.`.____.' `--`--'' `--`-`--`--' `--` +# +# VERSION 0.5 +# +# DO NOT USE IT ON PRODUCTION +# + import http.server import socketserver -import ssl # For future implementation with Openssl +import socket +import ssl # For future implementation with Openssl + +PORT = 8080 # Define the standard port +HOST = 'localhost' # Define the standard host +Request = http.server.SimpleHTTPRequestHandler # Simple http request handler, it commits all files and directories within the SelfHost.py folder + +with socketserver.TCPServer((HOST, PORT), Request) as httpd: # ("host/ip address", desired port), call the resquests from files + + + print("Running @ ",HOST,':',PORT) # Simply outputs on terminal the port that the server is operating + httpd.serve_forever() # Method that simply begins listening and responding to incoming requests -PORT = 8080 # Define the standard port -IP = 'localhost' -Request = http.server.SimpleHTTPRequestHandler # Simple http request handler, it commits all files and directories within the SelfHost.py folder + while socketserver == True: + listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + listener.bind((HOST, PORT)) + listener.listen(1) + listener.sendall(httpd) -with socketserver.TCPServer((IP, PORT), Request) as httpd: # ("ip address", desired port), call the resquests from files - print("Running @ ",IP,':',PORT) # Simply outputs on terminal the port that the server is operating - httpd.serve_forever() # Method that simply begins listening and responding to incoming requests \ No newline at end of file diff --git a/README.md b/README.md index f77b535..5863d0b 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,23 @@ -### Pandora Selfhosted + _ __ ,---. .-._ _,.---._ ,---. + .-`.' ,`..--.' \ /==/ \ .-._ _,..---._ ,-.' , - `. .-.,.---. .--.' \ + /==/, - \==\-/\ \ |==|, \/ /, /==/, - \ /==/_, , - \ /==/ ` \ \==\-/\ \ +|==| _ .=. /==/-|_\ | |==|- \| ||==| _ _\==| .=. |==|-, .=., |/==/-|_\ | +|==| , '=',\==\, - \ |==| , | -||==| .=. |==|_ : ;=: - |==| '=' /\==\, - \ +|==|- '..'/==/ - ,| |==| - _ ||==|,| | -|==| , '=' |==|- , .' /==/ - ,| +|==|, | /==/- /\ - \|==| /\ , ||==| '=' /\==\ - ,_ /|==|_ . ,'./==/- /\ - \ +/==/ - | \==\ _.\=\.-'/==/, | |- ||==|-, _`/ '.='. - .' /==/ /\ , )==\ _.\=\.-' +`--`---' `--` `--`./ `--``-.`.____.' `--`--'' `--`-`--`--' `--` + +## Pandora Selfhosted This project was built with Python 3 and uses basic library to handle files within the Pandora folder, it can access it through localserver and via localhost too. The example files are made with Foundation and shows a very basic usage of the funcionality, and you can use it to learn HTML and CSS without worry about setup a specific server, it's usefull specially if you're still learning. * [Python](https://www.python.org/) * [Foundation](https://get.foundation/index.html) -## Getting Started +### Getting Started To run and use Pandora, you'll need Python 3 installed on your machine and a modern browser. @@ -23,6 +33,6 @@ py PandoraRun.py ``` -## License +### License Distributed under the MIT License. See `LICENSE` for more information. \ No newline at end of file diff --git a/logo.txt b/logo.txt new file mode 100644 index 0000000..4adbc70 --- /dev/null +++ b/logo.txt @@ -0,0 +1,9 @@ + _ __ ,---. .-._ _,.---._ ,---. + .-`.' ,`..--.' \ /==/ \ .-._ _,..---._ ,-.' , - `. .-.,.---. .--.' \ + /==/, - \==\-/\ \ |==|, \/ /, /==/, - \ /==/_, , - \ /==/ ` \ \==\-/\ \ +|==| _ .=. /==/-|_\ | |==|- \| ||==| _ _\==| .=. |==|-, .=., |/==/-|_\ | +|==| , '=',\==\, - \ |==| , | -||==| .=. |==|_ : ;=: - |==| '=' /\==\, - \ +|==|- '..'/==/ - ,| |==| - _ ||==|,| | -|==| , '=' |==|- , .' /==/ - ,| +|==|, | /==/- /\ - \|==| /\ , ||==| '=' /\==\ - ,_ /|==|_ . ,'./==/- /\ - \ +/==/ - | \==\ _.\=\.-'/==/, | |- ||==|-, _`/ '.='. - .' /==/ /\ , )==\ _.\=\.-' +`--`---' `--` `--`./ `--``-.`.____.' `--`--'' `--`-`--`--' `--` \ No newline at end of file