mirror of https://gitlab.com/bashrc2/epicyon
Permitted DM instances within edit profile screen
parent
702fa3167f
commit
91c955006a
17
daemon.py
17
daemon.py
|
@ -5019,11 +5019,24 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if os.path.isfile(blockedFilename):
|
if os.path.isfile(blockedFilename):
|
||||||
os.remove(blockedFilename)
|
os.remove(blockedFilename)
|
||||||
|
|
||||||
|
# Save DM allowed instances list.
|
||||||
|
# The allow list for incoming DMs,
|
||||||
|
# if the .followDMs flag file exists
|
||||||
|
dmAllowedInstancesFilename = \
|
||||||
|
baseDir + '/accounts/' + \
|
||||||
|
nickname + '@' + domain + '/dmAllowedinstances.txt'
|
||||||
|
if fields.get('dmAllowedInstances'):
|
||||||
|
with open(dmAllowedInstancesFilename, 'w+') as aFile:
|
||||||
|
aFile.write(fields['dmAllowedInstances'])
|
||||||
|
else:
|
||||||
|
if os.path.isfile(dmAllowedInstancesFilename):
|
||||||
|
os.remove(dmAllowedInstancesFilename)
|
||||||
|
|
||||||
# save allowed instances list
|
# save allowed instances list
|
||||||
|
# This is the account level allow list
|
||||||
allowedInstancesFilename = \
|
allowedInstancesFilename = \
|
||||||
baseDir + '/accounts/' + \
|
baseDir + '/accounts/' + \
|
||||||
nickname + '@' + domain + \
|
nickname + '@' + domain + '/allowedinstances.txt'
|
||||||
'/allowedinstances.txt'
|
|
||||||
if fields.get('allowedInstances'):
|
if fields.get('allowedInstances'):
|
||||||
with open(allowedInstancesFilename, 'w+') as aFile:
|
with open(allowedInstancesFilename, 'w+') as aFile:
|
||||||
aFile.write(fields['allowedInstances'])
|
aFile.write(fields['allowedInstances'])
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "مستشار",
|
"counselor": "مستشار",
|
||||||
"Counselors": "المستشارين",
|
"Counselors": "المستشارين",
|
||||||
"shocked": "صدمت",
|
"shocked": "صدمت",
|
||||||
"Encrypted": "مشفر"
|
"Encrypted": "مشفر",
|
||||||
|
"Direct Message permitted instances": "الرسالة المباشرة المسموح بها",
|
||||||
|
"Direct messages are always allowed from these instances.": "الرسائل المباشرة مسموح بها دائما من هذه المثيلات."
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "conseller",
|
"counselor": "conseller",
|
||||||
"Counselors": "Consellers",
|
"Counselors": "Consellers",
|
||||||
"shocked": "sorprès",
|
"shocked": "sorprès",
|
||||||
"Encrypted": "Xifrat"
|
"Encrypted": "Xifrat",
|
||||||
|
"Direct Message permitted instances": "Instàncies permeses del missatge directe",
|
||||||
|
"Direct messages are always allowed from these instances.": "Els missatges directes sempre estan permesos d'aquests casos."
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "cynghorydd",
|
"counselor": "cynghorydd",
|
||||||
"Counselors": "Cynghorwyr",
|
"Counselors": "Cynghorwyr",
|
||||||
"shocked": "sioc",
|
"shocked": "sioc",
|
||||||
"Encrypted": "Amgryptio"
|
"Encrypted": "Amgryptio",
|
||||||
|
"Direct Message permitted instances": "Achosion a ganiateir negeseuon uniongyrchol",
|
||||||
|
"Direct messages are always allowed from these instances.": "Caniateir negeseuon uniongyrchol bob amser o'r achosion hyn."
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "Beraterin",
|
"counselor": "Beraterin",
|
||||||
"Counselors": "Berater",
|
"Counselors": "Berater",
|
||||||
"shocked": "schockiert",
|
"shocked": "schockiert",
|
||||||
"Encrypted": "Verschlüsselt"
|
"Encrypted": "Verschlüsselt",
|
||||||
|
"Direct Message permitted instances": "Direktnachricht erlaubte Instanzen",
|
||||||
|
"Direct messages are always allowed from these instances.": "Direkte Nachrichten sind in diesen Fällen immer zulässig."
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "counselor",
|
"counselor": "counselor",
|
||||||
"Counselors": "Counselors",
|
"Counselors": "Counselors",
|
||||||
"shocked": "shocked",
|
"shocked": "shocked",
|
||||||
"Encrypted": "Encrypted"
|
"Encrypted": "Encrypted",
|
||||||
|
"Direct Message permitted instances": "Direct Message permitted instances",
|
||||||
|
"Direct messages are always allowed from these instances.": "Direct messages are always allowed from these instances."
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "Consejera",
|
"counselor": "Consejera",
|
||||||
"Counselors": "Consejeras",
|
"Counselors": "Consejeras",
|
||||||
"shocked": "conmocionada",
|
"shocked": "conmocionada",
|
||||||
"Encrypted": "Cifrada"
|
"Encrypted": "Cifrada",
|
||||||
|
"Direct Message permitted instances": "Mensaje directo permitido instancias",
|
||||||
|
"Direct messages are always allowed from these instances.": "Los mensajes directos siempre están permitidos de estas instancias."
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "Conseillère",
|
"counselor": "Conseillère",
|
||||||
"Counselors": "Conseillères",
|
"Counselors": "Conseillères",
|
||||||
"shocked": "sous le choc",
|
"shocked": "sous le choc",
|
||||||
"Encrypted": "Crypté"
|
"Encrypted": "Crypté",
|
||||||
|
"Direct Message permitted instances": "Message direct des instances autorisées",
|
||||||
|
"Direct messages are always allowed from these instances.": "Les messages directs sont toujours autorisés dans ces instances."
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "Comhairleoir",
|
"counselor": "Comhairleoir",
|
||||||
"Counselors": "Comhairleoirí",
|
"Counselors": "Comhairleoirí",
|
||||||
"shocked": "ionadh",
|
"shocked": "ionadh",
|
||||||
"Encrypted": "Criptithe"
|
"Encrypted": "Criptithe",
|
||||||
|
"Direct Message permitted instances": "Ceadaíonn teachtaireacht dhíreach cásanna",
|
||||||
|
"Direct messages are always allowed from these instances.": "Ceadaítear teachtaireachtaí díreacha i gcónaí ó na cásanna seo."
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "काउंसलर",
|
"counselor": "काउंसलर",
|
||||||
"Counselors": "सलाहकार",
|
"Counselors": "सलाहकार",
|
||||||
"shocked": "हैरान",
|
"shocked": "हैरान",
|
||||||
"Encrypted": "को गोपित"
|
"Encrypted": "को गोपित",
|
||||||
|
"Direct Message permitted instances": "प्रत्यक्ष संदेश अनुमत उदाहरण",
|
||||||
|
"Direct messages are always allowed from these instances.": "इन उदाहरणों से प्रत्यक्ष संदेश हमेशा अनुमति देते हैं।"
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "Consulente",
|
"counselor": "Consulente",
|
||||||
"Counselors": "Consiglieri",
|
"Counselors": "Consiglieri",
|
||||||
"shocked": "scioccata",
|
"shocked": "scioccata",
|
||||||
"Encrypted": "Crittografato"
|
"Encrypted": "Crittografato",
|
||||||
|
"Direct Message permitted instances": "Messaggio diretto istanze consentite",
|
||||||
|
"Direct messages are always allowed from these instances.": "I messaggi diretti sono sempre ammessi da questi casi."
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "カウンセラー",
|
"counselor": "カウンセラー",
|
||||||
"Counselors": "カウンセラー",
|
"Counselors": "カウンセラー",
|
||||||
"shocked": "ショックを受けた",
|
"shocked": "ショックを受けた",
|
||||||
"Encrypted": "暗号化"
|
"Encrypted": "暗号化",
|
||||||
|
"Direct Message permitted instances": "直接メッセージ許可インスタンス",
|
||||||
|
"Direct messages are always allowed from these instances.": "直接メッセージは常にこれらのインスタンスから許可されています。"
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "Pêşnîyarvan",
|
"counselor": "Pêşnîyarvan",
|
||||||
"Counselors": "Selêwirmendan",
|
"Counselors": "Selêwirmendan",
|
||||||
"shocked": "şok kirin",
|
"shocked": "şok kirin",
|
||||||
"Encrypted": "Encîfre kirin"
|
"Encrypted": "Encîfre kirin",
|
||||||
|
"Direct Message permitted instances": "Peyama rasterast destûrê",
|
||||||
|
"Direct messages are always allowed from these instances.": "Peyamên rasterast her gav ji van deman têne destûr kirin."
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,5 +397,7 @@
|
||||||
"counselor": "Counselors",
|
"counselor": "Counselors",
|
||||||
"Counselors": "Counselors",
|
"Counselors": "Counselors",
|
||||||
"shocked": "shocked",
|
"shocked": "shocked",
|
||||||
"Encrypted": "Encrypted"
|
"Encrypted": "Encrypted",
|
||||||
|
"Direct Message permitted instances": "Direct Message permitted instances",
|
||||||
|
"Direct messages are always allowed from these instances.": "Direct messages are always allowed from these instances."
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "Conselheira",
|
"counselor": "Conselheira",
|
||||||
"Counselors": "Conselheiras",
|
"Counselors": "Conselheiras",
|
||||||
"shocked": "chocada",
|
"shocked": "chocada",
|
||||||
"Encrypted": "Criptografada"
|
"Encrypted": "Criptografada",
|
||||||
|
"Direct Message permitted instances": "Mensagens diretas permitidas instâncias",
|
||||||
|
"Direct messages are always allowed from these instances.": "Mensagens diretas são sempre permitidas a partir dessas instâncias."
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "Советник",
|
"counselor": "Советник",
|
||||||
"Counselors": "Советники",
|
"Counselors": "Советники",
|
||||||
"shocked": "потрясенный",
|
"shocked": "потрясенный",
|
||||||
"Encrypted": "Зашифрованный"
|
"Encrypted": "Зашифрованный",
|
||||||
|
"Direct Message permitted instances": "Прямое сообщение разрешено экземпляры",
|
||||||
|
"Direct messages are always allowed from these instances.": "Прямые сообщения всегда допускаются из этих экземпляров."
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,5 +401,7 @@
|
||||||
"counselor": "顾问",
|
"counselor": "顾问",
|
||||||
"Counselors": "辅导员",
|
"Counselors": "辅导员",
|
||||||
"shocked": "震惊的",
|
"shocked": "震惊的",
|
||||||
"Encrypted": "加密的"
|
"Encrypted": "加密的",
|
||||||
|
"Direct Message permitted instances": "直接留言允许实例",
|
||||||
|
"Direct messages are always allowed from these instances.": "这些实例始终允许直接消息。"
|
||||||
}
|
}
|
||||||
|
|
8
utils.py
8
utils.py
|
@ -2214,11 +2214,11 @@ def dmAllowedFromDomain(baseDir: str,
|
||||||
i.e. Mostly you only want DMs from followers, but there are
|
i.e. Mostly you only want DMs from followers, but there are
|
||||||
a few particular instances that you trust
|
a few particular instances that you trust
|
||||||
"""
|
"""
|
||||||
dmAllowedDomainsFilename = \
|
dmAllowedInstancesFilename = \
|
||||||
baseDir + '/accounts/' + \
|
baseDir + '/accounts/' + \
|
||||||
nickname + '@' + domain + '/dmAllowedDomains.txt'
|
nickname + '@' + domain + '/dmAllowedInstances.txt'
|
||||||
if not os.path.isfile(dmAllowedDomainsFilename):
|
if not os.path.isfile(dmAllowedInstancesFilename):
|
||||||
return False
|
return False
|
||||||
if sendingActorDomain + '\n' in open(dmAllowedDomainsFilename).read():
|
if sendingActorDomain + '\n' in open(dmAllowedInstancesFilename).read():
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -1184,6 +1184,14 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
|
||||||
with open(blockedFilename, 'r') as blockedfile:
|
with open(blockedFilename, 'r') as blockedfile:
|
||||||
blockedStr = blockedfile.read()
|
blockedStr = blockedfile.read()
|
||||||
|
|
||||||
|
dmAllowedInstancesStr = ''
|
||||||
|
dmAllowedInstancesFilename = \
|
||||||
|
baseDir + '/accounts/' + \
|
||||||
|
nickname + '@' + domain + '/dmAllowedInstances.txt'
|
||||||
|
if os.path.isfile(dmAllowedInstancesFilename):
|
||||||
|
with open(dmAllowedInstancesFilename, 'r') as dmAllowedInstancesFile:
|
||||||
|
dmAllowedInstancesStr = dmAllowedInstancesFile.read()
|
||||||
|
|
||||||
allowedInstancesStr = ''
|
allowedInstancesStr = ''
|
||||||
allowedInstancesFilename = \
|
allowedInstancesFilename = \
|
||||||
baseDir + '/accounts/' + \
|
baseDir + '/accounts/' + \
|
||||||
|
@ -1740,6 +1748,18 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
|
||||||
' <textarea id="message" name="blocked" style="height:200px" ' + \
|
' <textarea id="message" name="blocked" style="height:200px" ' + \
|
||||||
'spellcheck="false">' + blockedStr + '</textarea>\n'
|
'spellcheck="false">' + blockedStr + '</textarea>\n'
|
||||||
|
|
||||||
|
editProfileForm += \
|
||||||
|
' <br><b><label class="labels">' + \
|
||||||
|
translate['Direct Message permitted instances'] + '</label></b>\n'
|
||||||
|
idx = 'Direct messages are always allowed from these instances.'
|
||||||
|
editProfileForm += \
|
||||||
|
' <br><label class="labels">' + \
|
||||||
|
translate[idx] + '</label>\n'
|
||||||
|
editProfileForm += \
|
||||||
|
' <textarea id="message" name="dmAllowedInstances" ' + \
|
||||||
|
'style="height:200px" spellcheck="false">' + \
|
||||||
|
dmAllowedInstancesStr + '</textarea>\n'
|
||||||
|
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
' <br><b><label class="labels">' + \
|
' <br><b><label class="labels">' + \
|
||||||
translate['Federation list'] + '</label></b>\n'
|
translate['Federation list'] + '</label></b>\n'
|
||||||
|
|
Loading…
Reference in New Issue