Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8943a78dc | ||
|
|
118daf1e8c | ||
|
|
5b4cba44d0 |
@@ -130,3 +130,11 @@ docker-build: ## docker build
|
|||||||
.PHONY: docker-run
|
.PHONY: docker-run
|
||||||
docker-run: docker-build ## docker run
|
docker-run: docker-build ## docker run
|
||||||
@$(DOCKER) run -it -p $(PORT):80 -v ./data:/data $(DOCKER_TAG) --debug --no-certbot --no-https --host localhost:$(PORT) run
|
@$(DOCKER) run -it -p $(PORT):80 -v ./data:/data $(DOCKER_TAG) --debug --no-certbot --no-https --host localhost:$(PORT) run
|
||||||
|
|
||||||
|
.PHONY: release-%
|
||||||
|
release-%: .venv ## release major/minor/patch
|
||||||
|
$(UV) version --bump=$*
|
||||||
|
git add pyproject.toml uv.lock
|
||||||
|
git commit -m "chore: $$(uv version --short)"
|
||||||
|
git tag "release/$$(uv version --short)" -m "$$(uv version)"
|
||||||
|
$(UV) build
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "stapler"
|
name = "stapler"
|
||||||
version = "1.5.2"
|
version = "1.5.3"
|
||||||
description = "Static pages as simple as a gzip file"
|
description = "Static pages as simple as a gzip file"
|
||||||
requires-python = ">=3.14"
|
requires-python = ">=3.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ class DataDir:
|
|||||||
]
|
]
|
||||||
|
|
||||||
PATH_REGEX = re.compile(r"^[\w-]+$")
|
PATH_REGEX = re.compile(r"^[\w-]+$")
|
||||||
NEEDED_FILES: typing.ClassVar[list[str]] = ["favicon.ico", "robots.txt"]
|
NEEDED_FILES: typing.ClassVar[list[str]] = ["robots.txt"]
|
||||||
|
|
||||||
def __init__(self, root_path: str) -> None:
|
def __init__(self, root_path: str) -> None:
|
||||||
self.logger: logging.Logger = logging.getLogger(self.__class__.__name__)
|
self.logger: logging.Logger = logging.getLogger(self.__class__.__name__)
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
+1
-1
@@ -294,7 +294,7 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler, BaseHandler):
|
|||||||
UPDATE_PATH_REGEX = re.compile(r"^\/([\w-]+)\/?$")
|
UPDATE_PATH_REGEX = re.compile(r"^\/([\w-]+)\/?$")
|
||||||
GET_PATH_REGEX = re.compile(r"^\/([\w-]+)($|\/)")
|
GET_PATH_REGEX = re.compile(r"^\/([\w-]+)($|\/)")
|
||||||
HOST_PART_REGEX = re.compile(r"^([a-z0-9]|[a-z0-9][a-z0-9-]{,61}[a-z0-9])$")
|
HOST_PART_REGEX = re.compile(r"^([a-z0-9]|[a-z0-9][a-z0-9-]{,61}[a-z0-9])$")
|
||||||
AUTHORIZED_PATHS: typing.ClassVar[list[str]] = ["/favicon.ico", "/robots.txt"]
|
AUTHORIZED_PATHS: typing.ClassVar[list[str]] = ["/robots.txt"]
|
||||||
TOKEN_HEADER = "X-Token" # noqa: S105
|
TOKEN_HEADER = "X-Token" # noqa: S105
|
||||||
HOST_HEADER = "X-Host"
|
HOST_HEADER = "X-Host"
|
||||||
HOST_ONLY_HEADER = "X-Host-Only"
|
HOST_ONLY_HEADER = "X-Host-Only"
|
||||||
|
|||||||
@@ -1227,12 +1227,12 @@ class TestRequestHandler(BaseHandlerTestCase):
|
|||||||
with (
|
with (
|
||||||
self.patch_call(
|
self.patch_call(
|
||||||
"http.server.SimpleHTTPRequestHandler.translate_path",
|
"http.server.SimpleHTTPRequestHandler.translate_path",
|
||||||
["/favicon.ico"],
|
["/robots.txt"],
|
||||||
),
|
),
|
||||||
self.seal_mocks(),
|
self.seal_mocks(),
|
||||||
):
|
):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
handler.translate_path("/favicon.ico"),
|
handler.translate_path("/robots.txt"),
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1269,12 +1269,12 @@ class TestRequestHandler(BaseHandlerTestCase):
|
|||||||
self.mock_call(self.registry.get_from_host, ["example.com"], Page("path")),
|
self.mock_call(self.registry.get_from_host, ["example.com"], Page("path")),
|
||||||
self.patch_call(
|
self.patch_call(
|
||||||
"http.server.SimpleHTTPRequestHandler.translate_path",
|
"http.server.SimpleHTTPRequestHandler.translate_path",
|
||||||
["/favicon.ico"],
|
["/robots.txt"],
|
||||||
),
|
),
|
||||||
self.seal_mocks(),
|
self.seal_mocks(),
|
||||||
):
|
):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
handler.translate_path("/favicon.ico"),
|
handler.translate_path("/robots.txt"),
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user