From a7e0c68a966e1050578b4355974bf24ed3ca3387 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 30 Sep 2020 17:13:08 +0100 Subject: [PATCH] Add blogging instance to profile edit screen --- daemon.py | 8 ++++++++ epicyon.py | 4 ++++ translations/ar.json | 3 ++- translations/ca.json | 3 ++- translations/cy.json | 3 ++- translations/de.json | 3 ++- translations/en.json | 3 ++- translations/es.json | 3 ++- translations/fr.json | 3 ++- translations/ga.json | 3 ++- translations/hi.json | 3 ++- translations/it.json | 3 ++- translations/ja.json | 3 ++- translations/oc.json | 3 ++- translations/pt.json | 3 ++- translations/ru.json | 3 ++- translations/zh.json | 3 ++- webinterface.py | 26 +++++++++++++++++++++----- 18 files changed, 63 insertions(+), 20 deletions(-) diff --git a/daemon.py b/daemon.py index ed627876..c2348e1a 100644 --- a/daemon.py +++ b/daemon.py @@ -3205,10 +3205,14 @@ class PubServer(BaseHTTPRequestHandler): self.server.defaultTimeline = 'inbox' if fields['mediaInstance'] == 'on': self.server.mediaInstance = True + self.server.blogsInstance = False self.server.defaultTimeline = 'tlmedia' setConfigParam(baseDir, "mediaInstance", self.server.mediaInstance) + setConfigParam(baseDir, + "blogsInstance", + self.server.blogsInstance) else: if self.server.mediaInstance: self.server.mediaInstance = False @@ -3223,10 +3227,14 @@ class PubServer(BaseHTTPRequestHandler): self.server.defaultTimeline = 'inbox' if fields['blogsInstance'] == 'on': self.server.blogsInstance = True + self.server.mediaInstance = False self.server.defaultTimeline = 'tlblogs' setConfigParam(baseDir, "blogsInstance", self.server.blogsInstance) + setConfigParam(baseDir, + "mediaInstance", + self.server.mediaInstance) else: if self.server.blogsInstance: self.server.blogsInstance = False diff --git a/epicyon.py b/epicyon.py index 99620080..84f0c552 100644 --- a/epicyon.py +++ b/epicyon.py @@ -615,11 +615,15 @@ if not args.mediainstance: mediaInstance = getConfigParam(baseDir, 'mediaInstance') if mediaInstance is not None: args.mediainstance = mediaInstance + if args.mediainstance: + args.blogsinstance = False if not args.blogsinstance: blogsInstance = getConfigParam(baseDir, 'blogsInstance') if blogsInstance is not None: args.blogsinstance = blogsInstance + if args.blogsinstance: + args.mediainstance = False # set the instance title in config.json title = getConfigParam(baseDir, 'instanceTitle') diff --git a/translations/ar.json b/translations/ar.json index b519fa59..344b1f9e 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -287,5 +287,6 @@ "Autogenerated Hashtags": "علامات التجزئة المُنشأة تلقائيًا", "Autogenerated Content Warnings": "تحذيرات المحتوى المُنشأ تلقائيًا", "Indymedia": "Indymedia", - "Hashtag Blocked": "Hashtag محظور" + "Hashtag Blocked": "Hashtag محظور", + "This is a blogging instance": "" } diff --git a/translations/ca.json b/translations/ca.json index 62736ad2..0f874b24 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -287,5 +287,6 @@ "Autogenerated Hashtags": "Hashtags autogenerats", "Autogenerated Content Warnings": "Advertiments de contingut autogenerats", "Indymedia": "Indymedia", - "Hashtag Blocked": "Hashtag bloquejat" + "Hashtag Blocked": "Hashtag bloquejat", + "This is a blogging instance": "" } diff --git a/translations/cy.json b/translations/cy.json index 89f52d7e..d10f7ada 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -287,5 +287,6 @@ "Autogenerated Hashtags": "Hashtags awtogeneiddiedig", "Autogenerated Content Warnings": "Rhybuddion Cynnwys Autogenerated", "Indymedia": "Indymedia", - "Hashtag Blocked": "Hashtag wedi'i Blocio" + "Hashtag Blocked": "Hashtag wedi'i Blocio", + "This is a blogging instance": "" } diff --git a/translations/de.json b/translations/de.json index e3bc529b..b992cdbe 100644 --- a/translations/de.json +++ b/translations/de.json @@ -287,5 +287,6 @@ "Autogenerated Hashtags": "Automatisch generierte Hashtags", "Autogenerated Content Warnings": "Warnungen vor automatisch generierten Inhalten", "Indymedia": "Indymedia", - "Hashtag Blocked": "Hashtag blockiert" + "Hashtag Blocked": "Hashtag blockiert", + "This is a blogging instance": "" } diff --git a/translations/en.json b/translations/en.json index c85bbfe8..ff911e7d 100644 --- a/translations/en.json +++ b/translations/en.json @@ -287,5 +287,6 @@ "Autogenerated Hashtags": "Autogenerated Hashtags", "Autogenerated Content Warnings": "Autogenerated Content Warnings", "Indymedia": "Indymedia", - "Hashtag Blocked": "Hashtag Blocked" + "Hashtag Blocked": "Hashtag Blocked", + "This is a blogging instance": "This is a blogging instance" } diff --git a/translations/es.json b/translations/es.json index 6fe9c141..b8d4a4f4 100644 --- a/translations/es.json +++ b/translations/es.json @@ -287,5 +287,6 @@ "Autogenerated Hashtags": "Hashtags autogenerados", "Autogenerated Content Warnings": "Advertencias de contenido generado automáticamente", "Indymedia": "Indymedia", - "Hashtag Blocked": "Hashtag bloqueada" + "Hashtag Blocked": "Hashtag bloqueada", + "This is a blogging instance": "" } diff --git a/translations/fr.json b/translations/fr.json index 4a1fb6cb..40c72961 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -287,5 +287,6 @@ "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é" + "Hashtag Blocked": "Hashtag bloqué", + "This is a blogging instance": "" } diff --git a/translations/ga.json b/translations/ga.json index 1c1266ba..b89e8700 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -287,5 +287,6 @@ "Autogenerated Hashtags": "Hashtags uathghinte", "Autogenerated Content Warnings": "Rabhaidh Ábhar Uathghinte", "Indymedia": "Indymedia", - "Hashtag Blocked": "Hashtag Blocáilte" + "Hashtag Blocked": "Hashtag Blocáilte", + "This is a blogging instance": "" } diff --git a/translations/hi.json b/translations/hi.json index bff59966..1d266056 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -287,5 +287,6 @@ "Autogenerated Hashtags": "ऑटोजेनरेटेड हैशटैग", "Autogenerated Content Warnings": "स्वतः प्राप्त सामग्री चेतावनी", "Indymedia": "Indymedia", - "Hashtag Blocked": "हैशटैग अवरुद्ध" + "Hashtag Blocked": "हैशटैग अवरुद्ध", + "This is a blogging instance": "" } diff --git a/translations/it.json b/translations/it.json index 08ff2618..f2fa2850 100644 --- a/translations/it.json +++ b/translations/it.json @@ -287,5 +287,6 @@ "Autogenerated Hashtags": "Hashtag generati automaticamente", "Autogenerated Content Warnings": "Avvisi sui contenuti generati automaticamente", "Indymedia": "Indymedia", - "Hashtag Blocked": "Hashtag bloccato" + "Hashtag Blocked": "Hashtag bloccato", + "This is a blogging instance": "" } diff --git a/translations/ja.json b/translations/ja.json index 382b43cc..dc263a9c 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -287,5 +287,6 @@ "Autogenerated Hashtags": "自動生成されたハッシュタグ", "Autogenerated Content Warnings": "自動生成されたコンテンツの警告", "Indymedia": "Indymedia", - "Hashtag Blocked": "ハッシュタグがブロックされました" + "Hashtag Blocked": "ハッシュタグがブロックされました", + "This is a blogging instance": "" } diff --git a/translations/oc.json b/translations/oc.json index 9a0cf46e..196cfb82 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -283,5 +283,6 @@ "Autogenerated Hashtags": "Autogenerated Hashtags", "Autogenerated Content Warnings": "Autogenerated Content Warnings", "Indymedia": "Indymedia", - "Hashtag Blocked": "Hashtag Blocked" + "Hashtag Blocked": "Hashtag Blocked", + "This is a blogging instance": "This is a blogging instance" } diff --git a/translations/pt.json b/translations/pt.json index 72314d67..c7038c35 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -287,5 +287,6 @@ "Autogenerated Hashtags": "Hashtags autogeradas", "Autogenerated Content Warnings": "Avisos de conteúdo gerado automaticamente", "Indymedia": "Indymedia", - "Hashtag Blocked": "Hashtag bloqueada" + "Hashtag Blocked": "Hashtag bloqueada", + "This is a blogging instance": "" } diff --git a/translations/ru.json b/translations/ru.json index cb7a0b21..773f95e4 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -287,5 +287,6 @@ "Autogenerated Hashtags": "Автоматически сгенерированные хештеги", "Autogenerated Content Warnings": "Автоматические предупреждения о содержании", "Indymedia": "Indymedia", - "Hashtag Blocked": "Хештег заблокирован" + "Hashtag Blocked": "Хештег заблокирован", + "This is a blogging instance": "" } diff --git a/translations/zh.json b/translations/zh.json index a171135f..d19e8e9d 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -287,5 +287,6 @@ "Autogenerated Hashtags": "自动生成的标签", "Autogenerated Content Warnings": "自动生成的内容警告", "Indymedia": "Indymedia", - "Hashtag Blocked": "标签被阻止" + "Hashtag Blocked": "标签被阻止", + "This is a blogging instance": "" } diff --git a/webinterface.py b/webinterface.py index 200ae4c1..30be726c 100644 --- a/webinterface.py +++ b/webinterface.py @@ -1230,6 +1230,7 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, notifyLikes = '' hideLikeButton = '' mediaInstanceStr = '' + blogsInstanceStr = '' displayNickname = nickname bioStr = '' donateUrl = '' @@ -1287,6 +1288,13 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, if mediaInstance: if mediaInstance is True: mediaInstanceStr = 'checked' + blogsInstanceStr = '' + + blogsInstance = getConfigParam(baseDir, "blogInstance") + if blogsInstance: + if blogsInstance is True: + blogsInstanceStr = 'checked' + mediaInstanceStr = '' filterStr = '' filterFilename = \ @@ -1607,6 +1615,19 @@ def htmlEditProfile(translate: {}, baseDir: str, path: str, editProfileForm += \ ' \n' editProfileForm += ' \n' + + if path.startswith('/users/' + adminNickname + '/'): + editProfileForm += '
\n' + editProfileForm += \ + ' ' + \ + translate['This is a media instance'] + '
\n' + editProfileForm += \ + ' ' + \ + translate['This is a blogging instance'] + '
\n' + editProfileForm += '
\n' + editProfileForm += '
\n' editProfileForm += \ ' ' + \ translate['Remove Twitter posts'] + '
\n' - if path.startswith('/users/' + adminNickname + '/'): - editProfileForm += \ - ' ' + \ - translate['This is a media instance'] + '
\n' editProfileForm += \ ' ' + \