Browse Source

Outgoing media posts also go to the media timeline

merge-requests/21/head
Bob Mottram 2 months ago
parent
commit
2e552bb17c
3 changed files with 22 additions and 3 deletions
  1. 3
    1
      daemon.py
  2. 16
    1
      outbox.py
  3. 3
    1
      schedule.py

+ 3
- 1
daemon.py View File

@@ -1115,7 +1115,9 @@ class PubServer(BaseHTTPRequestHandler):
1115 1115
             print('Posting to nickname ' + postToNickname)
1116 1116
             self.postToNickname = postToNickname
1117 1117
 
1118
-        return postMessageToOutbox(messageJson, self.postToNickname,
1118
+        return postMessageToOutbox(self.server.session,
1119
+                                   self.server.translate,
1120
+                                   messageJson, self.postToNickname,
1119 1121
                                    self.server, self.server.baseDir,
1120 1122
                                    self.server.httpPrefix,
1121 1123
                                    self.server.domain,

+ 16
- 1
outbox.py View File

@@ -10,6 +10,7 @@ import os
10 10
 from shutil import copyfile
11 11
 from session import createSession
12 12
 from auth import createPassword
13
+from posts import isImageMedia
13 14
 from posts import outboxMessageCreateWrap
14 15
 from posts import savePostToBox
15 16
 from posts import sendToFollowersThread
@@ -41,7 +42,8 @@ from shares import outboxShareUpload
41 42
 from shares import outboxUndoShareUpload
42 43
 
43 44
 
44
-def postMessageToOutbox(messageJson: {}, postToNickname: str,
45
+def postMessageToOutbox(session, translate: {},
46
+                        messageJson: {}, postToNickname: str,
45 47
                         server, baseDir: str, httpPrefix: str,
46 48
                         domain: str, domainFull: str,
47 49
                         onionDomain: str, i2pDomain: str, port: int,
@@ -262,6 +264,19 @@ def postMessageToOutbox(messageJson: {}, postToNickname: str,
262 264
             for boxNameIndex in indexes:
263 265
                 if not boxNameIndex:
264 266
                     continue
267
+
268
+                # should this also go to the media timeline?
269
+                if boxNameIndex == 'inbox':
270
+                    if isImageMedia(session, baseDir, httpPrefix,
271
+                                    postToNickname, domain,
272
+                                    messageJson,
273
+                                    translate, YTReplacementDomain,
274
+                                    allowLocalNetworkAccess,
275
+                                    recentPostsCache):
276
+                        inboxUpdateIndex('tlmedia', baseDir,
277
+                                         postToNickname + '@' + domain,
278
+                                         savedFilename, debug)
279
+
265 280
                 if boxNameIndex == 'inbox' and outboxName == 'tlblogs':
266 281
                     continue
267 282
                 # avoid duplicates of the message if already going

+ 3
- 1
schedule.py View File

@@ -85,7 +85,9 @@ def _updatePostSchedule(baseDir: str, handle: str, httpd,
85 85
 
86 86
             if nickname:
87 87
                 httpd.postToNickname = nickname
88
-            if not postMessageToOutbox(postJsonObject, nickname,
88
+            if not postMessageToOutbox(httpd.session,
89
+                                       httpd.translate,
90
+                                       postJsonObject, nickname,
89 91
                                        httpd, baseDir,
90 92
                                        httpd.httpPrefix,
91 93
                                        httpd.domain,

Loading…
Cancel
Save