feat: add Tor rotate button to all services, not just archipelago

Every enabled Tor service now shows a Rotate button that instantly
creates a new .onion address and decommissions the old one. Previously
only the main 'archipelago' service had this button.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dorian 2026-03-16 17:07:40 +00:00
parent 01f81a1912
commit 2e753c8d70

View File

@ -354,12 +354,12 @@
</div> </div>
<div class="flex items-center gap-2 shrink-0"> <div class="flex items-center gap-2 shrink-0">
<button <button
v-if="svc.name === 'archipelago'" v-if="svc.onion_address && svc.enabled"
@click="rotateNodeAddress" @click="rotateService(svc.name)"
:disabled="torRotating" :disabled="torRotating === svc.name"
class="glass-button px-3 py-1.5 rounded-lg text-xs" class="glass-button px-3 py-1.5 rounded-lg text-xs"
> >
{{ torRotating ? 'Rotating...' : 'Rotate' }} {{ torRotating === svc.name ? 'Rotating...' : 'Rotate' }}
</button> </button>
<label class="tor-toggle-label"> <label class="tor-toggle-label">
<input <input
@ -809,7 +809,7 @@ async function loadTorServices() {
} }
} }
const torRotating = ref(false) const torRotating = ref<string | false>(false)
function copyTorAddress(address: string) { function copyTorAddress(address: string) {
navigator.clipboard.writeText(address) navigator.clipboard.writeText(address)
@ -826,10 +826,10 @@ async function toggleTorApp(appId: string, enabled: boolean) {
} }
} }
async function rotateNodeAddress() { async function rotateService(name: string) {
torRotating.value = true torRotating.value = name
try { try {
await rpcClient.call({ method: 'tor.rotate-service', params: { name: 'archipelago' } }) await rpcClient.call({ method: 'tor.rotate-service', params: { name } })
await loadTorServices() await loadTorServices()
} catch (e) { } catch (e) {
if (import.meta.env.DEV) console.warn('Failed to rotate Tor address:', e) if (import.meta.env.DEV) console.warn('Failed to rotate Tor address:', e)