feat(learning): replace courses with project catalog

This commit is contained in:
2026-08-20 00:08:04 +08:00
parent 2cb8a7aef4
commit 38db1589e2
56 changed files with 1741 additions and 8725 deletions

View File

@@ -57,12 +57,6 @@ const UNIFIED_CHANNELS = new Set<string>([
'update:cancelAutoInstall',
]);
const ALLOWED_EVENT_CHANNELS = new Set([
'learning:runtime-event',
] as const);
export type AllowedIpcEventChannel = 'learning:runtime-event';
function toUnifiedRequest(channel: string, args: unknown[]): UnifiedRequest {
const splitIndex = channel.indexOf(':');
return {
@@ -118,31 +112,6 @@ export async function invokeIpc<T>(channel: string, ...args: unknown[]): Promise
return invokeApi<T>(channel, ...args);
}
export function subscribeIpcEvent(
channel: AllowedIpcEventChannel,
listener: (payload: unknown) => void,
): () => void {
if (!ALLOWED_EVENT_CHANNELS.has(channel)) {
throw new AppError('PERMISSION', 'IPC event channel is not allowed', {
transport: 'ipc',
channel,
source: 'renderer-event-subscription',
});
}
const unsubscribe = window.electron.ipcRenderer.on(channel, listener);
let active = true;
return () => {
if (!active) return;
active = false;
if (typeof unsubscribe === 'function') {
unsubscribe();
return;
}
window.electron.ipcRenderer.off(channel, listener);
};
}
export async function invokeIpcWithRetry<T>(
channel: string,
args: unknown[] = [],