mirror of
https://github.com/docmost/docmost.git
synced 2026-08-30 02:25:01 +08:00
feat(confluence-import): hide API importer behind BETA_CONFLUENCE_IMPORTER flag
This commit is contained in:
@@ -20,7 +20,7 @@ import {
|
|||||||
import { Link, useLocation } from "react-router-dom";
|
import { Link, useLocation } from "react-router-dom";
|
||||||
import classes from "./settings.module.css";
|
import classes from "./settings.module.css";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { isCloud } from "@/lib/config.ts";
|
import { isBetaConfluenceImporter, isCloud } from "@/lib/config.ts";
|
||||||
import useUserRole from "@/hooks/use-user-role.tsx";
|
import useUserRole from "@/hooks/use-user-role.tsx";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { entitlementAtom } from "@/ee/entitlement/entitlement-atom";
|
import { entitlementAtom } from "@/ee/entitlement/entitlement-atom";
|
||||||
@@ -52,6 +52,7 @@ type DataItem = {
|
|||||||
feature?: string;
|
feature?: string;
|
||||||
role?: "admin" | "owner";
|
role?: "admin" | "owner";
|
||||||
env?: "cloud" | "selfhosted";
|
env?: "cloud" | "selfhosted";
|
||||||
|
show?: () => boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type DataGroup = {
|
type DataGroup = {
|
||||||
@@ -132,6 +133,7 @@ const groupedData: DataGroup[] = [
|
|||||||
path: "/settings/import/confluence",
|
path: "/settings/import/confluence",
|
||||||
feature: Feature.CONFLUENCE_API_IMPORT,
|
feature: Feature.CONFLUENCE_API_IMPORT,
|
||||||
role: "admin",
|
role: "admin",
|
||||||
|
show: () => isBetaConfluenceImporter(),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -166,6 +168,7 @@ export default function SettingsSidebar() {
|
|||||||
entitlements?.features?.includes(f) ?? false;
|
entitlements?.features?.includes(f) ?? false;
|
||||||
|
|
||||||
const canShowItem = (item: DataItem) => {
|
const canShowItem = (item: DataItem) => {
|
||||||
|
if (item.show && !item.show()) return false;
|
||||||
if (item.env === "cloud" && !isCloud()) return false;
|
if (item.env === "cloud" && !isCloud()) return false;
|
||||||
if (item.env === "selfhosted" && isCloud()) return false;
|
if (item.env === "selfhosted" && isCloud()) return false;
|
||||||
if (item.role === "admin" && !isAdmin) return false;
|
if (item.role === "admin" && !isAdmin) return false;
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ export function isCloud(): boolean {
|
|||||||
return castToBoolean(getConfigValue("CLOUD"));
|
return castToBoolean(getConfigValue("CLOUD"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isBetaConfluenceImporter(): boolean {
|
||||||
|
return castToBoolean(getConfigValue("BETA_CONFLUENCE_IMPORTER"));
|
||||||
|
}
|
||||||
|
|
||||||
export function getAvatarUrl(
|
export function getAvatarUrl(
|
||||||
avatarUrl: string,
|
avatarUrl: string,
|
||||||
type: AvatarIconType = AvatarIconType.AVATAR,
|
type: AvatarIconType = AvatarIconType.AVATAR,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export default defineConfig(({ mode }) => {
|
|||||||
BILLING_TRIAL_DAYS,
|
BILLING_TRIAL_DAYS,
|
||||||
POSTHOG_HOST,
|
POSTHOG_HOST,
|
||||||
POSTHOG_KEY,
|
POSTHOG_KEY,
|
||||||
|
BETA_CONFLUENCE_IMPORTER,
|
||||||
} = loadEnv(mode, envPath, "");
|
} = loadEnv(mode, envPath, "");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -31,6 +32,7 @@ export default defineConfig(({ mode }) => {
|
|||||||
BILLING_TRIAL_DAYS,
|
BILLING_TRIAL_DAYS,
|
||||||
POSTHOG_HOST,
|
POSTHOG_HOST,
|
||||||
POSTHOG_KEY,
|
POSTHOG_KEY,
|
||||||
|
BETA_CONFLUENCE_IMPORTER
|
||||||
},
|
},
|
||||||
APP_VERSION: JSON.stringify(process.env.npm_package_version),
|
APP_VERSION: JSON.stringify(process.env.npm_package_version),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -194,6 +194,13 @@ export class EnvironmentService {
|
|||||||
return !this.isCloud();
|
return !this.isCloud();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isBetaConfluenceImporter(): boolean {
|
||||||
|
const flag = this.configService
|
||||||
|
.get<string>('BETA_CONFLUENCE_IMPORTER', 'false')
|
||||||
|
.toLowerCase();
|
||||||
|
return flag === 'true';
|
||||||
|
}
|
||||||
|
|
||||||
getStripePublishableKey(): string {
|
getStripePublishableKey(): string {
|
||||||
return this.configService.get<string>('STRIPE_PUBLISHABLE_KEY');
|
return this.configService.get<string>('STRIPE_PUBLISHABLE_KEY');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ export class StaticModule implements OnModuleInit {
|
|||||||
: undefined,
|
: undefined,
|
||||||
POSTHOG_HOST: this.environmentService.getPostHogHost(),
|
POSTHOG_HOST: this.environmentService.getPostHogHost(),
|
||||||
POSTHOG_KEY: this.environmentService.getPostHogKey(),
|
POSTHOG_KEY: this.environmentService.getPostHogKey(),
|
||||||
|
BETA_CONFLUENCE_IMPORTER:
|
||||||
|
this.environmentService.isBetaConfluenceImporter(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const windowScriptContent = `<script>window.CONFIG=${JSON.stringify(configString)};</script>`;
|
const windowScriptContent = `<script>window.CONFIG=${JSON.stringify(configString)};</script>`;
|
||||||
|
|||||||
Reference in New Issue
Block a user