Skip to content

Commit

Permalink
fix(versions): better extract func and apply to frontend as well
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksasiriski committed Aug 25, 2024
1 parent 622db70 commit 04ad15f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/routes/+layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { fetchVersion } from '$lib/functions/api/fetchversion';
export async function load({ fetch }) {
const apiVersion = await fetchVersion(fetch);
return {
uiVersion: PUBLIC_UI_VERSION ?? 'dev',
uiVersion: extractVersion(PUBLIC_UI_VERSION) ?? 'dev',
apiVersion: extractVersion(apiVersion) ?? 'dev'
};
}
Expand All @@ -16,7 +16,7 @@ export async function load({ fetch }) {
*/
function extractVersion(input) {
// Regular expression to match the version part
const versionRegex = /^v\d+\.\d+\.\d+/;
const versionRegex = /v\d+\.\d+\.\d+(-preview)?/;
const match = input.match(versionRegex);

// Return the matched version or null if not found
Expand Down

0 comments on commit 04ad15f

Please sign in to comment.