Refactor plugin management system
- Updated PluginLoader to utilize the new plugin marketplace manager for loading and managing plugins. - Simplified the plugin loading process by removing unnecessary state management and directly integrating with the plugin marketplace. - Enhanced error handling during plugin installation and uninstallation processes. - Removed legacy code related to Electron-specific plugin handling, streamlining the codebase for web compatibility. - Updated Plugins component to fetch marketplace plugins and installed plugins using the new plugin marketplace manager. - Refactored types related to plugins to import from the new plugin manager module, ensuring consistency and reducing redundancy. - Removed unused calling configuration from client settings and adjusted related types accordingly. - Cleaned up room state events by removing references to LiveKit service URLs, aligning with the updated architecture.
This commit is contained in:
@@ -55,24 +55,17 @@ export function useCall(): CallContextValue {
|
||||
|
||||
export const CallProvider = CallContext.Provider;
|
||||
|
||||
interface UseCallServiceOptions {
|
||||
livekitServiceUrl?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to initialize and manage the call service
|
||||
* Should be used at the app level to provide call context
|
||||
* @param options - Optional configuration including livekitServiceUrl from client config
|
||||
*/
|
||||
export function useCallService(options?: UseCallServiceOptions): CallContextValue {
|
||||
export function useCallService(): CallContextValue {
|
||||
const mx = useMatrixClient();
|
||||
const [callService, setCallService] = useState<CallService | null>(null);
|
||||
const [activeCall, setActiveCall] = useState<ActiveCall | null>(null);
|
||||
const [callSupported, setCallSupported] = useState(false);
|
||||
const [callSupportLoading, setCallSupportLoading] = useState(true);
|
||||
|
||||
const configuredLivekitUrl = options?.livekitServiceUrl;
|
||||
|
||||
useEffect(() => {
|
||||
let unsubscribe: (() => void) | undefined;
|
||||
let service: CallService | undefined;
|
||||
@@ -89,30 +82,21 @@ export function useCallService(options?: UseCallServiceOptions): CallContextValu
|
||||
}
|
||||
|
||||
try {
|
||||
let livekitServiceUrl: string | undefined = configuredLivekitUrl;
|
||||
// Get LiveKit service URL from Matrix homeserver well-known
|
||||
const wellKnown = await fetchWellKnownWithRTC(baseUrl);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Call service init - well-known:', wellKnown);
|
||||
const livekitFocus = getLiveKitFocus(wellKnown);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Call service init - LiveKit focus:', livekitFocus);
|
||||
const livekitServiceUrl = livekitFocus?.livekit_service_url;
|
||||
|
||||
// If no configured URL, try to get from well-known
|
||||
if (!livekitServiceUrl) {
|
||||
const wellKnown = await fetchWellKnownWithRTC(baseUrl);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Call service init - well-known:', wellKnown);
|
||||
const livekitFocus = getLiveKitFocus(wellKnown);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Call service init - LiveKit focus:', livekitFocus);
|
||||
livekitServiceUrl = livekitFocus?.livekit_service_url;
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Call service init - Using configured LiveKit URL:', livekitServiceUrl);
|
||||
}
|
||||
|
||||
// If still no URL, log warning but allow service to initialize
|
||||
// Individual rooms may have their own LiveKit configs
|
||||
if (!livekitServiceUrl) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Call service init - No global LiveKit URL found');
|
||||
console.log('Call service init - Will check for room-level configs when joining calls');
|
||||
// Use a placeholder URL - room-level config will override this
|
||||
livekitServiceUrl = 'https://placeholder.invalid/livekit';
|
||||
console.log('Call service init - No LiveKit config in well-known, calls not supported');
|
||||
setCallSupported(false);
|
||||
setCallSupportLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
service = new CallService(
|
||||
|
||||
Reference in New Issue
Block a user