neuland-ingolstadt / neuland.app

A free & open source, web-based replacement for the official app of the Technische Hochschule Ingolstadt built with React and Next.js.
https://neuland.app
GNU Affero General Public License v3.0
36 stars 33 forks source link

🧱 reintegrate legacy API as possible fallback #338

Closed BuildmodeOne closed 11 months ago

BuildmodeOne commented 1 year ago

Closes #335

Due to the failure in the last few days, I have reintegrated the old API, which can be activated via the follwoing environment variable:

NEXT_PUBLIC_LEGACY_MODE=true

@M4GNV5 has already expressed very justified concerns about the legal situation and the bundle size. Nevertheless, we should check this option, especially since we have relied on the old API in the last few days and this option should only be an alternative for emergencies.

Regarding the library, only a simple error message is shown, as this is not accessible via the old API.

localhost_3000_library_(iPhone 12 Pro)

πŸ€– Generated by Copilot at 952aa47

Summary

πŸ”„πŸ› οΈπŸ“š

This pull request adds a fallback mode to the app that uses the old THI API when the new one is unavailable. It modifies several modules in the backend-utils, backend, and pages folders to switch between the APIs depending on a LEGACY_MODE constant. It also creates new modules in the backend-legacy-utils folder to handle the old THI API data. Additionally, it adds a new dependency postgres-array and a new translation key legacyWarning for the library page.

When the new API fails, we don't give up We switch to the LegacyAPI and load the data We use the backend-legacy-utils to parse and format _We rock the fallback mode with the LEGACY_MODE flag_

Walkthrough

BuildmodeOne commented 11 months ago

Since the legal situation of the use of the "old API" has not been clarified, this use should be avoided at an extreme.