feat: favicon
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# Stapler
|
||||
|
||||

|
||||
|
||||
```txt
|
||||
usage: stapler [-h] [--debug | --no-debug] [-d DATA_DIR] [--certificates | --no-certificates] [--certbot | --no-certbot] [--self-signed-path SELF_SIGNED_PATH] [--certbot-conf CERTBOT_CONF]
|
||||
[--certbot-www CERTBOT_WWW] [--host HOST] [-p PORT] [--https | --no-https] [-t TOKEN] [--max-size-bytes MAX_SIZE] [-b BIND]
|
||||
@@ -96,7 +98,7 @@ curl -X DELETE \
|
||||
- [x] create certificate on request
|
||||
- [x] certbot copy certificates for unique path
|
||||
- [x] better error page
|
||||
- [ ] add favicon.ico + special path
|
||||
- [x] add favicon.ico + special path
|
||||
- [ ] [http.server security](https://docs.python.org/3/library/http.server.html#http-server-security)
|
||||
- [ ] proper doc
|
||||
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
*
|
||||
!.gitignore
|
||||
!favicon.ico
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,19 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 200 200"
|
||||
width="200" height="200">
|
||||
<rect width="200" height="200" fill="url('#gradient')"></rect>
|
||||
<defs>
|
||||
<linearGradient id="gradient" gradientTransform="rotate(0 0.5 0.5)">
|
||||
<stop offset="0%" stop-color="#dee90b"></stop>
|
||||
<stop offset="100%" stop-color="#d9e241"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g>
|
||||
<g fill="#1b3855"
|
||||
transform="matrix(8.37138686131387,0,0,8.37138686131387,25.368069030107364,155.46141451870437)"
|
||||
stroke="#0e5278" stroke-width="0">
|
||||
<path
|
||||
d="M5.51-16.66L5.51-14.26L4.36-14.26L4.36 1.02L5.51 1.02L5.51 3.41L1.05 3.41L1.05-16.66L5.51-16.66ZM11.14-16.66L11.14-14.26L9.99-14.26L9.99 1.02L11.14 1.02L11.14 3.41L6.69 3.41L6.69-16.66L11.14-16.66ZM16.78-16.66L16.78-14.26L15.63-14.26L15.63 1.02L16.78 1.02L16.78 3.41L12.32 3.41L12.32-16.66L16.78-16.66Z">
|
||||
</path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
+4
-1
@@ -20,6 +20,7 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||
CERTBOT_CHALLENGE_PATH = "/.well-known/acme-challenge"
|
||||
PATH_REGEX = re.compile(r"^\/([\w-]+)\/")
|
||||
HOST_PART_REGEX = re.compile(r"^([a-zA-Z0-9]|[a-zA-Z0-9]*[a-zA-Z0-9][a-zA-Z0-9])$")
|
||||
AUTHORIZED_PATHS: typing.ClassVar[list[str]] = ["/favicon.ico"]
|
||||
|
||||
@typing.override
|
||||
def __init__(
|
||||
@@ -116,7 +117,9 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||
return self.certbot_www + path.removeprefix(self.CERTBOT_CHALLENGE_PATH)
|
||||
if (page := self.registry.get_from_host(self.__get_host())) is not None:
|
||||
path = f"/{page.path}" + path
|
||||
if self.__get_subpath(path) is None: # not a valid path
|
||||
if (
|
||||
path not in self.AUTHORIZED_PATHS and self.__get_subpath(path) is None
|
||||
): # not a valid path
|
||||
return ""
|
||||
if pathlib.Path(path).name.startswith("."): # hidden files
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user