feat: organize project conversations and add coding teacher side chat
This commit is contained in:
1 parent
2f82b9f79c
commit
9242a40d87
45 files changed
+2987
-1137
No files matched your search
@@ -4,7 +4,14 @@ export type NianCodeDeepLink = {
|
||||
type: 'desktop-auth-callback';
|
||||
requestId: string;
|
||||
url: string;
|
||||
} | { type: 'cloud-agent'; slug: string; url: string };
|
||||
} | { type: 'cloud-agent'; slug: string; url: string }
|
||||
| { type: 'teacher-preview'; draftRevision: number; url: string };
|
||||
|
||||
let pendingTeacherPreviewRevision: number | null = null;
|
||||
export function queueTeacherPreviewRevision(revision: number): void { pendingTeacherPreviewRevision = revision; }
|
||||
export function takeTeacherPreviewRevision(): number | null {
|
||||
const revision = pendingTeacherPreviewRevision; pendingTeacherPreviewRevision = null; return revision;
|
||||
}
|
||||
|
||||
let pendingCloudAgentRoute: string | null = null;
|
||||
export function queueCloudAgentLink(slug: string): void {
|
||||
@@ -39,6 +46,17 @@ export function parseNianCodeDeepLinkUrl(rawUrl: string): NianCodeDeepLink | nul
|
||||
return null;
|
||||
}
|
||||
|
||||
if (url.hostname === 'coding-teacher' && url.pathname === '/preview'
|
||||
&& !url.username && !url.password && !url.port && !url.hash
|
||||
&& [...url.searchParams.keys()].length === 1 && url.searchParams.has('draft_revision')) {
|
||||
const value = url.searchParams.get('draft_revision')!;
|
||||
const draftRevision = Number(value);
|
||||
if (/^[1-9][0-9]*$/.test(value) && Number.isSafeInteger(draftRevision)) {
|
||||
return { type: 'teacher-preview', draftRevision, url: rawUrl };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (url.hostname !== 'auth' || url.pathname !== '/callback') {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
findNianCodeDeepLinkUrl,
|
||||
NIANCODE_APP_PROTOCOL,
|
||||
queueCloudAgentLink,
|
||||
queueTeacherPreviewRevision,
|
||||
parseNianCodeDeepLinkUrl,
|
||||
} from './app-deep-link';
|
||||
import { installMediaPermissionHandler } from './media-permissions';
|
||||
@@ -359,6 +360,9 @@ function handleAppDeepLinkActivation(rawUrl: string): boolean {
|
||||
if (deepLink.type === 'cloud-agent') {
|
||||
queueCloudAgentLink(deepLink.slug);
|
||||
mainWindow?.webContents.send('cloud-agent-link');
|
||||
} else if (deepLink.type === 'teacher-preview') {
|
||||
queueTeacherPreviewRevision(deepLink.draftRevision);
|
||||
mainWindow?.webContents.send('navigate', '/coding-teacher-preview?draftRevision=' + deepLink.draftRevision);
|
||||
} else {
|
||||
logger.info(`Received Makelore app link: type=${deepLink.type}, request_id=${deepLink.requestId}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user