@devries-cameron20 / t3code Mirror · read-only / commits / 8b538e2802
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 25, 16:00 UTC

dedupe

Julius Marminge committed Feb 27, 2026 at 20:52 UTC 8b538e28021f73da137c8d83117f9cb391a6ec0b
3 files changed +34 -33
apps/server/src/orchestration/Layers/ProjectionPipeline.ts
+7 -30
@@ -38,6 +38,11 @@ import {
38 OrchestrationProjectionPipeline,
39 type OrchestrationProjectionPipelineShape,
40 } from "../Services/ProjectionPipeline.ts";
41 +import {
42 + ATTACHMENTS_ROUTE_PREFIX,
43 + IMAGE_EXTENSION_BY_MIME_TYPE,
44 + SAFE_IMAGE_FILE_EXTENSIONS,
45 +} from "../../projectFaviconRoute.ts";
46
47 export const ORCHESTRATION_PROJECTOR_NAMES = {
48 projects: "projection.projects",
@@ -61,31 +66,6 @@ interface ProjectorDefinition {
66 ) => Effect.Effect<void, ProjectionRepositoryError>;
67 }
68
64 -const ATTACHMENTS_ROUTE_PREFIX = "/attachments";
65 -const ATTACHMENTS_STATE_SUBDIRECTORY = "attachments";
66 -const IMAGE_EXTENSION_BY_MIME_TYPE: Record<string, string> = {
67 - "image/png": ".png",
68 - "image/jpeg": ".jpg",
69 - "image/jpg": ".jpg",
70 - "image/gif": ".gif",
71 - "image/webp": ".webp",
72 - "image/svg+xml": ".svg",
73 - "image/bmp": ".bmp",
74 - "image/tiff": ".tiff",
75 - "image/heic": ".heic",
76 -};
77 -const SAFE_IMAGE_FILE_EXTENSIONS = new Set([
78 - ".jpg",
79 - ".jpeg",
80 - ".png",
81 - ".gif",
82 - ".webp",
83 - ".bmp",
84 - ".tiff",
85 - ".svg",
86 - ".ico",
87 -]);
88 -
69 interface PendingAttachmentWrite {
70 readonly absolutePath: string;
71 readonly bytes: Uint8Array;
@@ -133,7 +113,7 @@ const materializeAttachmentsForProjection = Effect.fn(function* (input: {
113 if (Option.isNone(serverConfig)) return input.attachments;
114
115 const path = yield* Path.Path;
136 - const attachmentsRootDir = path.join(serverConfig.value.stateDir, ATTACHMENTS_STATE_SUBDIRECTORY);
116 + const attachmentsRootDir = path.join(serverConfig.value.stateDir, "attachments");
117 const threadSegment = encodeURIComponent(input.threadId);
118 const messageSegment = encodeURIComponent(input.messageId);
119
@@ -332,10 +312,7 @@ const runAttachmentSideEffects = Effect.fn(function* (input: {
312 return;
313 }
314
335 - const attachmentsRootDir = input.path.join(
336 - serverConfig.value.stateDir,
337 - ATTACHMENTS_STATE_SUBDIRECTORY,
338 - );
315 + const attachmentsRootDir = input.path.join(serverConfig.value.stateDir, "attachments");
316
317 yield* Effect.forEach(
318 input.sideEffects.deletedThreadIds,
apps/server/src/projectFaviconRoute.ts
+26
@@ -2,6 +2,32 @@ import fs from "node:fs";
2 import http from "node:http";
3 import path from "node:path";
4
5 +export const ATTACHMENTS_ROUTE_PREFIX = "/attachments";
6 +
7 +export const IMAGE_EXTENSION_BY_MIME_TYPE: Record<string, string> = {
8 + "image/png": ".png",
9 + "image/jpeg": ".jpg",
10 + "image/jpg": ".jpg",
11 + "image/gif": ".gif",
12 + "image/webp": ".webp",
13 + "image/svg+xml": ".svg",
14 + "image/bmp": ".bmp",
15 + "image/tiff": ".tiff",
16 + "image/heic": ".heic",
17 +};
18 +
19 +export const SAFE_IMAGE_FILE_EXTENSIONS = new Set([
20 + ".jpg",
21 + ".jpeg",
22 + ".png",
23 + ".gif",
24 + ".webp",
25 + ".bmp",
26 + ".tiff",
27 + ".svg",
28 + ".ico",
29 +]);
30 +
31 const FAVICON_MIME_TYPES: Record<string, string> = {
32 ".png": "image/png",
33 ".jpg": "image/jpeg",
apps/server/src/wsServer.ts
+1 -3
@@ -55,9 +55,7 @@ import { clamp } from "effect/Number";
55 import { Open } from "./open";
56 import { ServerConfig } from "./config";
57 import { GitCore } from "./git/Services/GitCore.ts";
58 -import { tryHandleProjectFaviconRequest } from "./projectFaviconRoute";
59 -
60 -const ATTACHMENTS_ROUTE_PREFIX = "/attachments/";
58 +import { ATTACHMENTS_ROUTE_PREFIX, tryHandleProjectFaviconRequest } from "./projectFaviconRoute";
59
60 /**
61 * ServerShape - Service API for server lifecycle control.