import QtQuick import QtQuick.Layouts import qs.Common import qs.Widgets // Tor's own settings category, loaded by ChatSettings.qml's protocol rail. // There is exactly one embedded Tor client shared by the whole daemon (see // chatd-rs's net/tor.rs TorManager) - not one per account - so everything // here is daemon-global: which transport mode Sneedchat accounts use, and // actions on the shared circuit/client itself. Contrast with // SneedchatSettingsPanel.qml's "Channels" section, which is genuinely // per-account. ColumnLayout { id: root property var accounts: [] signal torConfigChanged(string torMode, string proxy) signal regenerateCircuitRequested() signal restartFromScratchRequested() readonly property var sockchatAccount: root.accounts.find(a => a.service === "sockchat") || null spacing: Theme.spacingXS StyledText { Layout.fillWidth: true text: "Tor" font.pixelSize: Theme.fontSizeLarge font.weight: Font.Bold color: Theme.surfaceVariantText } StyledText { Layout.fillWidth: true text: "Sneedchat is Tor-only. Embedded runs Tor in-process (no setup needed); an external proxy uses a Tor daemon or Tor Browser you already have running. This applies to every configured Sneedchat account." wrapMode: Text.WordWrap font.pixelSize: Theme.fontSizeSmall color: Theme.surfaceVariantText } RowLayout { Layout.fillWidth: true spacing: Theme.spacingS DankToggle { id: proxyToggle Layout.preferredHeight: height text: "Use an external SOCKS5 proxy instead of embedded Tor" checked: root.sockchatAccount ? root.sockchatAccount.torMode === "proxy" : false } } DankTextField { id: proxyField Layout.fillWidth: true visible: proxyToggle.checked placeholderText: "socks5h://127.0.0.1:9050" text: root.sockchatAccount ? (root.sockchatAccount.torProxy || "") : "" } DankButton { text: "Save connection settings" onClicked: { const mode = proxyToggle.checked ? "proxy" : "embedded"; root.torConfigChanged(mode, proxyToggle.checked ? proxyField.text : ""); } } Rectangle { Layout.fillWidth: true height: 1 color: Theme.outlineMedium } StyledText { Layout.fillWidth: true text: "Circuit" font.weight: Font.Medium color: Theme.surfaceVariantText } StyledText { Layout.fillWidth: true text: "Regenerate gets a fresh circuit using the existing cached consensus/guard data (fast). Restart from scratch also wipes that cache for a full cold bootstrap (can take up to a minute). Both reconnect every Sneedchat account afterward." wrapMode: Text.WordWrap font.pixelSize: Theme.fontSizeSmall color: Theme.surfaceVariantText } RowLayout { Layout.fillWidth: true spacing: Theme.spacingS DankButton { text: "Regenerate circuit" onClicked: root.regenerateCircuitRequested() } DankButton { text: "Restart Tor from scratch" onClicked: root.restartFromScratchRequested() } } }