diff --git a/daemon.py b/daemon.py
index d40fb1e4e..fe192e17b 100644
--- a/daemon.py
+++ b/daemon.py
@@ -3363,6 +3363,18 @@ class PubServer(BaseHTTPRequestHandler):
if os.path.isfile(autoTagsFilename):
os.remove(autoTagsFilename)
+ # autogenerated content warnings
+ autoCWFilename = \
+ baseDir + '/accounts/' + \
+ nickname + '@' + domain + \
+ '/autocw.txt'
+ if fields.get('autoCW'):
+ with open(autoCWFilename, 'w+') as autoCWFile:
+ autoCWFile.write(fields['autoCW'])
+ else:
+ if os.path.isfile(autoCWFilename):
+ os.remove(autoCWFilename)
+
# save blocked accounts list
blockedFilename = \
baseDir + '/accounts/' + \
diff --git a/posts.py b/posts.py
index 1d32205f7..3a594a811 100644
--- a/posts.py
+++ b/posts.py
@@ -668,6 +668,41 @@ def validContentWarning(cw: str) -> str:
return cw
+def loadAutoCW(baseDir: str, nickname: str, domain: str) -> []:
+ """Loads automatic CWs file and returns a list containing
+ the lines of the file
+ """
+ filename = baseDir + '/accounts/' + \
+ nickname + '@' + domain + '/autocw.txt'
+ if not os.path.isfile(filename):
+ return []
+ with open(filename, "r") as f:
+ return f.readlines()
+ return []
+
+
+def addAutoCW(baseDir: str, nickname: str, domain: str,
+ subject: str, content: str) -> str:
+ """Appends any automatic CW to the subject line
+ and returns the new subject line
+ """
+ newSubject = subject
+ autoCWList = loadAutoCW(baseDir, nickname, domain)
+ for cwRule in autoCWList:
+ if '->' not in cwRule:
+ continue
+ match = cwRule.split('->')[0].strip()
+ if match not in content:
+ continue
+ cwStr = cwRule.split('->')[1].strip()
+ if newSubject:
+ if cwStr not in newSubject:
+ newSubject += ', ' + cwStr
+ else:
+ newSubject = cwStr
+ return newSubject
+
+
def createPostBase(baseDir: str, nickname: str, domain: str, port: int,
toUrl: str, ccUrl: str, httpPrefix: str, content: str,
followersOnly: bool, saveToFile: bool, clientToServer: bool,
@@ -687,6 +722,8 @@ def createPostBase(baseDir: str, nickname: str, domain: str, port: int,
eventStatus=None, ticketUrl=None) -> {}:
"""Creates a message
"""
+ subject = addAutoCW(baseDir, nickname, domain, subject, content)
+
mentionedRecipients = \
getMentionedPeople(baseDir, httpPrefix, content, domain, False)
diff --git a/translations/ar.json b/translations/ar.json
index 2ba0ecc96..4cd299377 100644
--- a/translations/ar.json
+++ b/translations/ar.json
@@ -284,5 +284,6 @@
"Edit event": "تحرير الحدث",
"Notify when posts are liked": "يخطر عندما يتم اعجاب المشاركات",
"Don't show the Like button": "لا تظهر زر أعجبني",
- "Autogenerated Hashtags": "علامات التجزئة المُنشأة تلقائيًا"
+ "Autogenerated Hashtags": "علامات التجزئة المُنشأة تلقائيًا",
+ "Autogenerated Content Warnings": "تحذيرات المحتوى المُنشأ تلقائيًا"
}
diff --git a/translations/ca.json b/translations/ca.json
index 3093b203d..03496a1a1 100644
--- a/translations/ca.json
+++ b/translations/ca.json
@@ -284,5 +284,6 @@
"Edit event": "Edita l’esdeveniment",
"Notify when posts are liked": "Notifiqueu-ho quan us agradin les publicacions",
"Don't show the Like button": "No mostreu el botó M'agrada",
- "Autogenerated Hashtags": "Hashtags autogenerats"
+ "Autogenerated Hashtags": "Hashtags autogenerats",
+ "Autogenerated Content Warnings": "Advertiments de contingut autogenerats"
}
diff --git a/translations/cy.json b/translations/cy.json
index de7ac233f..a5a4d7b4d 100644
--- a/translations/cy.json
+++ b/translations/cy.json
@@ -284,5 +284,6 @@
"Edit event": "Golygu digwyddiad",
"Notify when posts are liked": "Hysbysu pryd mae swyddi'n cael eu hoffi",
"Don't show the Like button": "Peidiwch â dangos y botwm Hoffi",
- "Autogenerated Hashtags": "Hashtags awtogeneiddiedig"
+ "Autogenerated Hashtags": "Hashtags awtogeneiddiedig",
+ "Autogenerated Content Warnings": "Rhybuddion Cynnwys Autogenerated"
}
diff --git a/translations/de.json b/translations/de.json
index af8f4eac6..db919e842 100644
--- a/translations/de.json
+++ b/translations/de.json
@@ -284,5 +284,6 @@
"Edit event": "Ereignis bearbeiten",
"Notify when posts are liked": "Benachrichtigen, wenn Beiträge gefallen",
"Don't show the Like button": "Zeigen Sie nicht die Schaltfläche \"Gefällt mir\" an",
- "Autogenerated Hashtags": "Automatisch generierte Hashtags"
+ "Autogenerated Hashtags": "Automatisch generierte Hashtags",
+ "Autogenerated Content Warnings": "Warnungen vor automatisch generierten Inhalten"
}
diff --git a/translations/en.json b/translations/en.json
index 656f908f6..e55da2c5b 100644
--- a/translations/en.json
+++ b/translations/en.json
@@ -284,5 +284,6 @@
"Edit event": "Edit event",
"Notify when posts are liked": "Notify when posts are liked",
"Don't show the Like button": "Don't show the Like button",
- "Autogenerated Hashtags": "Autogenerated Hashtags"
+ "Autogenerated Hashtags": "Autogenerated Hashtags",
+ "Autogenerated Content Warnings": "Autogenerated Content Warnings"
}
diff --git a/translations/es.json b/translations/es.json
index 541d50e6f..31e0d4182 100644
--- a/translations/es.json
+++ b/translations/es.json
@@ -284,5 +284,6 @@
"Edit event": "Editar evento",
"Notify when posts are liked": "Notificar cuando les gusten las publicaciones",
"Don't show the Like button": "No mostrar el botón Me gusta",
- "Autogenerated Hashtags": "Hashtags autogenerados"
+ "Autogenerated Hashtags": "Hashtags autogenerados",
+ "Autogenerated Content Warnings": "Advertencias de contenido generado automáticamente"
}
diff --git a/translations/fr.json b/translations/fr.json
index 056847372..3e1f1228b 100644
--- a/translations/fr.json
+++ b/translations/fr.json
@@ -284,5 +284,6 @@
"Edit event": "Modifier l'événement",
"Notify when posts are liked": "Notifier lorsque les messages sont aimés",
"Don't show the Like button": "Ne pas afficher le bouton J'aime",
- "Autogenerated Hashtags": "Hashtags générés automatiquement"
+ "Autogenerated Hashtags": "Hashtags générés automatiquement",
+ "Autogenerated Content Warnings": "Avertissements de contenu générés automatiquement"
}
diff --git a/translations/ga.json b/translations/ga.json
index 1d480f4f4..b00dca076 100644
--- a/translations/ga.json
+++ b/translations/ga.json
@@ -284,5 +284,6 @@
"Edit event": "Cuir imeacht in eagar",
"Notify when posts are liked": "Cuir in iúl cathain is maith poist",
"Don't show the Like button": "Ná taispeáin an cnaipe Cosúil",
- "Autogenerated Hashtags": "Hashtags uathghinte"
+ "Autogenerated Hashtags": "Hashtags uathghinte",
+ "Autogenerated Content Warnings": "Rabhaidh Ábhar Uathghinte"
}
diff --git a/translations/hi.json b/translations/hi.json
index 63bb954f9..e7eb445cd 100644
--- a/translations/hi.json
+++ b/translations/hi.json
@@ -284,5 +284,6 @@
"Edit event": "घटना संपादित करें",
"Notify when posts are liked": "पोस्ट पसंद आने पर सूचित करें",
"Don't show the Like button": "लाइक बटन न दिखाएं",
- "Autogenerated Hashtags": "ऑटोजेनरेटेड हैशटैग"
+ "Autogenerated Hashtags": "ऑटोजेनरेटेड हैशटैग",
+ "Autogenerated Content Warnings": "स्वतः प्राप्त सामग्री चेतावनी"
}
diff --git a/translations/it.json b/translations/it.json
index 977bc54d1..d7b5f6738 100644
--- a/translations/it.json
+++ b/translations/it.json
@@ -284,5 +284,6 @@
"Edit event": "Modifica evento",
"Notify when posts are liked": "Avvisa quando i post sono piaciuti",
"Don't show the Like button": "Non mostrare il pulsante Mi piace",
- "Autogenerated Hashtags": "Hashtag generati automaticamente"
+ "Autogenerated Hashtags": "Hashtag generati automaticamente",
+ "Autogenerated Content Warnings": "Avvisi sui contenuti generati automaticamente"
}
diff --git a/translations/ja.json b/translations/ja.json
index 2b4de68e8..b5606b0d9 100644
--- a/translations/ja.json
+++ b/translations/ja.json
@@ -284,5 +284,6 @@
"Edit event": "イベントを編集",
"Notify when posts are liked": "投稿が高く評価されたときに通知する",
"Don't show the Like button": "「いいね!」ボタンを表示しない",
- "Autogenerated Hashtags": "自動生成されたハッシュタグ"
+ "Autogenerated Hashtags": "自動生成されたハッシュタグ",
+ "Autogenerated Content Warnings": "自動生成されたコンテンツの警告"
}
diff --git a/translations/oc.json b/translations/oc.json
index 4fba89d52..4afc6e95b 100644
--- a/translations/oc.json
+++ b/translations/oc.json
@@ -280,5 +280,6 @@
"Edit event": "Edit event",
"Notify when posts are liked": "Notify when posts are liked",
"Don't show the Like button": "Don't show the Like button",
- "Autogenerated Hashtags": "Autogenerated Hashtags"
+ "Autogenerated Hashtags": "Autogenerated Hashtags",
+ "Autogenerated Content Warnings": "Autogenerated Content Warnings"
}
diff --git a/translations/pt.json b/translations/pt.json
index bb91f5d9e..d61d5f067 100644
--- a/translations/pt.json
+++ b/translations/pt.json
@@ -284,5 +284,6 @@
"Edit event": "Editar evento",
"Notify when posts are liked": "Notificar quando as postagens forem curtidas",
"Don't show the Like button": "Não mostrar o botão Curtir",
- "Autogenerated Hashtags": "Hashtags autogeradas"
+ "Autogenerated Hashtags": "Hashtags autogeradas",
+ "Autogenerated Content Warnings": "Avisos de conteúdo gerado automaticamente"
}
diff --git a/translations/ru.json b/translations/ru.json
index a53389935..d7b9cda7d 100644
--- a/translations/ru.json
+++ b/translations/ru.json
@@ -284,5 +284,6 @@
"Edit event": "Изменить мероприятие",
"Notify when posts are liked": "Уведомлять, когда публикации нравятся",
"Don't show the Like button": "Не показывать кнопку \"Нравится\"",
- "Autogenerated Hashtags": "Автоматически сгенерированные хештеги"
+ "Autogenerated Hashtags": "Автоматически сгенерированные хештеги",
+ "Autogenerated Content Warnings": "Автоматические предупреждения о содержании"
}
diff --git a/translations/zh.json b/translations/zh.json
index 38caa60ed..4b957c8a5 100644
--- a/translations/zh.json
+++ b/translations/zh.json
@@ -284,5 +284,6 @@
"Edit event": "编辑活动",
"Notify when posts are liked": "通知喜欢的帖子",
"Don't show the Like button": "不显示“赞”按钮",
- "Autogenerated Hashtags": "自动生成的标签"
+ "Autogenerated Hashtags": "自动生成的标签",
+ "Autogenerated Content Warnings": "自动生成的内容警告"
}
diff --git a/webinterface.py b/webinterface.py
index 8bca08326..ea8668939 100644
--- a/webinterface.py
+++ b/webinterface.py
@@ -1175,6 +1175,14 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str,
with open(autoTagsFilename, 'r') as autoTagsFile:
autoTags = autoTagsFile.read()
+ autoCW = ''
+ autoCWFilename = \
+ baseDir + '/accounts/' + \
+ nickname + '@' + domain + '/autocw.txt'
+ if os.path.isfile(autoCWFilename):
+ with open(autoCWFilename, 'r') as autoCWFile:
+ autoCW = autoCWFile.read()
+
blockedStr = ''
blockedFilename = \
baseDir + '/accounts/' + \
@@ -1523,6 +1531,14 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str,
' \n'
+ editProfileForm += \
+ '
\n'
+ editProfileForm += '
\n'
+ editProfileForm += \
+ ' \n'
+
editProfileForm += \
'
\n'