Skip to content

feat: migrate from clientside javascript to elysiajs eden - #689

Open
Laertes87 wants to merge 20 commits into
mainfrom
MigrateFromClientsideJavascript
Open

Laertes87 wants to merge 20 commits into
mainfrom
MigrateFromClientsideJavascript

Conversation

@Laertes87

@Laertes87 Laertes87 commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

I'm playing around a bit with agentic coding using local LLMs. I thought I'd tackle this feature that way. This PR still needs a lot of thorough testing.

Summary

Migrates the inline/client-side JavaScript to typed TypeScript client scripts that talk to the server via Elysia Eden.

Client scripts

  • Replaced public/script.js and public/results.js with public/script.ts, public/results.ts, and a new public/history.ts.
  • Removed the inline JS from src/pages/history.tsx (~100 lines), moving it into history.ts.
  • Added src/eden.ts (typed Eden client, centralized server URL).
  • Added helpers: findPresetTarget, historySelection, and normalizeFiletype tweaks. The ffmpeg converter and converters/main.ts have small related changes. These also support the wav-3cx preset and URL-param format pre-selection.

Build & tooling

  • Client bundles are built before dev/hot, and in the Dockerfile.
  • Updated package.json, bun.lock, bunfig.toml, tsconfig*.json, and eslint.config.ts.
  • Generated bundles (e.g. history.js) are git-ignored.

Review fixes

  • Iterate NodeList via Array.from so the tsc build passes.
  • Tightened Eden typings and addressed type-safety/XSS review concerns.
  • Pages now reference the built bundles instead of inline scripts.

Tests

  • New DOM tests for script, history, and results (tests/client/*), plus Eden app, helper, and build-script tests.
  • Updated page tests to assert no inline <script> tags (matched case-insensitively).
  • Console output is silenced and client-script coverage is raised.

@C4illin

C4illin commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Oh wow, nice start! This is something I have been postponing for a long time

Laertes87 and others added 6 commits October 26, 2026 21:30
# Conflicts:
#	public/script.js
#	src/index.tsx
Extract server URL into a dedicated serverUrl() helper with explicit
fallbacks for hostname and port. This addresses the review finding that
app.server?.hostname and app.server?.port may be undefined at creation
time (Elysia's Server type is a union that doesn't expose these
directly).

Co-Authored-By: Claude Code <noreply@anthropic.com>
@Laertes87
Laertes87 force-pushed the MigrateFromClientsideJavascript branch from 8d1b79e to 21dbe23 Compare October 26, 2026 20:55
@Laertes87
Laertes87 force-pushed the MigrateFromClientsideJavascript branch from d2a2cbd to 09cff94 Compare November 3, 2026 11:58
Laertes87 and others added 3 commits November 18, 2026 21:53
Port ?to=&converter= format pre-selection from script.js to script.ts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Laertes87
Laertes87 force-pushed the MigrateFromClientsideJavascript branch from 09cff94 to 94d0989 Compare November 18, 2026 21:04
Comment thread tests/pages/history.test.ts Fixed
Laertes87 and others added 4 commits November 18, 2026 22:07
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Laertes87
Laertes87 marked this pull request as ready for review November 18, 2026 21:28
@Laertes87 Laertes87 changed the title WIP: feat: migrate from clientside javascript to elysiajs eden feat: migrate from clientside javascript to elysiajs eden Nov 18, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 30 files

Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread public/script.ts Resolved
Comment thread tsconfig.json Resolved
Comment thread tests/client/script.test.ts Resolved
Comment thread package.json Resolved
Comment thread public/history.ts Resolved
Comment thread .gitignore Resolved
Comment thread tests/eden/app.test.ts Resolved
Comment thread tests/eden/app.test.ts Resolved
Comment thread tests/eden/app.test.ts Resolved
Comment thread public/script.ts Resolved
Laertes87 and others added 4 commits November 18, 2026 22:36
- drop failed uploads and keep Convert disabled until all uploads succeed
- reset the selected format when the last file is removed
- select targets on click (keyboard support) and keep focus on mousedown
- set the submit input's value for the upload state label
- delete history jobs in batches of at most 100
- rebuild client bundles in watch mode for dev and hot
- derive bundled client scripts from page references in build test
- tighten test fixture and names in client and eden tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Laertes87
Laertes87 force-pushed the MigrateFromClientsideJavascript branch from 5fed7c8 to d90a6cc Compare November 21, 2026 20:02
Comment thread public/script.ts Outdated
fileInput.setAttribute("accept", `.${fileType}`);
setTitle();

postConversions({ fileType: extension })

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
postConversions({ fileType: extension })
postConversions({ fileType: extension, fileName: file.name })

just a small change so we can handle the file extension correctly

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fileName is added

Comment thread public/script.ts Outdated
const api = edenFetch<App>(webroot);

// ── Route helpers (typed via @elysiajs/eden inference from App) ────────────────
async function postConversions(body: { fileType: string }): Promise<string> {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also change here to pass along fileName

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Laertes87 and others added 2 commits November 22, 2026 04:49
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants