@dshn/agent 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.js +13 -1
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -482,7 +482,6 @@ window.__ModuleLoader__.load({
|
|
|
482
482
|
function Panel(props) {
|
|
483
483
|
const s = props.status
|
|
484
484
|
const configured = s.configured
|
|
485
|
-
const apex = s.apex || 'ds.hn'
|
|
486
485
|
const [prefix, setPrefix] = react.useState(configured ? (s.subdomain || '') : '')
|
|
487
486
|
const [pw, setPw] = react.useState(configured ? (s.password || '') : '')
|
|
488
487
|
const [confirm, setConfirm] = react.useState('')
|
|
@@ -517,6 +516,19 @@ window.__ModuleLoader__.load({
|
|
|
517
516
|
if (rs.originCa && originCa === '') setOriginCa(rs.originCa)
|
|
518
517
|
}, [s.relaySettings && s.relaySettings.relayHost])
|
|
519
518
|
|
|
519
|
+
// The domain suffix reflects the self-hosted relay AS YOU TYPE it (a
|
|
520
|
+
// client-side mirror of the server's apex derivation), so the preview shows
|
|
521
|
+
// YOUR domain — not the default ds.hn — before you've connected. Empty →
|
|
522
|
+
// the server's current apex.
|
|
523
|
+
const apex = (() => {
|
|
524
|
+
const rh = relayHost.trim()
|
|
525
|
+
if (rh === '') return s.apex || 'ds.hn'
|
|
526
|
+
const bare = rh.replace(/^wss?:\/\//, '').replace(/:\d+$/, '').replace(/\/.*$/, '')
|
|
527
|
+
const parts = bare.split('.')
|
|
528
|
+
if (parts.length > 2 && (parts[0] === 'relay' || parts[0] === 'origin')) return parts.slice(1).join('.')
|
|
529
|
+
return bare || (s.apex || 'ds.hn')
|
|
530
|
+
})()
|
|
531
|
+
|
|
520
532
|
const copyText = (text, tag) => {
|
|
521
533
|
if (!text || !navigator.clipboard) return
|
|
522
534
|
navigator.clipboard.writeText(text).then(() => { setCopied(tag); setTimeout(() => setCopied(''), 1200) }).catch(() => {})
|