From bd10daeb8b4a8fc2efdc13892121f3a95a84983b Mon Sep 17 00:00:00 2001 From: trav Date: Fri, 13 Nov 2026 12:15:09 -0800 Subject: [PATCH] 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. --- README.md | 8 +++--- package.json | 2 +- resources/android/VoipMessages.apk | Bin 226007 -> 226007 bytes src/main/index.ts | 3 +- src/main/settings.ts | 44 +++++++++++++++++++++++++++-- 5 files changed, 49 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1bfd795..b1db07d 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/package.json b/package.json index 6b6ede2..20cac4d 100644 --- a/package.json +++ b/package.json @@ -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 ", "private": true, diff --git a/resources/android/VoipMessages.apk b/resources/android/VoipMessages.apk index 09ef9decd5f18d857f16a29f97dfb88f571e9cbd..6dd51bc17301b4c749a14befdbf54d04f20bea9f 100644 GIT binary patch delta 701 zcmccql=u2m-i9rVr#3R(No+r}k#YN(jZ7yO0Xf^JhcH_+ff!f9m_t}V46SHpHdcjK zjBY#6wBK{8+@0ES=jm_jwTo8W_*M7s|Lm25IV{|+N4EzgFsn1y*B0C?IbOn3q$rfY z7NlJLO52s`-OB6xnUnUIJdfe=5dG-w;F`5?g@)p{H!u6je`I$x&7W5n#bdUzElT14 zbk@ckNzb#=EOl)U=dHV8?(k>njsu2izLHum+f=0^xK4aM{^;d5$369mi(@*Mb(ZTd zSRNg+)GYFISd3}Aepk~QueCtGGte4rDlRrT&gPW5;8pN(QNCu{O-VoHwx$Wr6xKN(WL z#rbH`Ux$~gLtnf+^jvtNhpf}e{IEka54z-ZyxOl|>G|`A+}_9SChK_D#Pf6K*v)sW z+2-V6#{PqyyWr10CcBMiW}Vq?*<{(1!ENlQ^)htA#(&WdSX-8D%72l?Z4}hG1NlYadK_R!79hl^%pD$!K2hkiw%nl&h OtBBbVME4dkdjS9(R!Ttt delta 701 zcmccql=u2m-i9rVr#3Q~CbXZ~$hiH?My8XCfSm2qLzu0ZK#VJ4%poiwhE_B)8>@o< zf@y~4SG0})8eLv<|D1$NmKC3atj=6tKkM@rp6~wl6IL7u zcre4OTg7RMyX5uc{+x9>cNeqv9=v?F(}QcG@Wy9X=Ebht>b~KVc<-7@PMcY$l5bRA znexHooaL9dA(zkJ+MR9kyr=xm#&?_hFD$x#w%-2#qqEE{>vQTlkNkF#UL^a0iN)bH z`={R=3nB%p_s&_Zdh2s;l89`5qV3%kGPOZ>HnfE%^X8Y^{5jk)+pRChu&(#T!m8Ec z&C0X9{%w5g>~v+4o`P9&iOUb)OEcH`xNe+j#maX0%%gztD0Kx%<&|!7yDl(DR|Ut- zelp3}qq^fapSwt5m}g`F^Zw`OIX2AA$eC|^^T<^Px7iPhIWm8?A5jr{c;S8~Khq8G z?E+cMT8z^drZQ^~6==-N)8Aw;tJF_QmktQnrC^g1oHVC%=Hdm?U-rKCn-jB?*GJQ@ zI;5nUDMGeaO!$IsoYc~_oe!Iwqvzh3Ip;{rGgA(gu=pZIrNuLSR`~0b3S3*U>0j`~ z;1gYU{+RC(5B=oFvC#U_<9~;hIqtFQm%840+2OrW?WbV+v{;OAJi@n{N?|*tjlx2Ke+VzT{_?oVKb8i-1uGBSe zAL;)+cBAr<{A<6|tpz>{`;%luryKBuYncW{hUI1Z=t#v!Z*NFx$-Qan?>e_6CF7j@ ze(Mx&-#o2YnU#I#84k2exEvkMW&5*+*LQh5)A{9~klV`+OmfrD7c!fJXpSOg2N3O5 M#Ow&7dyAO80P&kSSO5S3 diff --git a/src/main/index.ts b/src/main/index.ts index f59131f..f8e016b 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -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) diff --git a/src/main/settings.ts b/src/main/settings.ts index b1bf5fa..288bb83 100644 --- a/src/main/settings.ts +++ b/src/main/settings.ts @@ -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 {