mirror of
https://github.com/onionshare/onionshare.git
synced 2025-08-03 20:04:14 -04:00
Merge branch 'develop' into 1166_make_cancel_forceful
This commit is contained in:
commit
b3e5e8a629
152 changed files with 5816 additions and 1830 deletions
|
@ -64,6 +64,10 @@ def main():
|
|||
"""
|
||||
common = Common()
|
||||
|
||||
# Required for macOS Big Sur: https://stackoverflow.com/a/64878899
|
||||
if common.platform == "Darwin":
|
||||
os.environ["QT_MAC_WANTS_LAYER"] = "1"
|
||||
|
||||
# Display OnionShare banner
|
||||
print(f"OnionShare {common.version} | https://onionshare.org/")
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ from .widgets import Alert
|
|||
from .update_checker import UpdateThread
|
||||
from .tab_widget import TabWidget
|
||||
from .gui_common import GuiCommon
|
||||
from .threads import OnionCleanupThread
|
||||
|
||||
|
||||
class MainWindow(QtWidgets.QMainWindow):
|
||||
|
@ -285,8 +286,32 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||
e.accept()
|
||||
|
||||
def cleanup(self):
|
||||
self.common.log("MainWindow", "cleanup")
|
||||
self.tabs.cleanup()
|
||||
self.common.gui.onion.cleanup()
|
||||
|
||||
alert = Alert(
|
||||
self.common,
|
||||
strings._("gui_rendezvous_cleanup"),
|
||||
QtWidgets.QMessageBox.Information,
|
||||
buttons=QtWidgets.QMessageBox.NoButton,
|
||||
autostart=False,
|
||||
)
|
||||
quit_early_button = QtWidgets.QPushButton(
|
||||
strings._("gui_rendezvous_cleanup_quit_early")
|
||||
)
|
||||
alert.addButton(quit_early_button, QtWidgets.QMessageBox.RejectRole)
|
||||
|
||||
self.onion_cleanup_thread = OnionCleanupThread(self.common)
|
||||
self.onion_cleanup_thread.finished.connect(alert.accept)
|
||||
self.onion_cleanup_thread.start()
|
||||
|
||||
alert.exec_()
|
||||
if alert.clickedButton() == quit_early_button:
|
||||
self.common.log("MainWindow", "cleanup", "quitting early")
|
||||
if self.onion_cleanup_thread.isRunning():
|
||||
self.onion_cleanup_thread.terminate()
|
||||
self.onion_cleanup_thread.wait()
|
||||
self.common.gui.onion.cleanup(wait=False)
|
||||
|
||||
# Wait 1 second for threads to close gracefully, so tests finally pass
|
||||
time.sleep(1)
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
"gui_settings_autostop_timer_checkbox": "Utilitza un temporitzador d'aturada",
|
||||
"gui_settings_autostop_timer": "Atura a:",
|
||||
"settings_error_unknown": "No s'ha pogut connectar a Tor perquè la configuració és inconsistent.",
|
||||
"settings_error_automatic": "No s'ha pogut connectar al controlador de Tor. Heu iniciat el Tor Browser? (disponible a torproject.org)",
|
||||
"settings_error_automatic": "No s'ha pogut connectar al controlador de Tor. Heu iniciat el navegador Tor? (disponible a torproject.org)",
|
||||
"settings_error_socket_port": "No s'ha pogut establir la connexió al controlador de Tor a {}:{}.",
|
||||
"settings_error_socket_file": "No s'ha pogut connectar al controlador de Tor fent servir el fitxer de socket {}.",
|
||||
"settings_error_auth": "S'ha establert la connexió a {}:{} però ha fallat l'autenticació. Pot ser que no sigui un controlador de Tor?",
|
||||
|
@ -131,7 +131,7 @@
|
|||
"gui_tor_connection_error_settings": "Proveu de canviar la configuració de com OnionShare es connecta a la xarxa Tor.",
|
||||
"gui_tor_connection_canceled": "No s'ha pogut establir la connexió amb la xarxa Tor.\n\nAssegureu-vos que teniu connexió a internet, torneu a obrir l'OnionShare i prepareu la connexió a Tor.",
|
||||
"gui_tor_connection_lost": "S'ha perdut la connexió amb Tor.",
|
||||
"gui_server_started_after_autostop_timer": "El temporitzador de finalització automàtica ha acabat abans que s'iniciés el servidor.\nTorneu a compartir-ho.",
|
||||
"gui_server_started_after_autostop_timer": "El temporitzador de finalització automàtica ha acabat abans que s'iniciés el servidor. Torneu a compartir-ho.",
|
||||
"gui_server_autostop_timer_expired": "El temporitzador de finalització automàtica ja s'ha acabat. Ajusteu-lo per a poder compartir.",
|
||||
"share_via_onionshare": "Comparteix-ho amb l'OnionShare",
|
||||
"gui_use_legacy_v2_onions_checkbox": "Fes servir adreces amb un format antic",
|
||||
|
@ -280,5 +280,17 @@
|
|||
"gui_chat_stop_server": "Atura el servidor de xat",
|
||||
"gui_chat_start_server": "Inicia el servidor de xat",
|
||||
"gui_file_selection_remove_all": "Treu-ho tot",
|
||||
"gui_remove": "Treu"
|
||||
"gui_remove": "Treu",
|
||||
"error_port_not_available": "El port OnionShare no és disponible",
|
||||
"gui_tab_name_chat": "Xat",
|
||||
"gui_tab_name_website": "Lloc web",
|
||||
"gui_tab_name_receive": "Rep",
|
||||
"gui_tab_name_share": "Comparteix",
|
||||
"gui_main_page_chat_button": "Comença el xat",
|
||||
"gui_main_page_website_button": "Comença l'allotjatment",
|
||||
"gui_main_page_receive_button": "Comença la recepció",
|
||||
"gui_main_page_share_button": "Comença la compartició",
|
||||
"gui_new_tab_chat_button": "Xat anònim",
|
||||
"gui_open_folder_error": "No s'ha pogut obrir la carpeta amb xdg-open. El fitxer és aquí: {}",
|
||||
"gui_chat_url_description": "<b>Qualsevol persona</b> amb aquesta adreça OnionShare pot <b>unir-se a aquesta sala de xat</b> fent servir el <b>navegador Tor</b>: <img src='{}' />"
|
||||
}
|
||||
|
|
|
@ -287,5 +287,7 @@
|
|||
"gui_main_page_share_button": "Begynd at dele",
|
||||
"gui_main_page_receive_button": "Begynd at modtage",
|
||||
"gui_main_page_website_button": "Begynd at være vært",
|
||||
"gui_main_page_chat_button": "Begynd at chatte"
|
||||
"gui_main_page_chat_button": "Begynd at chatte",
|
||||
"gui_chat_url_description": "<b>Alle</b> med denne OnionShare-adresse kan <b>deltage i chatrummet</b> med <b>Tor Browser</b>: <img src='{}' />",
|
||||
"error_port_not_available": "OnionShare-port ikke tilgængelig"
|
||||
}
|
||||
|
|
|
@ -291,5 +291,6 @@
|
|||
"gui_open_folder_error": "Fehler beim Öffnen des Ordners mit xdg-open. Die Datei befindet sich hier: {}",
|
||||
"gui_qr_code_description": "Scanne diesen QR-Code mit einem QR-Scanner, wie zB. mit der Kamera deines Smartphones, um die OnionShare-Adresse einfacher mit anderen zu teilen.",
|
||||
"gui_receive_flatpak_data_dir": "Da OnionShare durch Flatpak installiert wurde, müssen Dateien im Verzeichnis ~/OnionShare gespeichert werden.",
|
||||
"gui_chat_url_description": "<b>Jeder</b>, der diese OnionShare-Adresse hat, kann <b>diesem Chatroom beitreten</b>, indem er den <b>Tor Browser</b> benutzt: <img src='{}' />"
|
||||
"gui_chat_url_description": "<b>Jeder</b>, der diese OnionShare-Adresse hat, kann <b>diesem Chatroom beitreten</b>, indem er den <b>Tor Browser</b> benutzt: <img src='{}' />",
|
||||
"error_port_not_available": "OnionShare-Port nicht verfügbar"
|
||||
}
|
||||
|
|
|
@ -188,5 +188,7 @@
|
|||
"settings_error_bundled_tor_not_supported": "Using the Tor version that comes with OnionShare does not work in developer mode on Windows or macOS.",
|
||||
"settings_error_bundled_tor_timeout": "Taking too long to connect to Tor. Maybe you aren't connected to the Internet, or have an inaccurate system clock?",
|
||||
"settings_error_bundled_tor_broken": "OnionShare could not connect to Tor:\n{}",
|
||||
"gui_rendezvous_cleanup": "Waiting for Tor circuits to close to be sure your files have successfully transferred.\n\nThis might take a few minutes.",
|
||||
"gui_rendezvous_cleanup_quit_early": "Quit Early",
|
||||
"error_port_not_available": "OnionShare port not available"
|
||||
}
|
|
@ -296,5 +296,6 @@
|
|||
"gui_main_page_website_button": "Empezar a alojar",
|
||||
"gui_main_page_receive_button": "Empezar a recibir",
|
||||
"gui_main_page_share_button": "Empezar a compartir",
|
||||
"gui_chat_url_description": "<b>Cualquiera</b> con esta dirección de OnionShare puede <b>puede unirse a este cuarto de chat</b> usando el <b>Navegador Tor</b>: <img src='{}' />"
|
||||
"gui_chat_url_description": "<b>Cualquiera</b> con esta dirección de OnionShare puede <b>puede unirse a este cuarto de chat</b> usando el <b>Navegador Tor</b>: <img src='{}' />",
|
||||
"error_port_not_available": "Puerto OnionShare no disponible"
|
||||
}
|
||||
|
|
|
@ -187,5 +187,6 @@
|
|||
"settings_error_unreadable_cookie_file": "Conectado ó controlador Tor, pero o contrasinal igual está mal, ou o teu usuario non ten permiso para ler o ficheiro de cookie.",
|
||||
"settings_error_bundled_tor_not_supported": "A versión Tor que ven con OnionShare non funciona en modo desenvolvedor en Windows ou macOS.",
|
||||
"settings_error_bundled_tor_timeout": "Tarda demasiado en conectar a Tor. Igual non tes conexión a Internet, ou o reloxo do sistema está mal axustado?",
|
||||
"settings_error_bundled_tor_broken": "OnionShare non puido conectar a Tor:\n{}"
|
||||
"settings_error_bundled_tor_broken": "OnionShare non puido conectar a Tor:\n{}",
|
||||
"error_port_not_available": "Non está dispoñible o porto OnionShare"
|
||||
}
|
||||
|
|
|
@ -229,5 +229,6 @@
|
|||
"gui_main_page_website_button": "Pokreni hosting",
|
||||
"gui_main_page_receive_button": "Pokreni primanje",
|
||||
"gui_main_page_share_button": "Pokreni dijeljenje",
|
||||
"gui_chat_url_description": "<b>Svatko</b> s ovom OnionShare adresom može se <b>pridružiti sobi za chat</b> koristeći <b>Tor preglednik</b>: <img src='{}' />"
|
||||
"gui_chat_url_description": "<b>Svatko</b> s ovom OnionShare adresom može se <b>pridružiti sobi za chat</b> koristeći <b>Tor preglednik</b>: <img src='{}' />",
|
||||
"error_port_not_available": "OnionShare priključak nije dostupan"
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
"gui_tor_connection_error_settings": "Tente mudar nas configurações a forma como OnionShare se conecta à rede Tor.",
|
||||
"gui_tor_connection_canceled": "Não foi possível conectar ao Tor.\n\nTenha certeza que você está conectado à Internet, então abra OnionShare novamente e configure sua conexão ao Tor.",
|
||||
"gui_tor_connection_lost": "Desconectado do Tor.",
|
||||
"gui_server_started_after_autostop_timer": "O tempo esgotou antes do servidor iniciar.\nPor favor, crie um novo compartilhamento.",
|
||||
"gui_server_started_after_autostop_timer": "O cronômetro de parada automática acabou antes que o servidor fosse iniciado. Por favor, faça um novo compartilhamento.",
|
||||
"gui_server_autostop_timer_expired": "O cronômetro já esgotou. Por favor, ajuste-o para começar a compartilhar.",
|
||||
"share_via_onionshare": "Compartilhar via OnionShare",
|
||||
"gui_use_legacy_v2_onions_checkbox": "Usar endereços do tipo antigo",
|
||||
|
@ -282,5 +282,7 @@
|
|||
"gui_chat_start_server": "Iniciar um servidor de conversas",
|
||||
"gui_file_selection_remove_all": "Remover tudo",
|
||||
"gui_remove": "Remover",
|
||||
"gui_tab_name_chat": "Bate-papo"
|
||||
"gui_tab_name_chat": "Bate-papo",
|
||||
"error_port_not_available": "Porta OnionShare não disponível",
|
||||
"gui_chat_url_description": "<b>Qualquer um</b> com este endereço OnionShare pode <b>entrar nesta sala de chat</b> usando o <b>Tor Browser</b>: <img src='{}' />"
|
||||
}
|
||||
|
|
|
@ -254,5 +254,6 @@
|
|||
"gui_tab_name_receive": "Al",
|
||||
"gui_tab_name_website": "Web Sitesi",
|
||||
"gui_tab_name_chat": "Sohbet",
|
||||
"gui_chat_url_description": "Bu OnionShare adresine sahip olan <b>herkes</b> <b>Tor Browser</b> kullanarak <b>bu sohbet odasına katılabilir</b>: <img src='{}' />"
|
||||
"gui_chat_url_description": "Bu OnionShare adresine sahip olan <b>herkes</b> <b>Tor Browser</b> kullanarak <b>bu sohbet odasına katılabilir</b>: <img src='{}' />",
|
||||
"error_port_not_available": "OnionShare bağlantı noktası kullanılamıyor"
|
||||
}
|
||||
|
|
|
@ -229,5 +229,6 @@
|
|||
"gui_main_page_chat_button": "Почати спілкуватися в чаті",
|
||||
"gui_main_page_website_button": "Почати хостинг",
|
||||
"gui_main_page_receive_button": "Почати отримання",
|
||||
"gui_chat_url_description": "<b>Будь-хто</b> за цією адресою OnionShare може <b>приєднатися до цієї бесіди</b> за допомогою <b>Tor Browser</b>: <img src='{}' />"
|
||||
"gui_chat_url_description": "<b>Будь-хто</b> за цією адресою OnionShare може <b>приєднатися до цієї бесіди</b> за допомогою <b>Tor Browser</b>: <img src='{}' />",
|
||||
"error_port_not_available": "Порт OnionShare недоступний"
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
"help_verbose": "将OnionShare错误日志记录到stdout,将web错误日志记录到磁盘",
|
||||
"help_filename": "要分享的文件或文件夹的列表",
|
||||
"help_config": "自定义JSON配置文件的路径(可选)",
|
||||
"gui_drag_and_drop": "拖动文件或文件夹\n以开始共享",
|
||||
"gui_drag_and_drop": "拖放文件和文件夹以开始共享",
|
||||
"gui_add": "添加",
|
||||
"gui_delete": "删除",
|
||||
"gui_choose_items": "选取",
|
||||
|
@ -243,7 +243,7 @@
|
|||
"mode_settings_autostop_timer_checkbox": "定时停止onion服务",
|
||||
"mode_settings_autostart_timer_checkbox": "定时起动onion服务",
|
||||
"mode_settings_public_checkbox": "不使用密码",
|
||||
"mode_settings_persistent_checkbox": "保存此标签,并在打开OnionShare时自动打开它。",
|
||||
"mode_settings_persistent_checkbox": "保存此标签,并在我打开OnionShare时自动打开它",
|
||||
"mode_settings_advanced_toggle_hide": "隐藏高级选项",
|
||||
"mode_settings_advanced_toggle_show": "显示高级选项",
|
||||
"gui_quit_warning_cancel": "取消",
|
||||
|
@ -270,5 +270,17 @@
|
|||
"gui_chat_start_server": "开始言论服务器",
|
||||
"gui_file_selection_remove_all": "删除所有",
|
||||
"gui_remove": "删除",
|
||||
"gui_qr_code_dialog_title": "Onionshare 二维码"
|
||||
"gui_qr_code_dialog_title": "Onionshare 二维码",
|
||||
"error_port_not_available": "OnionShare端口不可用",
|
||||
"gui_tab_name_chat": "聊天",
|
||||
"gui_tab_name_website": "网站",
|
||||
"gui_tab_name_receive": "接收",
|
||||
"gui_tab_name_share": "分享",
|
||||
"gui_main_page_chat_button": "开始聊天",
|
||||
"gui_main_page_website_button": "开始托管",
|
||||
"gui_main_page_receive_button": "开始接收",
|
||||
"gui_main_page_share_button": "开始分享",
|
||||
"gui_new_tab_chat_button": "匿名聊天",
|
||||
"gui_open_folder_error": "用xdg-open打开文件夹失败。文件在这里: {}",
|
||||
"gui_chat_url_description": "<b>任何</b>有这个OnionShare地址的人均可 <b>加入这个聊天室</b>,方法是使用<b>Tor浏览器</b>:<img src='{}' />"
|
||||
}
|
||||
|
|
|
@ -107,6 +107,12 @@ class Mode(QtWidgets.QWidget):
|
|||
"""
|
||||
pass
|
||||
|
||||
def get_type(self):
|
||||
"""
|
||||
Returns the type of mode as a string (e.g. "share", "receive", etc.)
|
||||
"""
|
||||
pass
|
||||
|
||||
def human_friendly_time(self, secs):
|
||||
"""
|
||||
Returns a human-friendly time delta from given seconds.
|
||||
|
|
|
@ -101,6 +101,12 @@ class ChatMode(Mode):
|
|||
self.wrapper_layout.addLayout(self.column_layout)
|
||||
self.setLayout(self.wrapper_layout)
|
||||
|
||||
def get_type(self):
|
||||
"""
|
||||
Returns the type of mode as a string (e.g. "share", "receive", etc.)
|
||||
"""
|
||||
return "chat"
|
||||
|
||||
def get_stop_server_autostop_timer_text(self):
|
||||
"""
|
||||
Return the string to put on the stop server button, if there's an auto-stop timer
|
||||
|
|
|
@ -149,6 +149,12 @@ class ReceiveMode(Mode):
|
|||
self.wrapper_layout.addLayout(self.column_layout)
|
||||
self.setLayout(self.wrapper_layout)
|
||||
|
||||
def get_type(self):
|
||||
"""
|
||||
Returns the type of mode as a string (e.g. "share", "receive", etc.)
|
||||
"""
|
||||
return "receive"
|
||||
|
||||
def data_dir_button_clicked(self):
|
||||
"""
|
||||
Browse for a new OnionShare data directory, and save to tab settings
|
||||
|
|
|
@ -173,6 +173,12 @@ class ShareMode(Mode):
|
|||
# Always start with focus on file selection
|
||||
self.file_selection.setFocus()
|
||||
|
||||
def get_type(self):
|
||||
"""
|
||||
Returns the type of mode as a string (e.g. "share", "receive", etc.)
|
||||
"""
|
||||
return "share"
|
||||
|
||||
def autostop_sharing_checkbox_clicked(self):
|
||||
"""
|
||||
Save autostop sharing setting to the tab settings
|
||||
|
|
|
@ -173,6 +173,12 @@ class WebsiteMode(Mode):
|
|||
# Always start with focus on file selection
|
||||
self.file_selection.setFocus()
|
||||
|
||||
def get_type(self):
|
||||
"""
|
||||
Returns the type of mode as a string (e.g. "share", "receive", etc.)
|
||||
"""
|
||||
return "website"
|
||||
|
||||
def disable_csp_checkbox_clicked(self):
|
||||
"""
|
||||
Save disable CSP setting to the tab settings
|
||||
|
|
|
@ -669,7 +669,9 @@ class Tab(QtWidgets.QWidget):
|
|||
return False
|
||||
|
||||
def cleanup(self):
|
||||
self.common.log("Tab", "cleanup", f"tab_id={self.tab_id}")
|
||||
if self.get_mode() and self.get_mode().web_thread:
|
||||
self.get_mode().web.stop(self.get_mode().app.port)
|
||||
self.get_mode().web_thread.quit()
|
||||
self.get_mode().web_thread.wait()
|
||||
self.app.cleanup()
|
||||
|
|
|
@ -81,6 +81,8 @@ class TabWidget(QtWidgets.QTabWidget):
|
|||
self.event_handler_t.start()
|
||||
|
||||
def cleanup(self):
|
||||
self.common.log("TabWidget", "cleanup")
|
||||
|
||||
# Stop the event thread
|
||||
self.event_handler_t.should_quit = True
|
||||
self.event_handler_t.quit()
|
||||
|
|
|
@ -77,7 +77,7 @@ class OnionThread(QtCore.QThread):
|
|||
try:
|
||||
if self.mode.obtain_onion_early:
|
||||
self.mode.app.start_onion_service(
|
||||
self.mode.settings, await_publication=False
|
||||
self.mode.get_type(), self.mode.settings, await_publication=False
|
||||
)
|
||||
# wait for modules in thread to load, preventing a thread-related cx_Freeze crash
|
||||
time.sleep(0.2)
|
||||
|
@ -86,7 +86,7 @@ class OnionThread(QtCore.QThread):
|
|||
self.mode.app.stop_onion_service(self.mode.settings)
|
||||
else:
|
||||
self.mode.app.start_onion_service(
|
||||
self.mode.settings, await_publication=True
|
||||
self.mode.get_type(), self.mode.settings, await_publication=True
|
||||
)
|
||||
# wait for modules in thread to load, preventing a thread-related cx_Freeze crash
|
||||
time.sleep(0.2)
|
||||
|
@ -258,3 +258,18 @@ class EventHandlerThread(QtCore.QThread):
|
|||
if self.should_quit:
|
||||
break
|
||||
time.sleep(0.2)
|
||||
|
||||
|
||||
class OnionCleanupThread(QtCore.QThread):
|
||||
"""
|
||||
Wait for Tor rendezvous circuits to close in a separate thread
|
||||
"""
|
||||
|
||||
def __init__(self, common):
|
||||
super(OnionCleanupThread, self).__init__()
|
||||
self.common = common
|
||||
self.common.log("OnionCleanupThread", "__init__")
|
||||
|
||||
def run(self):
|
||||
self.common.log("OnionCleanupThread", "run")
|
||||
self.common.gui.onion.cleanup()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue