Remove wait screen

main
Bob Mottram 2020-09-28 16:10:08 +01:00
parent 5b3d674886
commit 1c0770120c
17 changed files with 15 additions and 271 deletions

205
daemon.py
View File

@ -152,7 +152,6 @@ from webinterface import rssHashtagSearch
from webinterface import htmlModerationInfo
from webinterface import htmlSearchSharedItems
from webinterface import htmlHashtagBlocked
from webinterface import htmlSendingPost
from shares import getSharesFeedForPerson
from shares import addShare
from shares import removeShare
@ -9133,62 +9132,6 @@ class PubServer(BaseHTTPRequestHandler):
self._set_headers_head(mediaFileType, fileLength,
etag, callingDomain)
def _showSendingScreen(self, authorized: bool, callingDomain: str) -> None:
"""Shows a 'sending post' wait screen
"""
if self.server.defaultTimeline != 'inbox':
return
if not self._requestHTTP():
return
# make a copy of the headers
currHeaders = self.headers.items()
# show a sending post screen
msg = \
htmlSendingPost(self.server.baseDir,
self.server.translate).encode('utf-8')
self._login_headers('text/html', len(msg), callingDomain)
self._write(msg)
self.wfile.flush()
# restore headers
for headerField in currHeaders:
fieldName = headerField[0]
fieldValue = headerField[1]
self.headers[fieldName] = fieldValue
def _clearSendingScreen(self, authorized: bool,
boxName: str, path: str,
callingDomain: str, cookie: str) -> None:
"""Redirects to the given box
"""
if boxName != 'inbox':
return
if not self._requestHTTP():
return
self._showInbox(authorized,
callingDomain, self.path,
self.server.baseDir,
self.server.httpPrefix,
self.server.domain,
self.server.domainFull,
self.server.port,
self.server.onionDomain,
self.server.i2pDomain,
None, None,
self.server.proxyType,
cookie, self.server.debug,
self.server.recentPostsCache,
self.server.session,
self.server.defaultTimeline,
self.server.maxRecentPosts,
self.server.translate,
self.server.cachedWebfingers,
self.server.personCache,
self.server.allowDeletion,
self.server.projectVersion,
self.server.YTReplacementDomain)
def _receiveNewPostProcess(self, postType: str, path: str, headers: {},
length: int, postBytes, boundary: str,
callingDomain: str, cookie: str,
@ -9334,12 +9277,6 @@ class PubServer(BaseHTTPRequestHandler):
else:
privateEvent = True
# self._showSendingScreen(authorized, callingDomain)
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
if postType == 'newpost':
messageJson = \
createPublicPost(self.server.baseDir,
@ -9358,10 +9295,6 @@ class PubServer(BaseHTTPRequestHandler):
fields['location'])
if messageJson:
if fields['schedulePost']:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
if self._postToOutbox(messageJson, __version__, nickname):
@ -9371,16 +9304,8 @@ class PubServer(BaseHTTPRequestHandler):
messageJson,
self.server.maxReplies,
self.server.debug)
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
else:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return -1
elif postType == 'newblog':
messageJson = \
@ -9398,10 +9323,6 @@ class PubServer(BaseHTTPRequestHandler):
fields['location'])
if messageJson:
if fields['schedulePost']:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
if self._postToOutbox(messageJson, __version__, nickname):
populateReplies(self.server.baseDir,
@ -9410,16 +9331,8 @@ class PubServer(BaseHTTPRequestHandler):
messageJson,
self.server.maxReplies,
self.server.debug)
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
else:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return -1
elif postType == 'editblogpost':
print('Edited blog post received')
@ -9488,10 +9401,6 @@ class PubServer(BaseHTTPRequestHandler):
self.server.YTReplacementDomain)
saveJson(postJsonObject, postFilename)
print('Edited blog post, resaved ' + postFilename)
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
else:
print('Edited blog post, unable to load json for ' +
@ -9499,9 +9408,6 @@ class PubServer(BaseHTTPRequestHandler):
else:
print('Edited blog post not found ' +
str(fields['postUrl']))
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain, cookie)
return -1
elif postType == 'newunlisted':
messageJson = \
@ -9523,10 +9429,6 @@ class PubServer(BaseHTTPRequestHandler):
fields['location'])
if messageJson:
if fields['schedulePost']:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
if self._postToOutbox(messageJson, __version__, nickname):
populateReplies(self.server.baseDir,
@ -9535,16 +9437,8 @@ class PubServer(BaseHTTPRequestHandler):
messageJson,
self.server.maxReplies,
self.server.debug)
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
else:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return -1
elif postType == 'newfollowers':
messageJson = \
@ -9568,10 +9462,6 @@ class PubServer(BaseHTTPRequestHandler):
fields['location'])
if messageJson:
if fields['schedulePost']:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
if self._postToOutbox(messageJson, __version__, nickname):
populateReplies(self.server.baseDir,
@ -9580,16 +9470,8 @@ class PubServer(BaseHTTPRequestHandler):
messageJson,
self.server.maxReplies,
self.server.debug)
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
else:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return -1
elif postType == 'newevent':
# A Mobilizon-type event is posted
@ -9640,22 +9522,10 @@ class PubServer(BaseHTTPRequestHandler):
fields['ticketUrl'])
if messageJson:
if fields['schedulePost']:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
if self._postToOutbox(messageJson, __version__, nickname):
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
else:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return -1
elif postType == 'newdm':
messageJson = None
@ -9683,10 +9553,6 @@ class PubServer(BaseHTTPRequestHandler):
fields['location'])
if messageJson:
if fields['schedulePost']:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
print('Sending new DM to ' +
str(messageJson['object']['to']))
@ -9697,16 +9563,8 @@ class PubServer(BaseHTTPRequestHandler):
messageJson,
self.server.maxReplies,
self.server.debug)
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
else:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return -1
elif postType == 'newreminder':
messageJson = None
@ -9733,32 +9591,16 @@ class PubServer(BaseHTTPRequestHandler):
fields['location'])
if messageJson:
if fields['schedulePost']:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
print('DEBUG: new reminder to ' +
str(messageJson['object']['to']))
if self._postToOutbox(messageJson, __version__, nickname):
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
else:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return -1
elif postType == 'newreport':
if attachmentMediaType:
if attachmentMediaType != 'image':
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return -1
# So as to be sure that this only goes to moderators
# and not accounts being reported we disable any
@ -9777,28 +9619,13 @@ class PubServer(BaseHTTPRequestHandler):
self.server.debug, fields['subject'])
if messageJson:
if self._postToOutbox(messageJson, __version__, nickname):
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
else:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return -1
elif postType == 'newquestion':
if not fields.get('duration'):
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return -1
if not fields.get('message'):
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain, cookie)
return -1
# questionStr = fields['message']
qOptions = []
@ -9807,9 +9634,6 @@ class PubServer(BaseHTTPRequestHandler):
qOptions.append(fields['questionOption' +
str(questionCtr)])
if not qOptions:
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain, cookie)
return -1
messageJson = \
createQuestionPost(self.server.baseDir,
@ -9829,42 +9653,19 @@ class PubServer(BaseHTTPRequestHandler):
if self.server.debug:
print('DEBUG: new Question')
if self._postToOutbox(messageJson, __version__, nickname):
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return 1
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain, cookie)
return -1
elif postType == 'newshare':
if not fields.get('itemType'):
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain, cookie)
return -1
if not fields.get('category'):
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain, cookie)
return -1
if not fields.get('location'):
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain, cookie)
return -1
if not fields.get('duration'):
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain, cookie)
return -1
if attachmentMediaType:
if attachmentMediaType != 'image':
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain,
cookie)
return -1
durationStr = fields['duration']
if durationStr:
@ -9886,13 +9687,7 @@ class PubServer(BaseHTTPRequestHandler):
if os.path.isfile(filename):
os.remove(filename)
self.postToNickname = nickname
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain, cookie)
return 1
self._clearSendingScreen(authorized,
self.server.defaultTimeline,
self.path, callingDomain, cookie)
return -1
def _receiveNewPost(self, postType: str, path: str,

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "علامات التجزئة المُنشأة تلقائيًا",
"Autogenerated Content Warnings": "تحذيرات المحتوى المُنشأ تلقائيًا",
"Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag محظور",
"Sending Post": "إرسال آخر",
"Please wait": "ارجوك انتظر"
"Hashtag Blocked": "Hashtag محظور"
}

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "Hashtags autogenerats",
"Autogenerated Content Warnings": "Advertiments de contingut autogenerats",
"Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag bloquejat",
"Sending Post": "S'està enviant el missatge",
"Please wait": "Espereu, si us plau"
"Hashtag Blocked": "Hashtag bloquejat"
}

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "Hashtags awtogeneiddiedig",
"Autogenerated Content Warnings": "Rhybuddion Cynnwys Autogenerated",
"Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag wedi'i Blocio",
"Sending Post": "Post Anfon",
"Please wait": "Arhoswch os gwelwch yn dda"
"Hashtag Blocked": "Hashtag wedi'i Blocio"
}

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "Automatisch generierte Hashtags",
"Autogenerated Content Warnings": "Warnungen vor automatisch generierten Inhalten",
"Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag blockiert",
"Sending Post": "Post senden",
"Please wait": "Warten Sie mal"
"Hashtag Blocked": "Hashtag blockiert"
}

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "Autogenerated Hashtags",
"Autogenerated Content Warnings": "Autogenerated Content Warnings",
"Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag Blocked",
"Sending Post": "Sending Post",
"Please wait": "Please wait"
"Hashtag Blocked": "Hashtag Blocked"
}

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "Hashtags autogenerados",
"Autogenerated Content Warnings": "Advertencias de contenido generado automáticamente",
"Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag bloqueada",
"Sending Post": "Envío de publicación",
"Please wait": "por favor espera"
"Hashtag Blocked": "Hashtag bloqueada"
}

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "Hashtags générés automatiquement",
"Autogenerated Content Warnings": "Avertissements de contenu générés automatiquement",
"Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag bloqué",
"Sending Post": "Envoi du message",
"Please wait": "S'il vous plaît, attendez"
"Hashtag Blocked": "Hashtag bloqué"
}

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "Hashtags uathghinte",
"Autogenerated Content Warnings": "Rabhaidh Ábhar Uathghinte",
"Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag Blocáilte",
"Sending Post": "Post Seolta",
"Please wait": "Fán le do thoil"
"Hashtag Blocked": "Hashtag Blocáilte"
}

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "ऑटोजेनरेटेड हैशटैग",
"Autogenerated Content Warnings": "स्वतः प्राप्त सामग्री चेतावनी",
"Indymedia": "Indymedia",
"Hashtag Blocked": "हैशटैग अवरुद्ध",
"Sending Post": "पोस्ट भेज रहा है",
"Please wait": "कृपया प्रतीक्षा कीजिये"
"Hashtag Blocked": "हैशटैग अवरुद्ध"
}

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "Hashtag generati automaticamente",
"Autogenerated Content Warnings": "Avvisi sui contenuti generati automaticamente",
"Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag bloccato",
"Sending Post": "Invio di post",
"Please wait": "attendere prego"
"Hashtag Blocked": "Hashtag bloccato"
}

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "自動生成されたハッシュタグ",
"Autogenerated Content Warnings": "自動生成されたコンテンツの警告",
"Indymedia": "Indymedia",
"Hashtag Blocked": "ハッシュタグがブロックされました",
"Sending Post": "投稿を送信する",
"Please wait": "お待ちください"
"Hashtag Blocked": "ハッシュタグがブロックされました"
}

View File

@ -283,7 +283,5 @@
"Autogenerated Hashtags": "Autogenerated Hashtags",
"Autogenerated Content Warnings": "Autogenerated Content Warnings",
"Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag Blocked",
"Sending Post": "Sending Post",
"Please wait": "Please wait"
"Hashtag Blocked": "Hashtag Blocked"
}

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "Hashtags autogeradas",
"Autogenerated Content Warnings": "Avisos de conteúdo gerado automaticamente",
"Indymedia": "Indymedia",
"Hashtag Blocked": "Hashtag bloqueada",
"Sending Post": "Enviando postagem",
"Please wait": "Por favor, espere"
"Hashtag Blocked": "Hashtag bloqueada"
}

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "Автоматически сгенерированные хештеги",
"Autogenerated Content Warnings": "Автоматические предупреждения о содержании",
"Indymedia": "Indymedia",
"Hashtag Blocked": "Хештег заблокирован",
"Sending Post": "Отправка сообщения",
"Please wait": "пожалуйста, подождите"
"Hashtag Blocked": "Хештег заблокирован"
}

View File

@ -287,7 +287,5 @@
"Autogenerated Hashtags": "自动生成的标签",
"Autogenerated Content Warnings": "自动生成的内容警告",
"Indymedia": "Indymedia",
"Hashtag Blocked": "标签被阻止",
"Sending Post": "发送帖子",
"Please wait": "请稍候"
"Hashtag Blocked": "标签被阻止"
}

View File

@ -2006,27 +2006,6 @@ def htmlHashtagBlocked(baseDir: str, translate: {}) -> str:
return blockedHashtagForm
def htmlSendingPost(baseDir: str, translate: {}) -> str:
"""A wait screen while sending a post
"""
sendForm = ''
cssFilename = baseDir + '/epicyon-send.css'
if os.path.isfile(baseDir + '/send.css'):
cssFilename = baseDir + '/send.css'
with open(cssFilename, 'r') as cssFile:
sendingCSS = cssFile.read()
sendForm = htmlHeader(cssFilename, sendingCSS)
sendForm += '<div><center>\n'
sendForm += \
' <p class="screentitle">' + \
translate['Sending Post'] + '</p>\n'
sendForm += \
' <p>' + translate['Please wait'] + '</p>\n'
sendForm += '</center></div>\n'
sendForm += htmlFooter()
return sendForm
def htmlSuspended(baseDir: str) -> str:
"""Show the screen for suspended accounts
"""