Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/components/app/publish-manage/PublishManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import PublishedPages from '@/components/app/publish-manage/PublishedPages';
import PublishPagesSkeleton from '@/components/app/publish-manage/PublishPagesSkeleton';
import UpdateNamespace from '@/components/app/publish-manage/UpdateNamespace';
import { useCurrentUser, useService } from '@/components/main/app.hooks';
import { isOfficialHost } from '@/utils/subscription';
import { openUrl } from '@/utils/url';

export function PublishManage({ onClose }: { onClose?: () => void }) {
Expand Down Expand Up @@ -175,6 +176,11 @@ export function PublishManage({ onClose }: { onClose?: () => void }) {
const { getSubscriptions } = useAppHandlers();
const [activeSubscription, setActiveSubscription] = React.useState<SubscriptionPlan | null>(null);
const loadSubscription = useCallback(async () => {
if (!isOfficialHost()) {
setActiveSubscription(SubscriptionPlan.Pro);
return;
}

try {
const subscriptions = await getSubscriptions?.();

Expand Down
8 changes: 7 additions & 1 deletion src/components/app/share/SharePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { InviteGuest } from '@/components/app/share/InviteGuest';
import { PeopleWithAccess } from '@/components/app/share/PeopleWithAccess';
import { UpgradeBanner } from '@/components/app/share/UpgradeBanner';
import { useCurrentUser, useService } from '@/components/main/app.hooks';
import { isOfficialHost } from '@/utils/subscription';

function SharePanel({ viewId }: { viewId: string }) {
const currentUser = useCurrentUser();
Expand Down Expand Up @@ -122,6 +123,11 @@ function SharePanel({ viewId }: { viewId: string }) {
}, [getSubscriptions]);

useEffect(() => {
if (!isOfficialHost()) {
setActiveSubscriptionPaln(SubscriptionPlan.Pro);
return;
}

if (isOwner || isMember) {
void loadSubscription();
}
Expand All @@ -141,7 +147,7 @@ function SharePanel({ viewId }: { viewId: string }) {
hasFullAccess={hasFullAccess}
activeSubscriptionPlan={activeSubscriptionPlan}
/>
<UpgradeBanner activeSubscriptionPlan={activeSubscriptionPlan} />
{isOfficialHost() && <UpgradeBanner activeSubscriptionPlan={activeSubscriptionPlan} />}
<PeopleWithAccess viewId={viewId} people={people} isLoading={isLoading} onPeopleChange={refreshPeople} />
<GeneralAccess viewId={viewId} />
<CopyLink />
Expand Down
6 changes: 6 additions & 0 deletions src/components/app/workspaces/InviteMember.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Progress } from '@/components/ui/progress';
import { isOfficialHost } from '@/utils/subscription';

function InviteMember({
workspace,
Expand Down Expand Up @@ -48,6 +49,11 @@ function InviteMember({
const [activeSubscriptionPlan, setActiveSubscriptionPaln] = React.useState<SubscriptionPlan | null>(null);

const loadSubscription = useCallback(async () => {
if (!isOfficialHost()) {
setActiveSubscriptionPaln(SubscriptionPlan.Pro);
return;
}

try {
const subscriptions = await getSubscriptions?.();

Expand Down
2 changes: 1 addition & 1 deletion src/utils/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import { getConfigValue } from '@/utils/runtime-config';

const OFFICIAL_HOSTNAMES = new Set(['beta.appflowy.cloud', 'test.appflowy.cloud', 'localhost:8000']);
const OFFICIAL_HOSTNAMES = new Set(['beta.appflowy.cloud', 'test.appflowy.cloud', 'localhost']);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Revisit official-host detection to account for additional local addresses or ports if needed.

Since URL.hostname excludes the port, this change now matches purely on hostnames. Please confirm whether other local hosts (e.g. 127.0.0.1 or custom dev hostnames) should also be treated as official; if so, they’ll need to be added to OFFICIAL_HOSTNAMES or handled elsewhere.


function getBaseUrlHostname(): string | null {
const baseUrl = getConfigValue('APPFLOWY_BASE_URL', '').trim();
Expand Down