Skip to content

Commit 607aacf

Browse files
committed
Merge branch 'develop' of gitlab.futo.org:polycentric/polycentric into develop
2 parents 7404471 + 21c3545 commit 607aacf

31 files changed

Lines changed: 597 additions & 37686 deletions

File tree

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ packages/react-native/lib
1616
packages/rs-core
1717
packages/rs-core-wasm-browser
1818
packages/rs-core-wasm-node
19+
packages/js-core/src/proto/polycentric.ts
20+
packages/js-core/src/proto/polycentric/v2
1921
legacy

apps/polycentric/src/common/components/composites/IdentityBadge.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ export function IdentityBadge({
3232
return (
3333
<View style={[Atoms.flex_row, Atoms.items_center, rowGap, { flex: 1 }]}>
3434
{showAvatar && (
35-
<ProfileAvatar
36-
identityKey={identityKey}
37-
size={sizeConfig.avatarSize}
38-
/>
35+
<ProfileAvatar identityKey={identityKey} size={sizeConfig.avatarSize} />
3936
)}
4037
<View
4138
style={[

apps/polycentric/src/common/components/layout/Layout.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
11
import { Atoms, Breakpoints, typography, useTheme } from '@/src/common/theme';
22
import { isWeb } from '@/src/common/util/platform';
3+
import { Image } from 'expo-image';
34
import { ExternalPathString, Link } from 'expo-router';
45
import {
56
ComponentProps,
67
memo,
78
ReactElement,
89
ReactNode,
910
useCallback,
10-
useMemo,
1111
useState,
1212
} from 'react';
1313
import {
1414
KeyboardAvoidingView,
15-
Linking,
1615
Platform,
1716
Pressable,
18-
Text,
1917
useWindowDimensions,
2018
View,
2119
} from 'react-native';
22-
import { Image } from 'expo-image';
2320
import { useSafeAreaInsets } from 'react-native-safe-area-context';
2421

25-
import WEB_LOGO from '../../assets/images/WebLogo.png';
2622
import { VerticalNav } from './nav/VerticalNav';
23+
import { Button } from '../primitives';
24+
import { IdentityFooter } from '@/src/features/core/identity/IdentityFooter';
2725
import { Ionicons } from '@expo/vector-icons';
26+
import WEB_LOGO from '../../assets/images/WebLogo.png';
2827
import { FUTO_URL, openCompose } from '../../constants';
29-
import { Button } from '../primitives';
3028
import { useCurrentIdentity } from '../../lib/polycentric-hooks';
31-
import { IdentityFooter } from '@/src/features/core/identity/IdentityFooter';
3229

3330
type MainProps = {
3431
children: ReactElement | ReactElement[];
@@ -63,7 +60,7 @@ function Main({ children, style }: MainProps) {
6360
<View
6461
style={[
6562
Atoms.flex_1,
66-
Atoms.flex_row,
63+
showRightSidebar && Atoms.flex_row,
6764
Atoms.justify_between,
6865
{ width: innerWidth },
6966
]}
@@ -257,7 +254,7 @@ export const RightSidebar = memo(function RightSidebar({
257254
setActiveThemeName(next);
258255
}, [setActiveThemeName, theme.name]);
259256

260-
const LINKS: { text: ReactNode; href: ExternalPathString }[] = [
257+
const LINKS: { text: string; href: ExternalPathString }[] = [
261258
{
262259
text: 'Privacy Policy',
263260
href: 'https://docs.polycentric.io/privacy-policy/',
@@ -266,7 +263,7 @@ export const RightSidebar = memo(function RightSidebar({
266263
text: 'Source Code',
267264
href: 'https://gitlab.futo.org/polycentric/polycentric',
268265
},
269-
{ text: <Text>FUTO &copy; 2026.</Text>, href: FUTO_URL },
266+
{ text: 'FUTO © 2026.', href: FUTO_URL },
270267
];
271268

272269
return (

apps/polycentric/src/common/lib/polycentric-hooks/PolycentricProvider.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ export function PolycentricProvider({
139139

140140
if (cancelled) return;
141141

142+
c.servers = [DEFAULT_SERVER];
143+
142144
const s = createPolycentricStore(c);
143145
await s.getState().refreshIdentities();
144146

apps/polycentric/src/common/lib/polycentric-hooks/helpers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ export function pickImageVariant(
134134
): v2.Image | null {
135135
if (!imageSet || imageSet.images.length === 0) return null;
136136
const sorted = [...imageSet.images].sort((a, b) => a.width - b.width);
137-
return sorted.find((img) => img.width >= targetSize) ?? sorted[sorted.length - 1]!;
137+
return (
138+
sorted.find((img) => img.width >= targetSize) ?? sorted[sorted.length - 1]!
139+
);
138140
}
139141

140142
export function timeAgo(unixMs: number): string {

packages/js-browser/src/storage/indexeddb/storage-driver.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,38 @@ export class IndexedDBStorageDriver implements IStorageDriver {
4040
createEventAckRepository() {
4141
return new IndexedDBEventAckRepository(this.database);
4242
}
43+
44+
saveActiveIdentityKey(
45+
publicKey: Uint8Array,
46+
identityKey: string | null,
47+
): void {
48+
try {
49+
const key = IndexedDBStorageDriver.activeIdentityKey(publicKey);
50+
if (identityKey) {
51+
localStorage.setItem(key, identityKey);
52+
} else {
53+
localStorage.removeItem(key);
54+
}
55+
} catch {}
56+
}
57+
58+
loadActiveIdentityKey(publicKey: Uint8Array): string | null {
59+
try {
60+
return localStorage.getItem(
61+
IndexedDBStorageDriver.activeIdentityKey(publicKey),
62+
);
63+
} catch {
64+
return null;
65+
}
66+
}
67+
68+
private static activeIdentityKey(publicKey: Uint8Array): string {
69+
return `polycentric:activeIdentity:${IndexedDBStorageDriver.toHex(publicKey, 32)}`;
70+
}
71+
72+
private static toHex(bytes: Uint8Array, len = 8): string {
73+
return Array.from(bytes.slice(0, len))
74+
.map((b) => b.toString(16).padStart(2, '0'))
75+
.join('');
76+
}
4377
}

packages/js-browser/test/opfs-sqlite-database.test.ts

Lines changed: 0 additions & 213 deletions
This file was deleted.

packages/js-core/src/client-internal/identity-manager.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ export class IdentityManager {
110110

111111
await this.client.storage.content.save(digest, content);
112112
const signedEvent = await this.client.signEvent(event);
113-
await this.client.commitEvent(signedEvent, content);
114-
115113
this.client.setActiveIdentityKey(identityKey);
114+
await this.client.commitEvent(signedEvent, content);
116115

117116
return { identityKey, signedEvent };
118117
}
@@ -314,5 +313,4 @@ export class IdentityManager {
314313
}
315314
return true;
316315
}
317-
318316
}

packages/js-core/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ export type * from './platform-interfaces';
2727
export { StorageHandle } from './storage';
2828
export type { Repositories } from './storage';
2929

30-
export type { DatabaseSchema } from './schemas/v1';
31-
export { schemaV1 as polycentricSchema } from './schemas/v1';
32-
3330
export { PolycentricClient } from './polycentric-client';
3431
export type {
3532
PolycentricClientConfig,

packages/js-core/src/platform-interfaces/runtime-core.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,7 @@ export interface IPolycentricCore {
178178
* @param server_url - Base URL of the gRPC-web server
179179
* @param request_bytes - Serialized `UploadBlobRequest` proto bytes
180180
*/
181-
upload_blob(
182-
server_url: string,
183-
request_bytes: Uint8Array,
184-
): Promise<void>;
181+
upload_blob(server_url: string, request_bytes: Uint8Array): Promise<void>;
185182

186183
/**
187184
* Fetch a server's public info (version, CDN URL) over gRPC-web.

0 commit comments

Comments
 (0)