mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 20:16:26 +08:00
feat: improve admin panel (#14180)
This commit is contained in:
@@ -57,7 +57,7 @@ export enum Feature {
|
||||
|
||||
// TODO(@forehalo): may merge `FeatureShapes` and `FeatureConfigs`?
|
||||
export const FeaturesShapes = {
|
||||
early_access: z.object({ whitelist: z.array(z.string()) }),
|
||||
early_access: z.object({ whitelist: z.array(z.string()).readonly() }),
|
||||
unlimited_workspace: EMPTY_CONFIG,
|
||||
unlimited_copilot: EMPTY_CONFIG,
|
||||
ai_early_access: EMPTY_CONFIG,
|
||||
@@ -88,86 +88,81 @@ export type FeatureConfig<T extends FeatureName> = z.infer<
|
||||
(typeof FeaturesShapes)[T]
|
||||
>;
|
||||
|
||||
const FreeFeature = {
|
||||
type: FeatureType.Quota,
|
||||
configs: {
|
||||
// quota name
|
||||
name: 'Free',
|
||||
blobLimit: 10 * OneMB,
|
||||
businessBlobLimit: 100 * OneMB,
|
||||
storageQuota: 10 * OneGB,
|
||||
historyPeriod: 7 * OneDay,
|
||||
memberLimit: 3,
|
||||
copilotActionLimit: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
const ProFeature = {
|
||||
type: FeatureType.Quota,
|
||||
configs: {
|
||||
name: 'Pro',
|
||||
blobLimit: 100 * OneMB,
|
||||
storageQuota: 100 * OneGB,
|
||||
historyPeriod: 30 * OneDay,
|
||||
memberLimit: 10,
|
||||
copilotActionLimit: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
const LifetimeProFeature = {
|
||||
type: FeatureType.Quota,
|
||||
configs: {
|
||||
name: 'Lifetime Pro',
|
||||
blobLimit: 100 * OneMB,
|
||||
storageQuota: 1024 * OneGB,
|
||||
historyPeriod: 30 * OneDay,
|
||||
memberLimit: 10,
|
||||
copilotActionLimit: 10,
|
||||
},
|
||||
} as const;
|
||||
|
||||
const TeamFeature = {
|
||||
type: FeatureType.Quota,
|
||||
configs: {
|
||||
name: 'Team Workspace',
|
||||
blobLimit: 500 * OneMB,
|
||||
storageQuota: 100 * OneGB,
|
||||
seatQuota: 20 * OneGB,
|
||||
historyPeriod: 30 * OneDay,
|
||||
memberLimit: 1,
|
||||
},
|
||||
} as const;
|
||||
|
||||
const WhitelistFeature = {
|
||||
type: FeatureType.Feature,
|
||||
configs: { whitelist: [] },
|
||||
} as const;
|
||||
|
||||
const EmptyFeature = {
|
||||
type: FeatureType.Feature,
|
||||
configs: {},
|
||||
} as const;
|
||||
|
||||
export const FeatureConfigs: {
|
||||
[K in FeatureName]: {
|
||||
type: FeatureType;
|
||||
configs: FeatureConfig<K>;
|
||||
deprecatedVersion: number;
|
||||
};
|
||||
} = {
|
||||
free_plan_v1: {
|
||||
type: FeatureType.Quota,
|
||||
deprecatedVersion: 4,
|
||||
configs: {
|
||||
// quota name
|
||||
name: 'Free',
|
||||
blobLimit: 10 * OneMB,
|
||||
businessBlobLimit: 100 * OneMB,
|
||||
storageQuota: 10 * OneGB,
|
||||
historyPeriod: 7 * OneDay,
|
||||
memberLimit: 3,
|
||||
copilotActionLimit: 10,
|
||||
},
|
||||
},
|
||||
pro_plan_v1: {
|
||||
type: FeatureType.Quota,
|
||||
deprecatedVersion: 2,
|
||||
configs: {
|
||||
name: 'Pro',
|
||||
blobLimit: 100 * OneMB,
|
||||
storageQuota: 100 * OneGB,
|
||||
historyPeriod: 30 * OneDay,
|
||||
memberLimit: 10,
|
||||
copilotActionLimit: 10,
|
||||
},
|
||||
},
|
||||
lifetime_pro_plan_v1: {
|
||||
type: FeatureType.Quota,
|
||||
deprecatedVersion: 1,
|
||||
configs: {
|
||||
name: 'Lifetime Pro',
|
||||
blobLimit: 100 * OneMB,
|
||||
storageQuota: 1024 * OneGB,
|
||||
historyPeriod: 30 * OneDay,
|
||||
memberLimit: 10,
|
||||
copilotActionLimit: 10,
|
||||
},
|
||||
},
|
||||
team_plan_v1: {
|
||||
type: FeatureType.Quota,
|
||||
deprecatedVersion: 1,
|
||||
configs: {
|
||||
name: 'Team Workspace',
|
||||
blobLimit: 500 * OneMB,
|
||||
storageQuota: 100 * OneGB,
|
||||
seatQuota: 20 * OneGB,
|
||||
historyPeriod: 30 * OneDay,
|
||||
memberLimit: 1,
|
||||
},
|
||||
},
|
||||
early_access: {
|
||||
type: FeatureType.Feature,
|
||||
deprecatedVersion: 2,
|
||||
configs: { whitelist: [] },
|
||||
},
|
||||
unlimited_workspace: {
|
||||
type: FeatureType.Feature,
|
||||
deprecatedVersion: 1,
|
||||
configs: {},
|
||||
},
|
||||
unlimited_copilot: {
|
||||
type: FeatureType.Feature,
|
||||
deprecatedVersion: 1,
|
||||
configs: {},
|
||||
},
|
||||
ai_early_access: {
|
||||
type: FeatureType.Feature,
|
||||
deprecatedVersion: 1,
|
||||
configs: {},
|
||||
},
|
||||
administrator: {
|
||||
type: FeatureType.Feature,
|
||||
deprecatedVersion: 1,
|
||||
configs: {},
|
||||
get free_plan_v1() {
|
||||
return env.selfhosted ? ProFeature : FreeFeature;
|
||||
},
|
||||
pro_plan_v1: ProFeature,
|
||||
lifetime_pro_plan_v1: LifetimeProFeature,
|
||||
team_plan_v1: TeamFeature,
|
||||
early_access: WhitelistFeature,
|
||||
unlimited_workspace: EmptyFeature,
|
||||
unlimited_copilot: EmptyFeature,
|
||||
ai_early_access: EmptyFeature,
|
||||
administrator: EmptyFeature,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user