mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
make sure only Appwrite projects are fetched on self-hosted (#2696)
This commit is contained in:
@@ -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]', {
|
||||
|
||||
Reference in New Issue
Block a user