-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor project structure, integrate WebServer in HiddenEye
The refactoring includes hiddeneye_reborn/network/server.py and introducing functionalities for running a rudimentary web server. In addition, a new file, hiddeneye_reborn/public/index.html, has been created and its directory set as the web server's serving path in the main HiddenEye application file. The project version has been updated as part of these changes.
- Loading branch information
Showing
7 changed files
with
57 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# TODO Write DocString | ||
__version__ = "0.1.3" | ||
__version__ = "0.2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import os | ||
import http.server | ||
import socketserver | ||
from threading import Thread | ||
|
||
|
||
class WebServer: | ||
def __init__(self, port: int = 8080, host: str = "localhost"): | ||
self.port = port | ||
self.host = host | ||
self.server = None | ||
self.thread = None | ||
self.directory = None | ||
|
||
def start(self): | ||
if not self.server: | ||
os.chdir(self.directory) | ||
handler = http.server.SimpleHTTPRequestHandler | ||
self.server = socketserver.TCPServer((self.host, self.port), handler) | ||
self.thread = Thread(target=self.server.serve_forever) | ||
self.thread.start() | ||
else: | ||
print('Server already started') | ||
|
||
def stop(self): | ||
if self.server: | ||
self.server.shutdown() | ||
self.server = None | ||
self.thread = None | ||
else: | ||
print('No server to stop') | ||
|
||
def serve(self, directory: str): | ||
self.directory = directory | ||
self.start() |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang=""> | ||
<head> | ||
<title>Simple Web Server</title> | ||
</head> | ||
<body> | ||
<h1>Simple Web Server</h1> | ||
<p>This is a simple web server.</p> | ||
<!-- Adding additional content --> | ||
<h2>Additional content: </h2> | ||
<p>Welcome to our web page. It is designed to provide a simple and smooth experience.</p> | ||
<p>Feel free to explore and let us know if you need any assistance.</p> | ||
</body> | ||
</html> |
20 changes: 0 additions & 20 deletions
20
hiddeneye_reborn/templating/template_mirrors/github.txt.example
This file was deleted.
Oops, something went wrong.
Empty file.