make sure only Appwrite projects are fetched on self-hosted (#2696)

This commit is contained in:
Atharva Deosthale
2025-12-12 15:24:42 -08:00
committed by GitHub
parent b92b94f537
commit 7269effe8f
4 changed files with 8 additions and 4 deletions
@@ -3,12 +3,14 @@ import { base } from '$app/paths';
import { sdk } from '$lib/stores/sdk';
import type { Searcher } from '../commands';
import { isCloud } from '$lib/system';
import { Query } from '@appwrite.io/console';
import { Platform, Query } from '@appwrite.io/console';
export const orgSearcher = (async (query: string) => {
const { teams } = !isCloud
? await sdk.forConsole.teams.list()
: await sdk.forConsole.billing.listOrganization([Query.equal('platform', 'appwrite')]);
: await sdk.forConsole.billing.listOrganization([
Query.equal('platform', Platform.Appwrite)
]);
return teams
.filter((organization) => organization.name.toLowerCase().includes(query.toLowerCase()))
@@ -14,7 +14,7 @@ export const load: PageLoad = async ({ url, route }) => {
Query.offset(offset),
Query.limit(limit),
Query.orderDesc(''),
Query.equal('platform', Platform.Appwrite)
...(isCloud ? [Query.equal('platform', Platform.Appwrite)] : [])
];
const organizations = !isCloud
@@ -113,6 +113,8 @@ async function checkPlatformAndRedirect(
}
}
if (!isCloud) return requestedOrg;
if (requestedOrg && requestedOrg.platform !== Platform.Appwrite) {
const orgIdInPrefs = prefs.organization;
@@ -42,7 +42,7 @@ export const load: LayoutLoad = async ({ params, depends, parent }) => {
// not the right organization project based on platform,
// redirect to organization, and it should handle the rest!
if (organization.platform !== Platform.Appwrite) {
if (isCloud && organization.platform !== Platform.Appwrite) {
redirect(
303,
resolve('/(console)/organization-[organization]', {