fix(plugins): resolve remote tenant from admin and app URLs
HMAC only matched tenant.domain, so k.montzar.ir / new.gholaktala.ir missed the row. Also return an empty store when catalog tables are missing. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -470,6 +470,16 @@ export class PluginStoreService implements OnModuleInit, OnModuleDestroy {
|
||||
|
||||
async remoteStore(tenantId: string, product: string) {
|
||||
await this.assertRemoteKhanegi(tenantId, product);
|
||||
try {
|
||||
return await this.buildRemoteStore(tenantId);
|
||||
} catch (error: any) {
|
||||
if (error instanceof ForbiddenException) throw error;
|
||||
this.logger.warn(`remoteStore skipped: ${error?.message || error}`);
|
||||
return { plugin_store_enabled: true, items: [] };
|
||||
}
|
||||
}
|
||||
|
||||
private async buildRemoteStore(tenantId: string) {
|
||||
const items = await this.prisma.pluginCatalogItem.findMany({
|
||||
where: { inStore: true },
|
||||
orderBy: { titleFa: 'asc' },
|
||||
@@ -531,6 +541,16 @@ export class PluginStoreService implements OnModuleInit, OnModuleDestroy {
|
||||
|
||||
async remoteListRequests(tenantId: string, product: string) {
|
||||
await this.assertRemoteKhanegi(tenantId, product);
|
||||
try {
|
||||
return await this.buildRemoteRequestRows(tenantId);
|
||||
} catch (error: any) {
|
||||
if (error instanceof ForbiddenException) throw error;
|
||||
this.logger.warn(`remoteListRequests skipped: ${error?.message || error}`);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
private async buildRemoteRequestRows(tenantId: string) {
|
||||
const rows = await this.prisma.pluginPurchaseRequest.findMany({
|
||||
where: { tenantId },
|
||||
orderBy: { createdAt: 'desc' },
|
||||
|
||||
Reference in New Issue
Block a user