~tsileo/microblog.pub-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
4 2

[PATCH 0/3] Non-root path & proxy hmac cleanup

Details
Message ID
<20221118053504.60584-1-doof@doof.net>
DKIM signature
missing
Download raw message
Misc cleanups following up on previous patches.

Kevin Wallace (3):
  Use BASE_URL when generating {proxied,resized}_image_url
  Add robots meta tags on pages in robots.txt
  Add return type to hmac_sha256

 app/actor.py                       | 5 +++--
 app/config.py                      | 2 +-
 app/templates/followers.html       | 1 +
 app/templates/following.html       | 1 +
 app/templates/login.html           | 3 +++
 app/templates/remote_follow.html   | 1 +
 app/templates/remote_interact.html | 1 +
 7 files changed, 11 insertions(+), 3 deletions(-)

-- 
2.35.1

[PATCH 1/3] Use BASE_URL when generating {proxied,resized}_image_url

Details
Message ID
<20221118053504.60584-2-doof@doof.net>
In-Reply-To
<20221118053504.60584-1-doof@doof.net> (view parent)
DKIM signature
missing
Download raw message
Patch: +3 -2
Necessary when running at a non-root path
---
 app/actor.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/app/actor.py b/app/actor.py
index ecf53f1..271b88b 100644
--- a/app/actor.py
+++ b/app/actor.py
@@ -12,6 +12,7 @@ from sqlalchemy.orm import joinedload

from app import activitypub as ap
from app import media
from app.config import BASE_URL
from app.database import AsyncSession
from app.utils.datetime import as_utc
from app.utils.datetime import now
@@ -111,14 +112,14 @@ class Actor:
        if self.icon_url:
            return media.proxied_media_url(self.icon_url)
        else:
            return "/static/nopic.png"
            return BASE_URL + "/static/nopic.png"

    @property
    def resized_icon_url(self) -> str:
        if self.icon_url:
            return media.resized_media_url(self.icon_url, 50)
        else:
            return "/static/nopic.png"
            return BASE_URL + "/static/nopic.png"

    @property
    def tags(self) -> list[ap.RawObject]:
-- 
2.35.1

[PATCH 2/3] Add robots meta tags on pages in robots.txt

Details
Message ID
<20221118053504.60584-3-doof@doof.net>
In-Reply-To
<20221118053504.60584-1-doof@doof.net> (view parent)
DKIM signature
missing
Download raw message
Patch: +7 -0
Useful when app is at a non-root path and we're not handling top-level
/robots.txt requests.
---
 app/templates/followers.html       | 1 +
 app/templates/following.html       | 1 +
 app/templates/login.html           | 3 +++
 app/templates/remote_follow.html   | 1 +
 app/templates/remote_interact.html | 1 +
 5 files changed, 7 insertions(+)

diff --git a/app/templates/followers.html b/app/templates/followers.html
index a5df2bb..dabd049 100644
--- a/app/templates/followers.html
+++ b/app/templates/followers.html
@@ -3,6 +3,7 @@

{% block head %}
<title>{{ local_actor.display_name }}'s followers</title>
<meta name="robots" content="noindex, nofollow">
{% endblock %}

{% block content %}
diff --git a/app/templates/following.html b/app/templates/following.html
index b8db603..3341725 100644
--- a/app/templates/following.html
+++ b/app/templates/following.html
@@ -3,6 +3,7 @@

{% block head %}
<title>{{ local_actor.display_name }}'s follows</title>
<meta name="robots" content="noindex, nofollow">
{% endblock %}

{% block content %}
diff --git a/app/templates/login.html b/app/templates/login.html
index bc0512d..8f3940a 100644
--- a/app/templates/login.html
+++ b/app/templates/login.html
@@ -1,5 +1,8 @@
{%- import "utils.html" as utils with context -%}
{% extends "layout.html" %}
{% block head %}
<meta name="robots" content="noindex, nofollow">
{% endblock %}
{% block main_tag %} class="main-flex"{% endblock %}
{% block content %}
<div class="centered">
diff --git a/app/templates/remote_follow.html b/app/templates/remote_follow.html
index bfe5ecc..ed25be0 100644
--- a/app/templates/remote_follow.html
+++ b/app/templates/remote_follow.html
@@ -3,6 +3,7 @@

{% block head %}
<title>Remote follow {{ local_actor.display_name }}</title>
<meta name="robots" content="noindex, nofollow">
{% endblock %}

{% block content %}
diff --git a/app/templates/remote_interact.html b/app/templates/remote_interact.html
index 517fb0b..0fbfe26 100644
--- a/app/templates/remote_interact.html
+++ b/app/templates/remote_interact.html
@@ -3,6 +3,7 @@

{% block head %}
<title>Interact from your instance</title>
<meta name="robots" content="noindex, nofollow">
{% endblock %}

{% block content %}
-- 
2.35.1

[PATCH 3/3] Add return type to hmac_sha256

Details
Message ID
<20221118053504.60584-4-doof@doof.net>
In-Reply-To
<20221118053504.60584-1-doof@doof.net> (view parent)
DKIM signature
missing
Download raw message
Patch: +1 -1
---
 app/config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/config.py b/app/config.py
index 14bb913..0dc868a 100644
--- a/app/config.py
+++ b/app/config.py
@@ -257,5 +257,5 @@ def verify_csrf_token(
    return None


def hmac_sha256():
def hmac_sha256() -> hmac.HMAC:
    return hmac.new(CONFIG.secret.encode(), digestmod=hashlib.sha256)
-- 
2.35.1
Details
Message ID
<8549a987-2ce4-4817-a4a6-9e5c7a2adcbb@app.fastmail.com>
In-Reply-To
<20221118053504.60584-1-doof@doof.net> (view parent)
DKIM signature
missing
Download raw message
Hey,

I just applied the patches.

Thanks!
Reply to thread Export thread (mbox)