Skip to content

Commit 6069139

Browse files
committed
npm: update express to 5.1 #8529
1 parent 3e752b9 commit 6069139

File tree

11 files changed

+283
-52
lines changed

11 files changed

+283
-52
lines changed

src/.claude/settings.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@
1919
"Bash(npx tsc:*)",
2020
"Bash(pnpm build:*)",
2121
"Bash(pnpm i18n:*)",
22+
"Bash(pnpm list:*)",
2223
"Bash(pnpm ts-build:*)",
2324
"Bash(pnpm tsc:*)",
25+
"Bash(pnpm view:*)",
26+
"Bash(pnpm why:*)",
2427
"Bash(prettier -w:*)",
2528
"Bash(psql:*)",
2629
"WebFetch(domain:cocalc.com)",
@@ -29,11 +32,15 @@
2932
"WebFetch(domain:github.com)",
3033
"WebFetch(domain:mistral.ai)",
3134
"WebFetch(domain:simplelocalize.io)",
32-
"Bash(pnpm list:*)",
33-
"Bash(pnpm why:*)",
34-
"mcp__github__get_issue",
3535
"WebFetch(domain:www.anthropic.com)",
36-
"mcp__cclsp__find_definition"
36+
"mcp__cclsp__find_definition",
37+
"mcp__github__get_issue",
38+
"mcp__github__get_issue_comments",
39+
"mcp__github__get_pull_request",
40+
"mcp__github__get_pull_request_comments",
41+
"mcp__github__get_pull_request_status",
42+
"mcp__github__list_workflow_runs",
43+
"mcp__github__list_workflows"
3744
],
3845
"deny": []
3946
}

src/packages/hub/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"cookies": "^0.8.0",
2929
"cors": "^2.8.5",
3030
"debug": "^4.4.0",
31-
"express": "^4.21.2",
31+
"express": "^5.1.0",
3232
"formidable": "^3.5.4",
3333
"http-proxy-3": "^1.20.8",
3434
"lodash": "^4.17.21",
@@ -47,7 +47,7 @@
4747
},
4848
"devDependenicesNotes": "For license and size reasons, we make @cocalc/crm a dev dependency so it is NOT installed unless explicitly installed as a separate step.",
4949
"devDependencies": {
50-
"@types/express": "^4.17.21",
50+
"@types/express": "^5.0.3",
5151
"@types/node": "^18.16.14",
5252
"coffeescript": "^2.5.1"
5353
},

src/packages/hub/proxy/index.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,24 @@ interface Options {
2323
export default function initProxy(opts: Options) {
2424
const proxy_regexp = `^${
2525
base_path.length <= 1 ? "" : base_path
26-
}\/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\/*`;
27-
logger.info("creating proxy server with proxy_regexp", proxy_regexp);
26+
}/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/`;
27+
const proxy_pattern = `${
28+
base_path.length <= 1 ? "" : base_path
29+
}/:project_id/*splat`;
30+
logger.info(
31+
"creating proxy server with proxy_regexp",
32+
proxy_regexp,
33+
"proxy_pattern",
34+
proxy_pattern,
35+
);
2836

2937
// tcp connections:
3038
const handleProxy = initRequest(opts);
3139

3240
// websocket upgrades:
3341
const handleUpgrade = initUpgrade(opts, proxy_regexp);
3442

35-
opts.app.all(proxy_regexp, handleProxy);
43+
opts.app.all(proxy_pattern, handleProxy);
3644

3745
opts.httpServer.on("upgrade", handleUpgrade);
3846
}

src/packages/hub/servers/app/app-redirect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function init(router: Router) {
1414
const winston = getLogger("app-redirect");
1515
const v: string[] = [];
1616
for (const path of APP_ROUTES) {
17-
v.push(`/${path}*`);
17+
v.push(`/${path}/*splat`);
1818
}
1919
router.get(v, (req, res) => {
2020
winston.debug(req.url);

src/packages/hub/servers/app/blobs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { getLogger } from "@cocalc/hub/logger";
88
const logger = getLogger("hub:servers:app:blobs");
99
export default function init(router: Router) {
1010
// return uuid-indexed blobs (mainly used for graphics)
11-
router.get("/blobs/*", async (req, res) => {
11+
router.get("/blobs/*splat", async (req, res) => {
1212
logger.debug(`${JSON.stringify(req.query)}, ${req.path}`);
1313
const uuid = `${req.query.uuid}`;
1414
if (req.headers["if-none-match"] === uuid) {

src/packages/hub/servers/app/next.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default async function init(app: Application) {
5454
// 1: The raw static server:
5555
const raw = join(shareBasePath, "raw");
5656
app.all(
57-
join(raw, "*"),
57+
join(raw, "*splat"),
5858
(req: Request, res: Response, next: NextFunction) => {
5959
// Embedding only enabled for PDF files -- see note above
6060
const download =
@@ -76,7 +76,7 @@ export default async function init(app: Application) {
7676
// 2: The download server -- just like raw, but files always get sent via download.
7777
const download = join(shareBasePath, "download");
7878
app.all(
79-
join(download, "*"),
79+
join(download, "*splat"),
8080
(req: Request, res: Response, next: NextFunction) => {
8181
try {
8282
handleRaw({
@@ -95,21 +95,21 @@ export default async function init(app: Application) {
9595
// 3: Redirects for backward compat; unfortunately there's slight
9696
// overhead for doing this on every request.
9797

98-
app.all(join(shareBasePath, "*"), shareRedirect(shareBasePath));
98+
app.all(join(shareBasePath, "*splat"), shareRedirect(shareBasePath));
9999
}
100100

101101
const landingRedirect = createLandingRedirect();
102102
app.all(join(basePath, "index.html"), landingRedirect);
103-
app.all(join(basePath, "doc*"), landingRedirect);
104-
app.all(join(basePath, "policies*"), landingRedirect);
103+
app.all(join(basePath, "doc/*splat"), landingRedirect);
104+
app.all(join(basePath, "policies/*splat"), landingRedirect);
105105

106106
// The next.js server that serves everything else.
107107
winston.info(
108108
"Now using next.js packages/share handler to handle all endpoints not otherwise handled",
109109
);
110110

111111
// nextjs listens on everything else
112-
app.all("*", handler);
112+
app.all("*splat", handler);
113113
}
114114

115115
function parseURL(req: Request, base): { id: string; path: string } {

src/packages/next/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"basic-auth": "^2.0.1",
7676
"csv-stringify": "^6.3.0",
7777
"dayjs": "^1.11.11",
78-
"express": "^4.21.2",
78+
"express": "^5.1.0",
7979
"lodash": "^4.17.21",
8080
"lru-cache": "^7.18.3",
8181
"ms": "2.1.2",
@@ -98,7 +98,7 @@
9898
"devDependencies": {
9999
"@testing-library/jest-dom": "^6.6.3",
100100
"@testing-library/react": "^16.3.0",
101-
"@types/express": "^4.17.21",
101+
"@types/express": "^5.0.3",
102102
"@types/node": "^18.16.14",
103103
"@types/react": "^19.1.10",
104104
"@uiw/react-textarea-code-editor": "^3.1.1",

0 commit comments

Comments
 (0)