mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Merge branch 'main' of https://codeberg.org/saint/pyfedi
This commit is contained in:
commit
c466534fa6
2 changed files with 6 additions and 3 deletions
|
@ -115,13 +115,16 @@ def send_activity(sender: User, host: str, content: str):
|
||||||
|
|
||||||
|
|
||||||
def post_to_activity(post: Post, community: Community):
|
def post_to_activity(post: Post, community: Community):
|
||||||
|
# local PieFed posts do not have a create or announce id
|
||||||
|
create_id = post.ap_create_id if post.ap_create_id else f"https://{current_app.config['SERVER_NAME']}/activities/create/{gibberish(15)}"
|
||||||
|
announce_id = post.ap_announce_id if post.ap_announce_id else f"https://{current_app.config['SERVER_NAME']}/activities/announce/{gibberish(15)}"
|
||||||
activity_data = {
|
activity_data = {
|
||||||
"actor": f"https://{current_app.config['SERVER_NAME']}/c/{community.name}",
|
"actor": f"https://{current_app.config['SERVER_NAME']}/c/{community.name}",
|
||||||
"to": [
|
"to": [
|
||||||
"https://www.w3.org/ns/activitystreams#Public"
|
"https://www.w3.org/ns/activitystreams#Public"
|
||||||
],
|
],
|
||||||
"object": {
|
"object": {
|
||||||
"id": f"https://{current_app.config['SERVER_NAME']}/activities/create/{post.ap_create_id}",
|
"id": create_id,
|
||||||
"actor": f"https://{current_app.config['SERVER_NAME']}/u/{post.author.user_name}",
|
"actor": f"https://{current_app.config['SERVER_NAME']}/u/{post.author.user_name}",
|
||||||
"to": [
|
"to": [
|
||||||
"https://www.w3.org/ns/activitystreams#Public"
|
"https://www.w3.org/ns/activitystreams#Public"
|
||||||
|
@ -159,7 +162,7 @@ def post_to_activity(post: Post, community: Community):
|
||||||
f"https://{current_app.config['SERVER_NAME']}/c/{community.name}/followers"
|
f"https://{current_app.config['SERVER_NAME']}/c/{community.name}/followers"
|
||||||
],
|
],
|
||||||
"type": "Announce",
|
"type": "Announce",
|
||||||
"id": f"https://{current_app.config['SERVER_NAME']}/activities/announce/{post.ap_announce_id}"
|
"id": announce_id
|
||||||
}
|
}
|
||||||
if post.edited_at is not None:
|
if post.edited_at is not None:
|
||||||
activity_data["object"]["object"]["updated"] = ap_datetime(post.edited_at)
|
activity_data["object"]["object"]["updated"] = ap_datetime(post.edited_at)
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Config(object):
|
||||||
RECAPTCHA_PRIVATE_KEY = os.environ.get("RECAPTCHA_PRIVATE_KEY")
|
RECAPTCHA_PRIVATE_KEY = os.environ.get("RECAPTCHA_PRIVATE_KEY")
|
||||||
MODE = os.environ.get('MODE') or 'development'
|
MODE = os.environ.get('MODE') or 'development'
|
||||||
LANGUAGES = ['en']
|
LANGUAGES = ['en']
|
||||||
FULL_AP_CONTEXT = os.environ.get('FULL_AP_CONTEXT') is not None
|
FULL_AP_CONTEXT = bool(int(os.environ.get('FULL_AP_CONTEXT', 0)))
|
||||||
CACHE_TYPE = os.environ.get('CACHE_TYPE') or 'FileSystemCache'
|
CACHE_TYPE = os.environ.get('CACHE_TYPE') or 'FileSystemCache'
|
||||||
CACHE_REDIS_URL = os.environ.get('CACHE_REDIS_URL') or 'redis://localhost:6379/1'
|
CACHE_REDIS_URL = os.environ.get('CACHE_REDIS_URL') or 'redis://localhost:6379/1'
|
||||||
CACHE_DIR = os.environ.get('CACHE_DIR') or '/dev/shm/pyfedi'
|
CACHE_DIR = os.environ.get('CACHE_DIR') or '/dev/shm/pyfedi'
|
||||||
|
|
Loading…
Add table
Reference in a new issue