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:
2026-09-07 21:54:03 +03:30
co-authored by Cursor
parent a7747366f9
commit dd212d01ed
2 changed files with 44 additions and 5 deletions
+20
View File
@@ -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' },