update workers to work again
This commit is contained in:
parent
ab32ef62ed
commit
57b9c52035
|
|
@ -3,14 +3,15 @@
|
|||
import { AutoRouter, IRequest, error } from "itty-router"
|
||||
import throttle from "lodash.throttle"
|
||||
import { Environment } from "./types"
|
||||
import { ChatBoxShape } from "@/shapes/ChatBoxShapeUtil"
|
||||
import { VideoChatShape } from "@/shapes/VideoChatShapeUtil"
|
||||
import { EmbedShape } from "@/shapes/EmbedShapeUtil"
|
||||
import { MarkdownShape } from "@/shapes/MarkdownShapeUtil"
|
||||
import { MycrozineTemplateShape } from "@/shapes/MycrozineTemplateShapeUtil"
|
||||
import { SlideShape } from "@/shapes/SlideShapeUtil"
|
||||
import { PromptShape } from "@/shapes/PromptShapeUtil"
|
||||
import { SharedPianoShape } from "@/shapes/SharedPianoShapeUtil"
|
||||
// Import worker-compatible shape utilities (without React components)
|
||||
import { ChatBoxShape } from "./shapes/ChatBoxShapeUtil"
|
||||
import { VideoChatShape } from "./shapes/VideoChatShapeUtil"
|
||||
import { EmbedShape } from "./shapes/EmbedShapeUtil"
|
||||
import { MarkdownShape } from "./shapes/MarkdownShapeUtil"
|
||||
import { MycrozineTemplateShape } from "./shapes/MycrozineTemplateShapeUtil"
|
||||
import { SlideShape } from "./shapes/SlideShapeUtil"
|
||||
import { PromptShape } from "./shapes/PromptShapeUtil"
|
||||
import { SharedPianoShape } from "./shapes/SharedPianoShapeUtil"
|
||||
|
||||
// Lazy load TLDraw dependencies to avoid startup timeouts
|
||||
let customSchema: any = null
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
import { BaseBoxShapeUtil, TLBaseShape } from "tldraw"
|
||||
|
||||
export type IChatBoxShape = TLBaseShape<
|
||||
"ChatBox",
|
||||
{
|
||||
w: number
|
||||
h: number
|
||||
roomId: string
|
||||
userName: string
|
||||
}
|
||||
>
|
||||
|
||||
export class ChatBoxShape extends BaseBoxShapeUtil<IChatBoxShape> {
|
||||
static override type = "ChatBox"
|
||||
|
||||
getDefaultProps(): IChatBoxShape["props"] {
|
||||
return {
|
||||
roomId: "default-room",
|
||||
w: 100,
|
||||
h: 100,
|
||||
userName: "",
|
||||
}
|
||||
}
|
||||
|
||||
indicator(_shape: IChatBoxShape) {
|
||||
return null // Simplified for worker
|
||||
}
|
||||
|
||||
component(_shape: IChatBoxShape) {
|
||||
return null // No React components in worker
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
import { BaseBoxShapeUtil, TLBaseShape } from "tldraw"
|
||||
|
||||
export type IEmbedShape = TLBaseShape<
|
||||
"Embed",
|
||||
{
|
||||
w: number
|
||||
h: number
|
||||
url: string
|
||||
title: string
|
||||
description: string
|
||||
image: string
|
||||
}
|
||||
>
|
||||
|
||||
export class EmbedShape extends BaseBoxShapeUtil<IEmbedShape> {
|
||||
static override type = "Embed"
|
||||
|
||||
getDefaultProps(): IEmbedShape["props"] {
|
||||
return {
|
||||
w: 300,
|
||||
h: 200,
|
||||
url: "",
|
||||
title: "",
|
||||
description: "",
|
||||
image: "",
|
||||
}
|
||||
}
|
||||
|
||||
indicator(shape: IEmbedShape) {
|
||||
return null // Simplified for worker
|
||||
}
|
||||
|
||||
component(shape: IEmbedShape) {
|
||||
return null // No React components in worker
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
import { BaseBoxShapeUtil, TLBaseShape } from "tldraw"
|
||||
// Worker-compatible version
|
||||
|
||||
export type IMarkdownShape = TLBaseShape<
|
||||
"Markdown",
|
||||
{
|
||||
w: number
|
||||
h: number
|
||||
text: string
|
||||
}
|
||||
>
|
||||
|
||||
export class MarkdownShape extends BaseBoxShapeUtil<IMarkdownShape> {
|
||||
static override type = "Markdown"
|
||||
|
||||
getDefaultProps(): IMarkdownShape["props"] {
|
||||
return {
|
||||
w: 300,
|
||||
h: 200,
|
||||
text: "# Markdown\n\nYour content here...",
|
||||
}
|
||||
}
|
||||
|
||||
indicator(_shape: IMarkdownShape) {
|
||||
return null // Simplified for worker
|
||||
}
|
||||
|
||||
component(_shape: IMarkdownShape) {
|
||||
return null // No React components in worker
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
import { BaseBoxShapeUtil, TLBaseShape } from "tldraw"
|
||||
|
||||
export type IMycrozineTemplateShape = TLBaseShape<
|
||||
"MycrozineTemplate",
|
||||
{
|
||||
w: number
|
||||
h: number
|
||||
templateType: string
|
||||
}
|
||||
>
|
||||
|
||||
export class MycrozineTemplateShape extends BaseBoxShapeUtil<IMycrozineTemplateShape> {
|
||||
static override type = "MycrozineTemplate"
|
||||
|
||||
getDefaultProps(): IMycrozineTemplateShape["props"] {
|
||||
return {
|
||||
w: 400,
|
||||
h: 300,
|
||||
templateType: "default",
|
||||
}
|
||||
}
|
||||
|
||||
indicator(_shape: IMycrozineTemplateShape) {
|
||||
return null // Simplified for worker
|
||||
}
|
||||
|
||||
component(_shape: IMycrozineTemplateShape) {
|
||||
return null // No React components in worker
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
import { BaseBoxShapeUtil, TLBaseShape } from "tldraw"
|
||||
|
||||
export type IPromptShape = TLBaseShape<
|
||||
"Prompt",
|
||||
{
|
||||
w: number
|
||||
h: number
|
||||
prompt: string
|
||||
response: string
|
||||
}
|
||||
>
|
||||
|
||||
export class PromptShape extends BaseBoxShapeUtil<IPromptShape> {
|
||||
static override type = "Prompt"
|
||||
|
||||
getDefaultProps(): IPromptShape["props"] {
|
||||
return {
|
||||
w: 300,
|
||||
h: 200,
|
||||
prompt: "",
|
||||
response: "",
|
||||
}
|
||||
}
|
||||
|
||||
indicator(_shape: IPromptShape) {
|
||||
return null // Simplified for worker
|
||||
}
|
||||
|
||||
component(_shape: IPromptShape) {
|
||||
return null // No React components in worker
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
import { BaseBoxShapeUtil, TLBaseShape } from "tldraw"
|
||||
|
||||
export type ISharedPianoShape = TLBaseShape<
|
||||
"SharedPiano",
|
||||
{
|
||||
w: number
|
||||
h: number
|
||||
isPlaying: boolean
|
||||
}
|
||||
>
|
||||
|
||||
export class SharedPianoShape extends BaseBoxShapeUtil<ISharedPianoShape> {
|
||||
static override type = "SharedPiano"
|
||||
|
||||
getDefaultProps(): ISharedPianoShape["props"] {
|
||||
return {
|
||||
w: 400,
|
||||
h: 200,
|
||||
isPlaying: false,
|
||||
}
|
||||
}
|
||||
|
||||
indicator(_shape: ISharedPianoShape) {
|
||||
return null // Simplified for worker
|
||||
}
|
||||
|
||||
component(_shape: ISharedPianoShape) {
|
||||
return null // No React components in worker
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
import { BaseBoxShapeUtil, TLBaseShape } from "tldraw"
|
||||
|
||||
export type ISlideShape = TLBaseShape<
|
||||
"Slide",
|
||||
{
|
||||
w: number
|
||||
h: number
|
||||
title: string
|
||||
content: string
|
||||
}
|
||||
>
|
||||
|
||||
export class SlideShape extends BaseBoxShapeUtil<ISlideShape> {
|
||||
static override type = "Slide"
|
||||
|
||||
getDefaultProps(): ISlideShape["props"] {
|
||||
return {
|
||||
w: 400,
|
||||
h: 300,
|
||||
title: "Slide Title",
|
||||
content: "Slide content...",
|
||||
}
|
||||
}
|
||||
|
||||
indicator(_shape: ISlideShape) {
|
||||
return null // Simplified for worker
|
||||
}
|
||||
|
||||
component(_shape: ISlideShape) {
|
||||
return null // No React components in worker
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
import { BaseBoxShapeUtil, TLBaseShape } from "tldraw"
|
||||
|
||||
export type IVideoChatShape = TLBaseShape<
|
||||
"VideoChat",
|
||||
{
|
||||
w: number
|
||||
h: number
|
||||
roomUrl: string | null
|
||||
allowCamera: boolean
|
||||
allowMicrophone: boolean
|
||||
enableRecording: boolean
|
||||
recordingId: string | null
|
||||
enableTranscription: boolean
|
||||
isTranscribing: boolean
|
||||
transcriptionHistory: Array<{
|
||||
sender: string
|
||||
message: string
|
||||
id: string
|
||||
}>
|
||||
meetingToken: string | null
|
||||
isOwner: boolean
|
||||
}
|
||||
>
|
||||
|
||||
export class VideoChatShape extends BaseBoxShapeUtil<IVideoChatShape> {
|
||||
static override type = "VideoChat"
|
||||
|
||||
indicator(_shape: IVideoChatShape) {
|
||||
return null
|
||||
}
|
||||
|
||||
getDefaultProps(): IVideoChatShape["props"] {
|
||||
return {
|
||||
roomUrl: null,
|
||||
w: 800,
|
||||
h: 600,
|
||||
allowCamera: false,
|
||||
allowMicrophone: false,
|
||||
enableRecording: true,
|
||||
recordingId: null,
|
||||
enableTranscription: true,
|
||||
isTranscribing: false,
|
||||
transcriptionHistory: [],
|
||||
meetingToken: null,
|
||||
isOwner: false
|
||||
}
|
||||
}
|
||||
|
||||
component(_shape: IVideoChatShape) {
|
||||
return null // No React components in worker
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ async function getUnfurlHandler() {
|
|||
// Define security headers
|
||||
const securityHeaders = {
|
||||
"Content-Security-Policy":
|
||||
"default-src 'self'; connect-src 'self' wss: https:; img-src 'self' data: blob: https:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';",
|
||||
"default-src 'self'; connect-src 'self' wss: https:; img-src 'self' data: blob: https: https://cdn.tldraw.com; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-Frame-Options": "DENY",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
|
|
|
|||
Loading…
Reference in New Issue