mirror of https://gitlab.com/bashrc2/epicyon
Import follows csv from profile screen
parent
8c522a78b7
commit
1cda2d740e
|
@ -1411,7 +1411,8 @@ def save_media_in_form_post(media_bytes, debug: bool,
|
|||
'ogg': 'audio/ogg',
|
||||
'opus': 'audio/opus',
|
||||
'flac': 'audio/flac',
|
||||
'zip': 'application/zip'
|
||||
'zip': 'application/zip',
|
||||
'csv': 'text/csv'
|
||||
}
|
||||
detected_extension = None
|
||||
for extension, content_type in extension_list.items():
|
||||
|
@ -1468,6 +1469,11 @@ def save_media_in_form_post(media_bytes, debug: bool,
|
|||
svg_str = svg_str.decode()
|
||||
if dangerous_svg(svg_str, False):
|
||||
return None, None
|
||||
elif detected_extension == 'csv':
|
||||
csv_str = media_bytes[start_pos:]
|
||||
csv_str = svg_str.decode()
|
||||
if ',' not in csv_str:
|
||||
return None, None
|
||||
|
||||
try:
|
||||
with open(filename, 'wb') as fp_media:
|
||||
|
|
23
daemon.py
23
daemon.py
|
@ -5505,6 +5505,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
'banner', 'search_banner',
|
||||
'instanceLogo',
|
||||
'left_col_image', 'right_col_image',
|
||||
'submitImportFollows'
|
||||
'submitImportTheme'
|
||||
)
|
||||
profile_media_types_uploaded = {}
|
||||
|
@ -5518,18 +5519,18 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
|
||||
if debug:
|
||||
print('DEBUG: profile update extracting ' + m_type +
|
||||
' image, zip or font from POST')
|
||||
' image, zip, csv or font from POST')
|
||||
media_bytes, post_bytes = \
|
||||
extract_media_in_form_post(post_bytes, boundary, m_type)
|
||||
if media_bytes:
|
||||
if debug:
|
||||
print('DEBUG: profile update ' + m_type +
|
||||
' image, zip or font was found. ' +
|
||||
' image, zip, csv or font was found. ' +
|
||||
str(len(media_bytes)) + ' bytes')
|
||||
else:
|
||||
if debug:
|
||||
print('DEBUG: profile update, no ' + m_type +
|
||||
' image, zip or font was found in POST')
|
||||
' image, zip, csv or font was found in POST')
|
||||
continue
|
||||
|
||||
# Note: a .temp extension is used here so that at no
|
||||
|
@ -5549,6 +5550,10 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
except OSError:
|
||||
print('EX: _profile_edit unable to delete ' +
|
||||
filename_base)
|
||||
elif m_type == 'submitImportFollows':
|
||||
filename_base = \
|
||||
acct_dir(base_dir, nickname, domain) + \
|
||||
'/import_following.csv'
|
||||
else:
|
||||
filename_base = \
|
||||
acct_dir(base_dir, nickname, domain) + \
|
||||
|
@ -5559,10 +5564,18 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
filename_base)
|
||||
if filename:
|
||||
print('Profile update POST ' + m_type +
|
||||
' media, zip or font filename is ' + filename)
|
||||
' media, zip, csv or font filename is ' + filename)
|
||||
else:
|
||||
print('Profile update, no ' + m_type +
|
||||
' media, zip or font filename in POST')
|
||||
' media, zip, csv or font filename in POST')
|
||||
continue
|
||||
|
||||
if m_type == 'submitImportFollows':
|
||||
if os.path.isfile(filename_base):
|
||||
print(nickname + ' imported follows csv')
|
||||
else:
|
||||
print('WARN: failed to import follows from csv for ' +
|
||||
nickname)
|
||||
continue
|
||||
|
||||
if m_type == 'submitImportTheme':
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "ستتم إضافة تحذيرات المحتوى لما يلي",
|
||||
"nowplaying": "الان العب",
|
||||
"NowPlaying": "الان العب",
|
||||
"Import and Export": "استيراد وتصدير"
|
||||
"Import and Export": "استيراد وتصدير",
|
||||
"Import Follows": "يتبع الاستيراد"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "নিম্নলিখিত জন্য বিষয়বস্তু সতর্কতা যোগ করা হবে",
|
||||
"nowplaying": "এখন চলছে",
|
||||
"NowPlaying": "এখন চলছে",
|
||||
"Import and Export": "আমদানি এবং রপ্তানি"
|
||||
"Import and Export": "আমদানি এবং রপ্তানি",
|
||||
"Import Follows": "আমদানি অনুসরণ করে"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "S'afegiran advertències de contingut per al següent",
|
||||
"nowplaying": "arajugant",
|
||||
"NowPlaying": "AraJugant",
|
||||
"Import and Export": "Importació i Exportació"
|
||||
"Import and Export": "Importació i Exportació",
|
||||
"Import Follows": "Segueix la importació"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Bydd rhybuddion cynnwys yn cael eu hychwanegu ar gyfer y canlynol",
|
||||
"nowplaying": "nawrynchwarae",
|
||||
"NowPlaying": "NawrYnChwarae",
|
||||
"Import and Export": "Mewnforio ac Allforio"
|
||||
"Import and Export": "Mewnforio ac Allforio",
|
||||
"Import Follows": "Mewnforio Dilyn"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Inhaltswarnungen werden für Folgendes hinzugefügt",
|
||||
"nowplaying": "läuftgerade",
|
||||
"NowPlaying": "LäuftGerade",
|
||||
"Import and Export": "Import und Export"
|
||||
"Import and Export": "Import und Export",
|
||||
"Import Follows": "Import folgt"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Θα προστεθούν προειδοποιήσεις περιεχομένου για τα ακόλουθα",
|
||||
"nowplaying": "τώραπαίζει",
|
||||
"NowPlaying": "ΤώραΠαίζει",
|
||||
"Import and Export": "Εισάγω και εξάγω"
|
||||
"Import and Export": "Εισάγω και εξάγω",
|
||||
"Import Follows": "Ακολουθεί εισαγωγή"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Content warnings will be added for the following",
|
||||
"nowplaying": "nowplaying",
|
||||
"NowPlaying": "NowPlaying",
|
||||
"Import and Export": "Import and Export"
|
||||
"Import and Export": "Import and Export",
|
||||
"Import Follows": "Import Follows"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Se agregarán advertencias de contenido para lo siguiente",
|
||||
"nowplaying": "jugandoahora",
|
||||
"NowPlaying": "JugandoAhora",
|
||||
"Import and Export": "Importar y exportar"
|
||||
"Import and Export": "Importar y exportar",
|
||||
"Import Follows": "Importar seguimientos"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Des avertissements de contenu seront ajoutés pour les éléments suivants",
|
||||
"nowplaying": "lectureencours",
|
||||
"NowPlaying": "LectureEnCours",
|
||||
"Import and Export": "Importer et exporter"
|
||||
"Import and Export": "Importer et exporter",
|
||||
"Import Follows": "Importer suit"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Cuirfear rabhaidh ábhair leis maidir leis na nithe seo a leanas",
|
||||
"nowplaying": "anoisagimirt",
|
||||
"NowPlaying": "AnoisAgImirt",
|
||||
"Import and Export": "Iompórtáil agus Easpórtáil"
|
||||
"Import and Export": "Iompórtáil agus Easpórtáil",
|
||||
"Import Follows": "Leanann Iompórtáil"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "निम्नलिखित के लिए सामग्री चेतावनियां जोड़ दी जाएंगी",
|
||||
"nowplaying": "अब खेल रहे हैं",
|
||||
"NowPlaying": "अब खेल रहे हैं",
|
||||
"Import and Export": "आयात और निर्यात"
|
||||
"Import and Export": "आयात और निर्यात",
|
||||
"Import Follows": "आयात का अनुसरण करता है"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Verranno aggiunti avvisi sui contenuti per quanto segue",
|
||||
"nowplaying": "ora giocando",
|
||||
"NowPlaying": "OraGiocando",
|
||||
"Import and Export": "Importazione e esportazione"
|
||||
"Import and Export": "Importazione e esportazione",
|
||||
"Import Follows": "Importa segue"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "以下のコンテンツ警告が追加されます",
|
||||
"nowplaying": "再生中",
|
||||
"NowPlaying": "再生中",
|
||||
"Import and Export": "インポートとエクスポート"
|
||||
"Import and Export": "インポートとエクスポート",
|
||||
"Import Follows": "インポートフォロー"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "다음에 대한 콘텐츠 경고가 추가됩니다.",
|
||||
"nowplaying": "지금 재생",
|
||||
"NowPlaying": "지금 재생",
|
||||
"Import and Export": "가져오기 및 내보내기"
|
||||
"Import and Export": "가져오기 및 내보내기",
|
||||
"Import Follows": "가져오기 팔로우"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Hişyariyên naverokê dê ji bo jêrîn werin zêdekirin",
|
||||
"nowplaying": "nihadilîze",
|
||||
"NowPlaying": "NihaDilîze",
|
||||
"Import and Export": "Import û Export"
|
||||
"Import and Export": "Import û Export",
|
||||
"Import Follows": "Import Follows"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Er worden inhoudswaarschuwingen toegevoegd voor het volgende:",
|
||||
"nowplaying": "nuaanhetspelen",
|
||||
"NowPlaying": "NuAanHetSpelen",
|
||||
"Import and Export": "Importeren en exporteren"
|
||||
"Import and Export": "Importeren en exporteren",
|
||||
"Import Follows": "Volgt importeren"
|
||||
}
|
||||
|
|
|
@ -566,5 +566,6 @@
|
|||
"Content warnings will be added for the following": "Content warnings will be added for the following",
|
||||
"nowplaying": "nowplaying",
|
||||
"NowPlaying": "NowPlaying",
|
||||
"Import and Export": "Import and Export"
|
||||
"Import and Export": "Import and Export",
|
||||
"Import Follows": "Import Follows"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Ostrzeżenia dotyczące treści zostaną dodane do następujących",
|
||||
"nowplaying": "terazgra",
|
||||
"NowPlaying": "TerazGra",
|
||||
"Import and Export": "Importuj i eksportuj"
|
||||
"Import and Export": "Importuj i eksportuj",
|
||||
"Import Follows": "Importuj obserwuje"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Avisos de conteúdo serão adicionados para os seguintes",
|
||||
"nowplaying": "agorajogando",
|
||||
"NowPlaying": "AgoraJogando",
|
||||
"Import and Export": "Importar e exportar"
|
||||
"Import and Export": "Importar e exportar",
|
||||
"Import Follows": "Importar seguidores"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Предупреждения о содержании будут добавлены для следующих",
|
||||
"nowplaying": "сейчасиграет",
|
||||
"NowPlaying": "СейчасИграет",
|
||||
"Import and Export": "Импорт и экспорт"
|
||||
"Import and Export": "Импорт и экспорт",
|
||||
"Import Follows": "Импорт подписок"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Maonyo ya maudhui yataongezwa kwa yafuatayo",
|
||||
"nowplaying": "inachezasasa",
|
||||
"NowPlaying": "InachezaSasa",
|
||||
"Import and Export": "Ingiza na Hamisha"
|
||||
"Import and Export": "Ingiza na Hamisha",
|
||||
"Import Follows": "Ingiza Inafuata"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Aşağıdakiler için içerik uyarıları eklenecek",
|
||||
"nowplaying": "şimdioynuyor",
|
||||
"NowPlaying": "ŞimdiOynuyor",
|
||||
"Import and Export": "İthalat ve ihracat"
|
||||
"Import and Export": "İthalat ve ihracat",
|
||||
"Import Follows": "Takipleri İçe Aktar"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "Попередження про вміст буде додано для наступних",
|
||||
"nowplaying": "заразграє",
|
||||
"NowPlaying": "ЗаразГрає",
|
||||
"Import and Export": "Імпорт та експорт"
|
||||
"Import and Export": "Імпорт та експорт",
|
||||
"Import Follows": "Імпорт слідує"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "אינהאַלט וואָרנינגז וועט זיין מוסיף פֿאַר די פאלגענדע",
|
||||
"nowplaying": "איצט פּלייַינג",
|
||||
"NowPlaying": "איצט פּלייַינג",
|
||||
"Import and Export": "אַרייַנפיר און עקספּאָרט"
|
||||
"Import and Export": "אַרייַנפיר און עקספּאָרט",
|
||||
"Import Follows": "אַרייַנפיר גייט"
|
||||
}
|
||||
|
|
|
@ -570,5 +570,6 @@
|
|||
"Content warnings will be added for the following": "将为以下内容添加内容警告",
|
||||
"nowplaying": "现在玩",
|
||||
"NowPlaying": "现在玩",
|
||||
"Import and Export": "进出口"
|
||||
"Import and Export": "进出口",
|
||||
"Import Follows": "导入关注"
|
||||
}
|
||||
|
|
|
@ -2003,6 +2003,14 @@ def _html_edit_profile_import_export(nickname: str, domain: str,
|
|||
"""Contact Information section of edit profile screen
|
||||
"""
|
||||
edit_profile_form = begin_edit_section(translate['Import and Export'])
|
||||
|
||||
edit_profile_form += \
|
||||
'<p><label class="labels">' + \
|
||||
translate['Import Follows'] + '</label>\n'
|
||||
edit_profile_form += '<input type="file" id="import_follows" '
|
||||
edit_profile_form += 'name="submitImportFollows" '
|
||||
edit_profile_form += 'accept=".csv"></p>\n'
|
||||
|
||||
edit_profile_form += \
|
||||
'<p><a href="/users/' + nickname + \
|
||||
'/followingaccounts"><label class="labels">' + \
|
||||
|
|
Loading…
Reference in New Issue