feat: plugins v1.7
This commit is contained in:
@@ -15,8 +15,8 @@ import type {
|
||||
TojuPluginManifest
|
||||
} from '../../../../shared-kernel';
|
||||
import { RealtimeSessionFacade } from '../../../../core/realtime';
|
||||
import { selectCurrentRoomId } from '../../../../store/rooms/rooms.selectors';
|
||||
import { ServerDirectoryFacade } from '../../../server-directory';
|
||||
import { selectCurrentRoom, selectCurrentRoomId } from '../../../../store/rooms/rooms.selectors';
|
||||
import { ServerDirectoryFacade, type ServerSourceSelector } from '../../../server-directory';
|
||||
import { PluginRegistryService } from './plugin-registry.service';
|
||||
import { PluginRequirementService } from './plugin-requirement.service';
|
||||
|
||||
@@ -44,6 +44,7 @@ export class PluginRequirementStateService {
|
||||
private readonly serverDirectory = inject(ServerDirectoryFacade);
|
||||
private readonly store = inject(Store);
|
||||
|
||||
private readonly currentRoom = this.store.selectSignal(selectCurrentRoom);
|
||||
private readonly currentRoomId = this.store.selectSignal(selectCurrentRoomId);
|
||||
private readonly snapshotsSignal = signal<Record<string, PluginRequirementsSnapshot>>({});
|
||||
private readonly refreshErrorsSignal = signal<Record<string, string>>({});
|
||||
@@ -111,7 +112,7 @@ export class PluginRequirementStateService {
|
||||
}
|
||||
|
||||
try {
|
||||
const apiBaseUrl = this.serverDirectory.getApiBaseUrl();
|
||||
const apiBaseUrl = this.serverDirectory.getApiBaseUrl(this.currentRoomSourceSelector());
|
||||
const snapshot = await new Promise<PluginRequirementsSnapshot>((resolve, reject) => {
|
||||
this.pluginRequirements.getSnapshot(apiBaseUrl, roomId).subscribe({
|
||||
error: reject,
|
||||
@@ -144,6 +145,19 @@ export class PluginRequirementStateService {
|
||||
}));
|
||||
}
|
||||
|
||||
private currentRoomSourceSelector(): ServerSourceSelector | undefined {
|
||||
const room = this.currentRoom();
|
||||
|
||||
if (!room?.sourceId && !room?.sourceUrl) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
sourceId: room.sourceId,
|
||||
sourceUrl: room.sourceUrl
|
||||
};
|
||||
}
|
||||
|
||||
private resolveStatus(
|
||||
requirement: PluginRequirementSummary,
|
||||
entry: { enabled: boolean; manifest: TojuPluginManifest } | undefined
|
||||
|
||||
Reference in New Issue
Block a user