mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
@@ -3,6 +3,7 @@ import type { FlagInfo } from './types';
|
||||
// const isNotStableBuild = BUILD_CONFIG.appBuildType !== 'stable';
|
||||
const isDesktopEnvironment = BUILD_CONFIG.isElectron;
|
||||
const isCanaryBuild = BUILD_CONFIG.appBuildType === 'canary';
|
||||
const isBetaBuild = BUILD_CONFIG.appBuildType === 'beta';
|
||||
const isMobile = BUILD_CONFIG.isMobileEdition;
|
||||
|
||||
export const AFFINE_FLAGS = {
|
||||
@@ -317,6 +318,13 @@ export const AFFINE_FLAGS = {
|
||||
configurable: isCanaryBuild,
|
||||
defaultState: false,
|
||||
},
|
||||
enable_cloud_indexer: {
|
||||
category: 'affine',
|
||||
displayName: 'Enable Cloud Indexer',
|
||||
description: 'Use cloud indexer to search docs',
|
||||
configurable: isBetaBuild || isCanaryBuild,
|
||||
defaultState: false,
|
||||
},
|
||||
} satisfies { [key in string]: FlagInfo };
|
||||
|
||||
// oxlint-disable-next-line no-redeclare
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { FeatureFlagService } from '@affine/core/modules/feature-flag';
|
||||
import { DebugLogger } from '@affine/debug';
|
||||
import {
|
||||
createWorkspaceMutation,
|
||||
@@ -85,6 +86,7 @@ const logger = new DebugLogger('affine:cloud-workspace-flavour-provider');
|
||||
class CloudWorkspaceFlavourProvider implements WorkspaceFlavourProvider {
|
||||
private readonly authService: AuthService;
|
||||
private readonly graphqlService: GraphQLService;
|
||||
private readonly featureFlagService: FeatureFlagService;
|
||||
private readonly unsubscribeAccountChanged: () => void;
|
||||
|
||||
constructor(
|
||||
@@ -93,6 +95,7 @@ class CloudWorkspaceFlavourProvider implements WorkspaceFlavourProvider {
|
||||
) {
|
||||
this.authService = server.scope.get(AuthService);
|
||||
this.graphqlService = server.scope.get(GraphQLService);
|
||||
this.featureFlagService = server.scope.get(FeatureFlagService);
|
||||
this.unsubscribeAccountChanged = this.server.scope.eventBus.on(
|
||||
AccountChanged,
|
||||
() => {
|
||||
@@ -474,14 +477,24 @@ class CloudWorkspaceFlavourProvider implements WorkspaceFlavourProvider {
|
||||
id: `${this.flavour}:${workspaceId}`,
|
||||
},
|
||||
},
|
||||
indexer: {
|
||||
name: 'IndexedDBIndexerStorage',
|
||||
opts: {
|
||||
flavour: this.flavour,
|
||||
type: 'workspace',
|
||||
id: workspaceId,
|
||||
},
|
||||
},
|
||||
indexer: this.featureFlagService.flags.enable_cloud_indexer.value
|
||||
? {
|
||||
name: 'CloudIndexerStorage',
|
||||
opts: {
|
||||
flavour: this.flavour,
|
||||
type: 'workspace',
|
||||
id: workspaceId,
|
||||
serverBaseUrl: this.server.serverMetadata.baseUrl,
|
||||
},
|
||||
}
|
||||
: {
|
||||
name: 'IndexedDBIndexerStorage',
|
||||
opts: {
|
||||
flavour: this.flavour,
|
||||
type: 'workspace',
|
||||
id: workspaceId,
|
||||
},
|
||||
},
|
||||
indexerSync: {
|
||||
name: 'IndexedDBIndexerSyncStorage',
|
||||
opts: {
|
||||
|
||||
Reference in New Issue
Block a user