mirror of https://gitlab.com/bashrc2/epicyon
Show list of peertube instances on admin profile
parent
670bbd2984
commit
3d16d93d86
25
daemon.py
25
daemon.py
|
@ -4565,6 +4565,27 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if os.path.isfile(allowedInstancesFilename):
|
||||
os.remove(allowedInstancesFilename)
|
||||
|
||||
# save peertube instances list
|
||||
peertubeInstancesFilename = \
|
||||
baseDir + '/accounts/peertube.txt'
|
||||
if fields.get('ptInstances'):
|
||||
self.server.peertubeInstances.clear()
|
||||
with open(peertubeInstancesFilename, 'w+') as aFile:
|
||||
aFile.write(fields['ptInstances'])
|
||||
ptInstancesList = fields['ptInstances'].split('\n')
|
||||
if ptInstancesList:
|
||||
for url in ptInstancesList:
|
||||
url = url.strip()
|
||||
if not url:
|
||||
continue
|
||||
if url in self.server.peertubeInstances:
|
||||
continue
|
||||
self.server.peertubeInstances.append(url)
|
||||
else:
|
||||
if os.path.isfile(peertubeInstancesFilename):
|
||||
os.remove(peertubeInstancesFilename)
|
||||
self.server.peertubeInstances.clear()
|
||||
|
||||
# save git project names list
|
||||
gitProjectsFilename = \
|
||||
baseDir + '/accounts/' + \
|
||||
|
@ -9381,6 +9402,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
"""Show the edit profile screen
|
||||
"""
|
||||
if '/users/' in path and path.endswith('/editprofile'):
|
||||
peertubeInstances = self.server.peertubeInstances
|
||||
msg = htmlEditProfile(self.server.cssCache,
|
||||
translate,
|
||||
baseDir,
|
||||
|
@ -9388,7 +9410,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
port,
|
||||
httpPrefix,
|
||||
self.server.defaultTimeline,
|
||||
self.server.themeName).encode('utf-8')
|
||||
self.server.themeName,
|
||||
peertubeInstances).encode('utf-8')
|
||||
if msg:
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "تصفية الكلمات",
|
||||
"Unfilter": "غير مرشح",
|
||||
"Unfilter words": "الكلمات غير المصفاة",
|
||||
"Show Accounts": "إظهار الحسابات"
|
||||
"Show Accounts": "إظهار الحسابات",
|
||||
"Peertube Instances": "مثيلات Peertube",
|
||||
"Show video previews for the following Peertube sites.": "إظهار معاينات الفيديو لمواقع Peertube التالية."
|
||||
}
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "Filtra les paraules",
|
||||
"Unfilter": "Sense filtre",
|
||||
"Unfilter words": "Paraules sense filtre",
|
||||
"Show Accounts": "Mostra comptes"
|
||||
"Show Accounts": "Mostra comptes",
|
||||
"Peertube Instances": "Instàncies de Peertube",
|
||||
"Show video previews for the following Peertube sites.": "Mostra les previsualitzacions de vídeo dels següents llocs de Peertube."
|
||||
}
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "Hidlo geiriau",
|
||||
"Unfilter": "Di-hid",
|
||||
"Unfilter words": "Geiriau di-hid",
|
||||
"Show Accounts": "Dangos Cyfrifon"
|
||||
"Show Accounts": "Dangos Cyfrifon",
|
||||
"Peertube Instances": "Camau Peertube",
|
||||
"Show video previews for the following Peertube sites.": "Dangos rhagolygon fideo ar gyfer y safleoedd Peertube canlynol."
|
||||
}
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "Wörter herausfiltern",
|
||||
"Unfilter": "Filter entfernen",
|
||||
"Unfilter words": "Wörter herausfiltern",
|
||||
"Show Accounts": "Konten anzeigen"
|
||||
"Show Accounts": "Konten anzeigen",
|
||||
"Peertube Instances": "Peertube-Instanzen",
|
||||
"Show video previews for the following Peertube sites.": "Zeigen Sie eine Videovorschau für die folgenden Peertube-Websites an."
|
||||
}
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "Filter out words",
|
||||
"Unfilter": "Unfilter",
|
||||
"Unfilter words": "Unfilter words",
|
||||
"Show Accounts": "Show Accounts"
|
||||
"Show Accounts": "Show Accounts",
|
||||
"Peertube Instances": "Peertube Instances",
|
||||
"Show video previews for the following Peertube sites.": "Show video previews for the following Peertube sites."
|
||||
}
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "Filtrar palabras",
|
||||
"Unfilter": "Unfilter",
|
||||
"Unfilter words": "Palabras sin filtrar",
|
||||
"Show Accounts": "Mostrar cuentas"
|
||||
"Show Accounts": "Mostrar cuentas",
|
||||
"Peertube Instances": "Instancias de Peertube",
|
||||
"Show video previews for the following Peertube sites.": "Muestre vistas previas de video para los siguientes sitios de Peertube."
|
||||
}
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "Filtrer les mots",
|
||||
"Unfilter": "Non filtrer",
|
||||
"Unfilter words": "Mots non filtrés",
|
||||
"Show Accounts": "Afficher les comptes"
|
||||
"Show Accounts": "Afficher les comptes",
|
||||
"Peertube Instances": "Instances Peertube",
|
||||
"Show video previews for the following Peertube sites.": "Afficher des aperçus vidéo pour les sites Peertube suivants."
|
||||
}
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "Scag focail amach",
|
||||
"Unfilter": "Neamhleithleach",
|
||||
"Unfilter words": "Focail neamhleithleacha",
|
||||
"Show Accounts": "Taispeáin Cuntais"
|
||||
"Show Accounts": "Taispeáin Cuntais",
|
||||
"Peertube Instances": "Imeachtaí Peertube",
|
||||
"Show video previews for the following Peertube sites.": "Taispeáin réamhamharcanna físe do na suíomhanna Peertube seo a leanas."
|
||||
}
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "शब्दों को फ़िल्टर करें",
|
||||
"Unfilter": "Unfilter",
|
||||
"Unfilter words": "अनफ़िल्टर शब्द",
|
||||
"Show Accounts": "खाते दिखाएं"
|
||||
"Show Accounts": "खाते दिखाएं",
|
||||
"Peertube Instances": "Peertube उदाहरण",
|
||||
"Show video previews for the following Peertube sites.": "निम्नलिखित Peertube साइटों के लिए वीडियो पूर्वावलोकन दिखाएं।"
|
||||
}
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "Filtra le parole",
|
||||
"Unfilter": "Unfilter",
|
||||
"Unfilter words": "Parole non filtrate",
|
||||
"Show Accounts": "Mostra account"
|
||||
"Show Accounts": "Mostra account",
|
||||
"Peertube Instances": "Istanze di Peertube",
|
||||
"Show video previews for the following Peertube sites.": "Mostra le anteprime dei video per i seguenti siti Peertube."
|
||||
}
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "単語を除外する",
|
||||
"Unfilter": "フィルタリング解除",
|
||||
"Unfilter words": "単語のフィルタリングを解除する",
|
||||
"Show Accounts": "アカウントを表示する"
|
||||
"Show Accounts": "アカウントを表示する",
|
||||
"Peertube Instances": "Peertubeインスタンス",
|
||||
"Show video previews for the following Peertube sites.": "次のPeertubeサイトのビデオプレビューを表示します。"
|
||||
}
|
||||
|
|
|
@ -343,5 +343,7 @@
|
|||
"Filter out words": "Filter out words",
|
||||
"Unfilter": "Unfilter",
|
||||
"Unfilter words": "Unfilter words",
|
||||
"Show Accounts": "Show Accounts"
|
||||
"Show Accounts": "Show Accounts",
|
||||
"Peertube Instances": "Peertube Instances",
|
||||
"Show video previews for the following Peertube sites.": "Show video previews for the following Peertube sites."
|
||||
}
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "Filtrar palavras",
|
||||
"Unfilter": "Unfilter",
|
||||
"Unfilter words": "Palavras sem filtro",
|
||||
"Show Accounts": "Mostrar contas"
|
||||
"Show Accounts": "Mostrar contas",
|
||||
"Peertube Instances": "Instâncias Peertube",
|
||||
"Show video previews for the following Peertube sites.": "Mostrar visualizações de vídeo para os seguintes sites Peertube."
|
||||
}
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "Отфильтровать слова",
|
||||
"Unfilter": "Нефильтровать",
|
||||
"Unfilter words": "Не фильтровать слова",
|
||||
"Show Accounts": "Показать счета"
|
||||
"Show Accounts": "Показать счета",
|
||||
"Peertube Instances": "Экземпляры Peertube",
|
||||
"Show video previews for the following Peertube sites.": "Показать превью видео для следующих сайтов Peertube."
|
||||
}
|
||||
|
|
|
@ -347,5 +347,7 @@
|
|||
"Filter out words": "过滤掉单词",
|
||||
"Unfilter": "取消过滤",
|
||||
"Unfilter words": "未过滤字词",
|
||||
"Show Accounts": "显示帐户"
|
||||
"Show Accounts": "显示帐户",
|
||||
"Peertube Instances": "Peertube实例",
|
||||
"Show video previews for the following Peertube sites.": "显示以下Peertube网站的视频预览。"
|
||||
}
|
||||
|
|
|
@ -20,11 +20,24 @@ def loadPeertubeInstances(baseDir: str, peertubeInstances: []) -> None:
|
|||
if peertubeStr:
|
||||
peertubeStr = peertubeStr.replace('\r', '')
|
||||
peertubeList = peertubeStr.split('\n')
|
||||
if peertubeList:
|
||||
for url in peertubeList:
|
||||
if url in peertubeInstances:
|
||||
continue
|
||||
peertubeInstances.append(url)
|
||||
if not peertubeList:
|
||||
return
|
||||
for url in peertubeList:
|
||||
if url in peertubeInstances:
|
||||
continue
|
||||
peertubeInstances.append(url)
|
||||
|
||||
|
||||
def savePeertubeInstances(baseDir: str, peertubeInstances: []) -> None:
|
||||
"""Saves peertube instances to file from the given list
|
||||
"""
|
||||
peertubeStr = ''
|
||||
for url in peertubeInstances:
|
||||
peertubeStr += url.strip() + '\n'
|
||||
|
||||
peertubeInstancesFilename = baseDir + '/accounts/peertube.txt'
|
||||
with open(peertubeInstancesFilename, 'w+') as fp:
|
||||
fp.write(peertubeStr)
|
||||
|
||||
|
||||
def _addEmbeddedVideoFromSites(translate: {}, content: str,
|
||||
|
|
|
@ -836,7 +836,8 @@ def _htmlProfileShares(actor: str, translate: {},
|
|||
|
||||
def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
|
||||
domain: str, port: int, httpPrefix: str,
|
||||
defaultTimeline: str, theme: str) -> str:
|
||||
defaultTimeline: str, theme: str,
|
||||
peertubeInstances: []) -> str:
|
||||
"""Shows the edit profile screen
|
||||
"""
|
||||
imageFormats = getImageFormats()
|
||||
|
@ -1427,6 +1428,20 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
|
|||
' <input type="text" name="ytdomain" value="' + \
|
||||
YTReplacementDomain + '">\n'
|
||||
|
||||
editProfileForm += \
|
||||
' <br><b><label class="labels">' + \
|
||||
translate['Peertube Instances'] + '</label></b>\n'
|
||||
idx = 'Show video previews for the following Peertube sites.'
|
||||
editProfileForm += \
|
||||
' <br><label class="labels">' + \
|
||||
translate[idx] + '</label>\n'
|
||||
peertubeInstancesStr = ''
|
||||
for url in peertubeInstances:
|
||||
peertubeInstancesStr += url + '\n'
|
||||
editProfileForm += \
|
||||
' <textarea id="message" name="ptInstances" ' + \
|
||||
'style="height:200px">' + peertubeInstancesStr + '</textarea>\n'
|
||||
|
||||
editProfileForm += ' </div>\n'
|
||||
editProfileForm += ' <div class="container">\n'
|
||||
editProfileForm += \
|
||||
|
|
Loading…
Reference in New Issue