Modify GH actions to support mirror

This commit is contained in:
fosslinux 2025-01-13 19:47:27 +11:00
parent 7d50a224c6
commit ba89224641
2 changed files with 28 additions and 27 deletions

View file

@ -1,13 +1,22 @@
#!/usr/bin/env python3
"""
This creates a simple "mirror" from a directory
"""
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2025 fosslinux <fosslinux@aussies.space>
import http.server
import socketserver
class SimpleMirror(socketserver.TCPServer):
"""Simple HTTP mirror from a directory"""
def __init__(self, directory: str):
self.directory = directory
super().__init__(("localhost", 0), self._handler)
@property
def port(self):
"""Port the HTTP server of the mirror is running on"""
return self.server_address[1]
def _handler(self, *args, **kwargs):