Skip to content

fix(api): return JSON responses for admin settings + API key endpoints to prevent Tauri client parse errors#5437

Merged
Frooodle merged 9 commits intomainfrom
fix_self_hosting_return
Jan 13, 2026
Merged

fix(api): return JSON responses for admin settings + API key endpoints to prevent Tauri client parse errors#5437
Frooodle merged 9 commits intomainfrom
fix_self_hosting_return

Conversation

@Ludy87
Copy link
Copy Markdown
Collaborator

@Ludy87 Ludy87 commented Jan 12, 2026

Description of Changes

index-DsORDqQQ.js:124 \n [TauriHttpClient] Network error: \n{url: 'http://localhost:8080/api/v1/admin/settings', method: 'PUT', errorType: 'ERR_NETWORK', originalMessage: `Failed to execute 'close' on 'ReadableStreamDefaul…cted token 'S', "Successful"... is not valid JSON`, stack: `SyntaxError: Unexpected token 'S', "Successful"...…lback (<anonymous>:284:7)\n    at <anonymous>:1:28`}\nerrorType\n: \n"ERR_NETWORK"\nmethod\n: \n"PUT"\noriginalMessage\n: \n"Failed to execute 'close' on 'ReadableStreamDefaultController': Unexpected token 'S', \"Successful\"... is not valid JSON"\nstack\n: \n"SyntaxError: Unexpected token 'S', \"Successful\"... is not valid JSON\n    at A.onmessage (http://tauri.localhost/assets/index-DsORDqQQ.js:124:22714)\n    at http://tauri.localhost/assets/index-DsORDqQQ.js:124:20748\n    at <anonymous>:272:26\n    at Object.runCallback (<anonymous>:284:7)\n    at <anonymous>:1:28"\nurl\n: \n"http://localhost:8080/api/v1/admin/settings"

index-DXbk7lbS.js:124 \n [TauriHttpClient] Network error: \n{url: 'http://localhost:8080/api/v1/user/get-api-key', method: 'POST', errorType: 'ERR_NETWORK', originalMessage: `Failed to execute 'close' on 'ReadableStreamDefaul…cted token 'a', "a72f6b26-1"... is not valid JSON`, stack: `SyntaxError: Unexpected token 'a', "a72f6b26-1"...…lback (<anonymous>:284:7)\n    at <anonymous>:1:28`}\nerrorType\n: \n"ERR_NETWORK"\nmethod\n: \n"POST"\noriginalMessage\n: \n"Failed to execute 'close' on 'ReadableStreamDefaultController': Unexpected token 'a', \"a72f6b26-1\"... is not valid JSON"\nstack\n: \n"SyntaxError: Unexpected token 'a', \"a72f6b26-1\"... is not valid JSON\n    at A.onmessage (http://tauri.localhost/assets/index-DXbk7lbS.js:124:22714)\n    at http://tauri.localhost/assets/index-DXbk7lbS.js:124:20748\n    at <anonymous>:272:26\n    at Object.runCallback (<anonymous>:284:7)\n    at <anonymous>:1:28"\nurl\n: \n"http://localhost:8080/api/v1/user/get-api-key"

This pull request fixes a self-hosting issue where the Tauri HTTP client fails with Unexpected token ... is not valid JSON because certain API endpoints returned plain text responses.

What was changed

  • Updated AdminSettingsController:
    • Changed updateSettings and updateSettingsSection to return structured JSON objects instead of raw strings.
    • Standardized success and error payloads using a Map<String, Object> with keys like message and error.
  • Updated UserController:
    • Changed /api/v1/user/get-api-key and /api/v1/user/update-api-key to return JSON objects ({ "apiKey": "..." }) and JSON error objects instead of plain text.

Why the change was made

  • The Tauri client expects JSON responses and attempts to parse them. Returning plain strings like "Successful..." or an API key string causes JSON parsing to fail, resulting in network errors on self-hosted setups.

Checklist

General

Documentation

Translations (if applicable)

UI Changes (if applicable)

  • Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR)

Testing (if applicable)

  • I have tested my changes locally. Refer to the Testing Guide for more details.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API API-related issues or pull requests Back End Issues related to back-end development Bugfix Pull requests that fix bugs Front End Issues or pull requests related to front-end development Java Pull requests that update Java code Priority: High Issues or pull requests with high priority Security Security-related issues or pull requests size:XL This PR changes 500-999 lines ignoring generated files. Translation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants