fix(p2p): disable browser pure P2P by default

New browser sessions use IPFS gateway mode unless the user explicitly enables pure P2P in advanced settings.
This commit is contained in:
Tommaso Casaburi
2026-06-18 18:53:33 +07:00
parent 9896c4400b
commit 1c140035b4
5 changed files with 37 additions and 20 deletions
@@ -81,7 +81,26 @@ describe('useBrowserPureP2PAccountUpgrade', () => {
window.isElectron = false;
});
it('upgrades stale gateway browser accounts and reloads after saving', async () => {
it('does not upgrade stale gateway browser accounts when pure p2p is disabled by default', async () => {
testState.account = {
id: 'account-1',
name: 'Account 1',
pkcOptions: {
httpRoutersOptions: ['https://router.old.example'],
ipfsGatewayUrls: ['https://gateway.old.example'],
pubsubKuboRpcClientsOptions: ['https://pubsub.old.example/api/v0'],
},
};
testState.accounts = [testState.account];
await renderHook();
expect(testState.setAccountMock).not.toHaveBeenCalled();
expect(reloadMock).not.toHaveBeenCalled();
});
it('upgrades stale gateway browser accounts when pure p2p is enabled and reloads after saving', async () => {
localStorage.setItem('5chan:pure-p2p-browser-enabled', 'true');
testState.account = {
id: 'account-1',
name: 'Account 1',