Skip to content

feat(convert): show supported source formats when picking a target - #594

Open
OrbanGergo wants to merge 10 commits into
C4illin:mainfrom
OrbanGergo:feat/supported-source-formats-for-targets
Open

feat(convert): show supported source formats when picking a target#594
OrbanGergo wants to merge 10 commits into
C4illin:mainfrom
OrbanGergo:feat/supported-source-formats-for-targets

Conversation

@OrbanGergo

@OrbanGergo OrbanGergo commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Closes #515.

Changes

Show supported source formats for a chosen target

Adds a getPossibleSources(to) helper in converters/main.ts — the reverse
of the existing getPossibleTargets(from) — that looks up, for a given
output extension, every input extension (across all converters) capable of
producing it.

A new POST /convert-sources endpoint exposes this lookup to the frontend,
following the same request/response pattern as the existing /conversions
endpoint.

On the frontend, clicking a target format now shows the list of supported
source formats directly below the Convert button.

Implementation notes

  • getPossibleSources mirrors the existing possibleTargets construction
    in converters/main.ts, just inverted, and returns results grouped by
    converter (same shape as getPossibleTargets).
  • No changes to existing converter definitions were needed.
  • The lookup runs client-side via a fetch to /convert-sources right after
    a target button is clicked; the upload/convert flow itself is unchanged.

Summary by cubic

Shows supported source formats for a selected target so users know valid inputs before converting. Previously there was no guidance; now selecting a target fetches and shows a de-duplicated, sorted list per converter, with safeguards against stale updates.

  • Backend

    • Adds getPossibleSources(to) that returns Record<converterName, string[]>, keyed by the raw target string (no normalization) to avoid merging distinct targets like "latex"/"tex" or "jpeg"/"jpg".
    • Adds POST /convert-sources with body { to: string }, returning sources grouped by converter; registered in the app router.
  • UI

    • Adds a "Supported source types" hint below the Convert button when a target is clicked.
    • Tags requests as extension::converter and ignores stale responses; de-duplicates and sorts results; clears the hint on errors, empty results, and when the search is cleared.

Written for commit aa39368. Summary will update on new commits.

Review in cubic

@github-actions github-actions Bot added Feature and removed Feature labels Aug 1, 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.

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/pages/convertSources.tsx">

<violation number="1" location="src/pages/convertSources.tsx:8">
P0: The whole feature is non-functional as submitted: `convertSources` is defined and exported but never registered on the server. Every other page plugin in `src/index.tsx` is mounted with `.use(...)`, but this one is missing, so the frontend `fetch('/convert-sources')` returns a 404 and the `.catch` handler always clears the new “Supported source types” element. Add the import and `.use(convertSources)` in `src/index.tsx` alongside the other routes (e.g. next to `.use(chooseConverter)`).</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

// Place this next to (or inside the same file as) the existing
// `/conversions` route, so it shares whatever auth/db conventions
// that route already uses.
export const convertSources = new Elysia().use(userService).post(

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.

P0: The whole feature is non-functional as submitted: convertSources is defined and exported but never registered on the server. Every other page plugin in src/index.tsx is mounted with .use(...), but this one is missing, so the frontend fetch('/convert-sources') returns a 404 and the .catch handler always clears the new “Supported source types” element. Add the import and .use(convertSources) in src/index.tsx alongside the other routes (e.g. next to .use(chooseConverter)).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/pages/convertSources.tsx, line 8:

<comment>The whole feature is non-functional as submitted: `convertSources` is defined and exported but never registered on the server. Every other page plugin in `src/index.tsx` is mounted with `.use(...)`, but this one is missing, so the frontend `fetch('/convert-sources')` returns a 404 and the `.catch` handler always clears the new “Supported source types” element. Add the import and `.use(convertSources)` in `src/index.tsx` alongside the other routes (e.g. next to `.use(chooseConverter)`).</comment>

<file context>
@@ -0,0 +1,19 @@
+// Place this next to (or inside the same file as) the existing
+// `/conversions` route, so it shares whatever auth/db conventions
+// that route already uses.
+export const convertSources = new Elysia().use(userService).post(
+  "/convert-sources",
+  ({ body }) => {
</file context>
Comment thread public/script.js
Comment thread src/converters/main.ts
@github-actions github-actions Bot added Feature and removed Feature labels Aug 1, 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 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/converters/main.ts
Comment thread public/script.js
Comment thread public/script.js Outdated
@github-actions github-actions Bot added Feature and removed Feature labels Aug 1, 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 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread public/script.js Outdated
Comment thread public/script.js Outdated
@github-actions github-actions Bot added Feature and removed Feature labels Aug 1, 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 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread public/script.js Outdated
Comment thread src/converters/main.ts Outdated
@github-actions github-actions Bot added Feature and removed Feature labels Aug 1, 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 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/converters/main.ts Outdated
Comment thread public/script.js Outdated
@github-actions github-actions Bot added Feature and removed Feature labels Aug 1, 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.

No issues found across 5 files

Re-trigger cubic

@OrbanGergo
OrbanGergo force-pushed the feat/supported-source-formats-for-targets branch from 6be183a to 0cf5af5 Compare August 3, 2026 19:21
@github-actions github-actions Bot added Feature and removed Feature labels Aug 3, 2026
@github-actions github-actions Bot added Feature and removed Feature labels Aug 3, 2026
@OrbanGergo
OrbanGergo force-pushed the feat/supported-source-formats-for-targets branch from 96eee23 to 9abc19f Compare August 12, 2026 14:47
@OrbanGergo
OrbanGergo force-pushed the feat/supported-source-formats-for-targets branch from c0fa31f to aa39368 Compare August 12, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 participant