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