Skip to content

Enhances settings and backend API configuration#3

Merged
LeCyreaxYT merged 2 commits intomainfrom
develop
Dec 3, 2025
Merged

Enhances settings and backend API configuration#3
LeCyreaxYT merged 2 commits intomainfrom
develop

Conversation

@LeCyreaxYT
Copy link
Contributor

Enhances settings and backend API configuration.

This commit refactors the backend API URL configuration, introduces language and theme settings, and improves slug generation. It also updates frontend components to reflect these changes.

Changes

  • Backend API URL Configuration: Removes /api suffix from API_URL configuration, updating .env.example, config.go, and main.go. The API_URL now represents the base backend URL. Constructs the uploads URL in main.go by combining ApiURL and Storage.LocalURL.
  • Settings Model: Adds Language and Theme fields to the Settings model in backend/internal/models/settings.go and frontend/shared/types/index.ts. Also updates the default settings.
  • Setup Handler: Modifies the setup handler in backend/internal/handlers/setup.go to include Language and Theme in the setup status and update settings requests.
  • Form Slug Generation: Modifies the form slug generation logic in backend/internal/models/form.go and backend/internal/handlers/form.go. If a slug is cleared during form update, it defaults to the first 8 characters of the form ID. Auto-generates a slug from the Form ID on form creation if no slug exists.
  • Frontend Settings Page: Updates the settings page (frontend/app/pages/settings.vue) to include language and theme selection.
  • Theme Handling: Refactors theme handling in the frontend, removing the ThemeToggle component and integrating theme management into the setup store (frontend/app/store/setup.ts) and the settings page, SSR settings head plugin to prevent flash of unstyled content.
  • API Usage: Updates API endpoints in frontend/app/composables/useApi.ts to use the base API URL.

Impact

  • Backend API: The backend now expects requests without the /api prefix.
  • Frontend Configuration: The frontend apiUrl configuration now uses the base backend URL.
  • Appearance Customization: Administrators can now configure the application's language and theme via the settings page.
  • Form Access: Forms without a custom slug are now accessible using the first 8 characters of their ID.
  • Settings Page Error Handling: Added error handling to the settings page, including a specific message for permission errors.

Updates the settings page to include language and theme options, allowing users to customize the application's appearance and localization.

Simplifies the backend API configuration by removing the "/api" suffix from the API_URL, ensuring consistent URL handling for uploads and other API endpoints.

The commit also introduces a fallback slug generation mechanism for forms, using the first 8 characters of the form ID when the slug is cleared.
Ensures `effectiveTheme` is always assigned a value
before being used in the `applyTheme` function,
avoiding potential runtime errors.
@LeCyreaxYT LeCyreaxYT merged commit e936510 into main Dec 3, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant