v0.9.0: the history lives in ~/Documents/bubble-data

On its first launch bubble copies ~/Documents/voipms-desktop-data to ~/Documents/bubble-data (through a .partial folder, renamed only once the copy is whole) and uses that. The old folder stays as a backup with a "MOVED TO bubble-data.txt" note, to delete once everything looks right. A data folder chosen in Settings elsewhere stays put; if the copy fails, bubble keeps using the old folder rather than starting empty.

Tried with a throwaway home holding the sandbox's made-up history: the copy, the note, the chats loading from the new folder, no second copy on the next launch, and a saved pointer to the old folder moving along with it.
This commit is contained in:
2026-11-13 12:15:09 -08:00
parent dd994c5bc3
commit bd10daeb8b
5 changed files with 49 additions and 8 deletions
+4 -4
View File
@@ -20,10 +20,10 @@ A Signal Desktop–style SMS client for [voip.ms](https://voip.ms). It keeps you
| What | Where | Backed up? |
|---|---|---|
| Message database | `~/Documents/voipms-desktop-data/messages.db` | ✅ Déjà Dup covers `~/Documents` |
| Daily snapshots, last 7 kept | `~/Documents/voipms-desktop-data/snapshots/` | ✅ |
| Settings | `~/Documents/voipms-desktop-data/settings.json` | ✅ |
| MMS photos and attachments (cached on arrival) | `~/Documents/voipms-desktop-data/media/` | ✅ |
| Message database | `~/Documents/bubble-data/messages.db` | ✅ Déjà Dup covers `~/Documents` |
| Daily snapshots, last 7 kept | `~/Documents/bubble-data/snapshots/` | ✅ |
| Settings | `~/Documents/bubble-data/settings.json` | ✅ |
| MMS photos and attachments (cached on arrival) | `~/Documents/bubble-data/media/` | ✅ |
| API password | GNOME Keyring (via Electron `safeStorage`) → `~/.config/voipms-desktop/credentials.bin` | ❌ on purpose; you re-enter it after a restore |
| Contact photo cache | `~/.config/voipms-desktop/photo-cache/` | ❌ not needed |
| Rabbit relay address, token and key | GNOME Keyring → `~/.config/voip.ms Messages/relay.bin` | ❌ on purpose; reconnect and Sync to Rabbit after a restore |
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "voipms-desktop",
"productName": "bubble",
"version": "0.8.8",
"version": "0.9.0",
"description": "Signal-style desktop SMS client for voip.ms",
"author": "trav <trav@teafry.me>",
"private": true,
Binary file not shown.
+2 -1
View File
@@ -16,7 +16,7 @@ import { MediaStore } from './media'
import { exportHtml, exportText, inRange, rangeLabel } from './export'
import { extFor, guessMime } from '@shared/mime'
import { clearCredentials, loadCredentials, saveCredentials } from './secrets'
import { getDataDir, loadSettings, saveSettings, setDataDir } from './settings'
import { getDataDir, loadSettings, moveToBubbleData, saveSettings, setDataDir } from './settings'
import { SyncEngine } from './sync'
import { loadZoom, saveZoom } from './uistate'
import { sendWithRetry } from './send'
@@ -798,6 +798,7 @@ app.on('second-instance', () => {
})
app.whenReady().then(async () => {
moveToBubbleData()
settings = loadSettings()
db = new MessageDb(path.join(getDataDir(), 'messages.db'))
if (SANDBOX) seedDemo(db)
+42 -2
View File
@@ -1,6 +1,6 @@
// Where the data lives + non-secret preferences.
//
// The message database defaults to ~/Documents/voipms-desktop-data so Déjà Dup
// The message database defaults to ~/Documents/bubble-data so Déjà Dup
// backs it up (it excludes ~/.config, ~/.local and ~/.cache). A small pointer
// file in Electron's userData remembers a custom location if one is chosen.
import { app } from 'electron'
@@ -19,7 +19,47 @@ const DEFAULTS: Settings = {
const pointerFile = (): string => path.join(app.getPath('userData'), 'data-location.json')
export function defaultDataDir(): string {
return path.join(app.getPath('documents'), 'voipms-desktop-data')
return path.join(app.getPath('documents'), 'bubble-data')
}
// Where it lived before the app was called bubble.
const OLD_NAME = 'voipms-desktop-data'
// Once, before anything opens the database: copy ~/Documents/voipms-desktop-data
// to ~/Documents/bubble-data (via a .partial folder, renamed only when the
// copy is whole) and use that. The old folder stays as a backup, with a note
// saying so, for its owner to delete. Only the default place moves: a folder
// chosen in Settings stays where it is. If the copy fails, carry on in the old
// folder rather than starting an empty history.
export function moveToBubbleData(): void {
if (process.env['VOIPMS_DATA_DIR']) return
const old = path.join(app.getPath('documents'), OLD_NAME)
const dest = defaultDataDir()
let pointed: string | undefined
try {
pointed = (JSON.parse(fs.readFileSync(pointerFile(), 'utf8')) as { dataDir?: string }).dataDir
} catch {
/* no pointer: the default place */
}
if (pointed && path.resolve(pointed) !== path.resolve(old)) return
if (!fs.existsSync(path.join(old, 'messages.db')) || fs.existsSync(dest)) return
const partial = `${dest}.partial`
try {
fs.rmSync(partial, { recursive: true, force: true }) // a copy cut short last time
console.log(`[data] copying ${old} to ${dest}`)
fs.cpSync(old, partial, { recursive: true, preserveTimestamps: true, errorOnExist: true })
fs.renameSync(partial, dest)
if (pointed) setDataDir(dest)
fs.writeFileSync(
path.join(old, 'MOVED TO bubble-data.txt'),
`bubble copied this folder to ${dest} on ${new Date().toString()} and uses that one now.\n` +
`This is the backup from before the move: once bubble looks right, it can be deleted.\n`
)
} catch (e) {
console.error('[data] copy to bubble-data failed; staying in the old folder:', e)
fs.rmSync(partial, { recursive: true, force: true })
setDataDir(old)
}
}
export function getDataDir(): string {