Preferences: one Accounts page (voip.ms, Google Voice, Numbers with checking), and jai gets its own page
This commit is contained in:
+1
-1
@@ -137,7 +137,7 @@ function startRelay(): void {
|
||||
// A text over the Rabbit's SIM: pending here until the Rabbit's next check
|
||||
// sends it and says how it went (relay.ts).
|
||||
function relaySend(contact: string, text: string, refs: MediaRef[]): void {
|
||||
if (!relay) throw new Error('The Rabbit relay is off: connect it in Settings → Rabbit.')
|
||||
if (!relay) throw new Error('The Rabbit relay is off: connect it in Settings → jai.')
|
||||
const kind = refs.length || isGroup(contact) ? 'mms' : 'sms'
|
||||
const tempId = db.insertPending({ did: SIM_DID, contact, direction: 'out', body: text, ts: Date.now(), kind, ...(refs.length ? { media: refs } : {}) })
|
||||
relay.send(tempId, contact, text, refs)
|
||||
|
||||
+1
-1
@@ -228,7 +228,7 @@ export class RelayEngine extends EventEmitter {
|
||||
body: JSON.stringify({ device: 'desktop', since, push: push.map((r) => r.blob) }),
|
||||
signal: AbortSignal.timeout(120_000)
|
||||
})
|
||||
if (res.status === 401) throw new Error('jai turned down the token. Check it in Settings → Rabbit.')
|
||||
if (res.status === 401) throw new Error('jai turned down the token. Check it in Settings → jai.')
|
||||
if (!res.ok) throw new Error(`jai answered ${res.status}`)
|
||||
const body = (await res.json()) as { cursor: number; events: string[]; more: boolean }
|
||||
// Only now that jai has them: out of the outbox.
|
||||
|
||||
@@ -18,7 +18,7 @@ export function SettingsDialog({ state, sync, onClose, onChanged }: Props) {
|
||||
const [s, setS] = useState<Settings>(state.settings)
|
||||
const [note, setNote] = useState<string>()
|
||||
const [page, setPage] = useState('Appearance')
|
||||
// voip.ms numbers; Google Voice has its own page.
|
||||
// voip.ms numbers; Google Voice has its own section.
|
||||
const smsDids = state.dids.filter((d) => d.smsEnabled && d.provider !== 'gvoice')
|
||||
|
||||
useEffect(() => {
|
||||
@@ -126,21 +126,14 @@ export function SettingsDialog({ state, sync, onClose, onChanged }: Props) {
|
||||
</section>
|
||||
</>
|
||||
),
|
||||
Account: (
|
||||
Accounts: (
|
||||
<>
|
||||
<section className="group">
|
||||
<h3>voip.ms</h3>
|
||||
<div className="kv">
|
||||
<span>voip.ms user</span>
|
||||
<span>{state.username}</span>
|
||||
</div>
|
||||
<div className="kv">
|
||||
<span>Messages stored</span>
|
||||
<span>{sync?.total.toLocaleString() ?? '—'}</span>
|
||||
</div>
|
||||
<div className="kv">
|
||||
<span>History import</span>
|
||||
<span>{sync?.backfillDone ? 'Complete' : sync?.backfillCursor ? `In progress (back to ${sync.backfillCursor})` : 'Pending'}</span>
|
||||
</div>
|
||||
<div className="kv">
|
||||
<span>Password stored in</span>
|
||||
<span>
|
||||
@@ -160,13 +153,12 @@ export function SettingsDialog({ state, sync, onClose, onChanged }: Props) {
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
),
|
||||
'Google Voice': <GoogleVoiceSection number={state.gvoiceNumber} status={sync?.gvoice} onChanged={onChanged} />,
|
||||
Contacts: <ContactsSection value={s.contactBook} onChange={(contactBook) => change({ ...s, contactBook })} />,
|
||||
...(smsDids.length > 0 && {
|
||||
Numbers: (
|
||||
<GoogleVoiceSection number={state.gvoiceNumber} status={sync?.gvoice} onChanged={onChanged} />
|
||||
<section className="group">
|
||||
<h3>Numbers to sync</h3>
|
||||
<h3>Numbers</h3>
|
||||
{smsDids.length > 0 && (
|
||||
<>
|
||||
<p className="muted small">Sync these voip.ms numbers:</p>
|
||||
{smsDids.map((d) => (
|
||||
<label key={d.did} className="did">
|
||||
<input
|
||||
@@ -185,6 +177,8 @@ export function SettingsDialog({ state, sync, onClose, onChanged }: Props) {
|
||||
<span className="muted">{d.description}</span>
|
||||
</label>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
{sendFrom.length > 1 && (
|
||||
<label className="field">
|
||||
Send new chats from
|
||||
@@ -198,12 +192,6 @@ export function SettingsDialog({ state, sync, onClose, onChanged }: Props) {
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
}),
|
||||
Sync: (
|
||||
<section className="group">
|
||||
<h3>Checking</h3>
|
||||
<label className="field">
|
||||
Check for new messages every
|
||||
<select value={s.pollSeconds} onChange={(e) => change({ ...s, pollSeconds: Number(e.target.value) })}>
|
||||
@@ -216,16 +204,28 @@ export function SettingsDialog({ state, sync, onClose, onChanged }: Props) {
|
||||
</label>
|
||||
<label className="field">
|
||||
Import history back to
|
||||
<input type="date" value={s.backfillFloor} onChange={(e) => e.target.value && change({ ...s, backfillFloor: e.target.value })} />
|
||||
<input
|
||||
type="date"
|
||||
value={s.backfillFloor}
|
||||
onChange={(e) => e.target.value && change({ ...s, backfillFloor: e.target.value })}
|
||||
/>
|
||||
</label>
|
||||
<div className="kv">
|
||||
<span>Messages stored</span>
|
||||
<span>{sync?.total.toLocaleString() ?? '—'}</span>
|
||||
</div>
|
||||
<div className="kv">
|
||||
<span>History import</span>
|
||||
<span>
|
||||
{sync?.backfillDone ? 'Complete' : sync?.backfillCursor ? `In progress (back to ${sync.backfillCursor})` : 'Pending'}
|
||||
</span>
|
||||
</div>
|
||||
</section>
|
||||
),
|
||||
Rabbit: (
|
||||
<>
|
||||
<RabbitSection onChanged={onChanged} />
|
||||
<RelaySection onChanged={onChanged} />
|
||||
</>
|
||||
),
|
||||
Contacts: <ContactsSection value={s.contactBook} onChange={(contactBook) => change({ ...s, contactBook })} />,
|
||||
Rabbit: <RabbitSection onChanged={onChanged} />,
|
||||
jai: <RelaySection onChanged={onChanged} />,
|
||||
Storage: (
|
||||
<section className="group">
|
||||
<h3>Storage & backups</h3>
|
||||
@@ -526,7 +526,7 @@ function RelaySection({ onChanged }: { onChanged: () => void }) {
|
||||
.relayConnect(url, token)
|
||||
.then(() => {
|
||||
setToken('')
|
||||
setDone('Connected. Now use Sync to Rabbit (above) once, with the Rabbit plugged in, so it gets the key.')
|
||||
setDone('Connected. Now use Sync to Rabbit (on the Rabbit page) once, with the Rabbit plugged in, so it gets the key.')
|
||||
refresh()
|
||||
onChanged()
|
||||
})
|
||||
@@ -550,7 +550,7 @@ function RelaySection({ onChanged }: { onChanged: () => void }) {
|
||||
: undefined
|
||||
return (
|
||||
<section className="group">
|
||||
<h3>Rabbit relay (jai)</h3>
|
||||
<h3>Rabbit relay</h3>
|
||||
<p className="muted small">
|
||||
Texts the Rabbit's SIM card sends and gets show up here, you can text from it here (as "Rabbit SIM"), and chat names and
|
||||
read/unread/archived stay in step with the Rabbit without plugging it in. It goes through jai, which only passes on sealed messages
|
||||
|
||||
Reference in New Issue
Block a user