fix: client indexing & outdated scheme (#14160)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Optimized storage handling with platform-specific
implementations—SQLite for Electron and IndexedDB for other environments
for improved performance.

* **Bug Fixes**
* Enhanced recording file access and retrieval functionality for better
reliability.
  * Strengthened local file protocol handling and security restrictions.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2025-12-27 17:56:42 +08:00
committed by GitHub
parent 78949044ec
commit 702dbf7be4
7 changed files with 85 additions and 57 deletions
@@ -6,7 +6,6 @@ import queryString from 'query-string';
function maybeAffineOrigin(origin: string, baseUrl: string) {
return (
origin.startsWith('file://') ||
origin.startsWith('assets://') ||
origin.endsWith('affine.pro') || // stable/beta
origin.endsWith('apple.getaffineapp.com') || // stable/beta
@@ -19,6 +19,7 @@ import {
IndexedDBBlobSyncStorage,
IndexedDBDocStorage,
IndexedDBDocSyncStorage,
IndexedDBIndexerStorage,
} from '@affine/nbstore/idb';
import {
IndexedDBV1BlobStorage,
@@ -29,6 +30,7 @@ import {
SqliteBlobSyncStorage,
SqliteDocStorage,
SqliteDocSyncStorage,
SqliteIndexerStorage,
} from '@affine/nbstore/sqlite';
import {
SqliteV1BlobStorage,
@@ -130,6 +132,9 @@ class CloudWorkspaceFlavourProvider implements WorkspaceFlavourProvider {
BUILD_CONFIG.isElectron || BUILD_CONFIG.isIOS || BUILD_CONFIG.isAndroid
? SqliteBlobSyncStorage
: IndexedDBBlobSyncStorage;
IndexerStorageType = BUILD_CONFIG.isElectron
? SqliteIndexerStorage
: IndexedDBIndexerStorage;
async deleteWorkspace(id: string): Promise<void> {
await this.graphqlService.gql({
@@ -481,7 +486,7 @@ class CloudWorkspaceFlavourProvider implements WorkspaceFlavourProvider {
},
},
indexer: {
name: 'IndexedDBIndexerStorage',
name: this.IndexerStorageType.identifier,
opts: {
flavour: this.flavour,
type: 'workspace',