Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
Add version management and system info endpoint (#1091)
Dave Earleyf02e8c57031f
diff --git a/Dockerfile.all-in-one b/Dockerfile.all-in-oneindex 8e5ff472a..45b18a531 100644--- a/Dockerfile.all-in-one+++ b/Dockerfile.all-in-one@@ -10,6 +10,7 @@ RUN yarn config set network-timeout 600000COPY ./frontend/package.json ./frontend/yarn.lock ./COPY ./frontend .+COPY ./VERSION /app/VERSIONRUN yarn install --network-timeout 600000 --frozen-lockfile && yarn build@@ -28,6 +29,7 @@ RUN apk add --no-cache nodejs yarn nginx supervisor dos2unixCOPY --from=node-frontend /app/frontend /app/frontendCOPY ./backend /app/backend+COPY ./VERSION /app/backend/VERSIONRUN mkdir -p /app/backend/bootstrap/cache \&& mkdir -p /app/backend/storage \&& chown -R www-data:www-data /app/backend \diff --git a/VERSION b/VERSIONnew file mode 100644index 000000000..2e1cd7d5a--- /dev/null+++ b/VERSION@@ -0,0 +1 @@+1.7.0-betadiff --git a/backend/app/Http/Actions/Admin/GetSystemInfoAction.php b/backend/app/Http/Actions/Admin/GetSystemInfoAction.phpnew file mode 100644index 000000000..d26856049--- /dev/null+++ b/backend/app/Http/Actions/Admin/GetSystemInfoAction.php@@ -0,0 +1,29 @@+<?php++declare(strict_types=1);++namespace HiEvents\Http\Actions\Admin;++use HiEvents\DomainObjects\Enums\Role;+use HiEvents\Http\Actions\BaseAction;+use Illuminate\Http\JsonResponse;++class GetSystemInfoAction extends BaseAction+{+ public function __invoke(): JsonResponse+ {+ $this->minimumAllowedRole(Role::SUPERADMIN);++ $version = trim(@file_get_contents(base_path('VERSION')) ?: 'unknown');++ return $this->jsonResponse([+ 'version' => $version,+ 'php_version' => PHP_VERSION,+ 'laravel_version' => app()->version(),+ 'environment' => app()->environment(),+ 'debug_mode' => config('app.debug'),+ 'timezone' => config('app.timezone'),+ 'os' => PHP_OS,+ ]);+ }+}diff --git a/backend/composer.json b/backend/composer.jsonindex 8dbd2ad25..90341cb29 100644--- a/backend/composer.json+++ b/backend/composer.json@@ -4,7 +4,7 @@"description": "hi.events - Ticket selling and event management.","keywords": ["ticketing", "events"],"license": "AGPL-3.0",- "version": "0.0.1",+ "version": "1.7.0-beta","require": {"php": "^8.2","ext-intl": "*",diff --git a/backend/routes/api.php b/backend/routes/api.phpindex 09ca424e4..85af28760 100644--- a/backend/routes/api.php+++ b/backend/routes/api.php@@ -191,6 +191,7 @@ use HiEvents\Http\Actions\Admin\GetMessagingTiersAction;use HiEvents\Http\Actions\Admin\Accounts\UpdateAccountMessagingTierAction;use HiEvents\Http\Actions\Admin\Orders\GetAllOrdersAction;use HiEvents\Http\Actions\Admin\Attribution\GetUtmAttributionStatsAction;+use HiEvents\Http\Actions\Admin\GetSystemInfoAction;use HiEvents\Http\Actions\Admin\Stats\GetAdminDashboardDataAction;use HiEvents\Http\Actions\Admin\Stats\GetAdminStatsAction;use HiEvents\Http\Actions\Admin\Users\GetAllUsersAction;@@ -472,6 +473,9 @@ $router->prefix('/admin')->middleware(['auth:api'])->group(// Messaging Tiers$router->get('/messaging-tiers', GetMessagingTiersAction::class);$router->put('/accounts/{account_id}/messaging-tier', UpdateAccountMessagingTierAction::class);++ // System Info+ $router->get('/system-info', GetSystemInfoAction::class);});diff --git a/docker/development/docker-compose.dev.yml b/docker/development/docker-compose.dev.ymlindex 2516a6c62..1c605156c 100644--- a/docker/development/docker-compose.dev.yml+++ b/docker/development/docker-compose.dev.yml@@ -10,6 +10,7 @@ services:- ./../../backend:/var/www/html- ./../../backend/storage:/var/www/html/storage- ./../../backend/bootstrap/cache:/var/www/html/bootstrap/cache+ - ./../../VERSION:/var/www/html/VERSION:roenvironment:APP_ENV: '${APP_ENV:-local}'APP_KEY: '${APP_KEY}'@@ -32,6 +33,7 @@ services:volumes:- ./../../frontend:/app- /app/node_modules+ - ./../../VERSION:/app/VERSION:rocommand: yarn dev:csrenvironment:@@ -49,6 +51,7 @@ services:volumes:- ./../../frontend:/app- /app/node_modules+ - ./../../VERSION:/app/VERSION:rocommand: yarn dev:ssrenvironment:diff --git a/frontend/package.json b/frontend/package.jsonindex 996450036..6a4d8653a 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -1,7 +1,7 @@{"name": "hievents-frontend","private": true,- "version": "0.0.0",+ "version": "1.7.0-beta","type": "module","scripts": {"dev:csr": "vite --port 5678 --host 0.0.0.0",diff --git a/frontend/src/components/layouts/AuthLayout/index.tsx b/frontend/src/components/layouts/AuthLayout/index.tsxindex a27a83f49..88ca89099 100644--- a/frontend/src/components/layouts/AuthLayout/index.tsx+++ b/frontend/src/components/layouts/AuthLayout/index.tsx@@ -15,9 +15,10 @@ import {IconTicket,IconUsers,} from '@tabler/icons-react';-import {useMemo} from "react";+import {useCallback, useMemo, useRef} from "react";import {getConfig} from "../../../utilites/config.ts";import {isHiEvents} from "../../../utilites/helpers.ts";+import {showInfo} from "../../../utilites/notifications.tsx";const allFeatures = [{@@ -107,6 +108,19 @@ const FeaturePanel = () => {const AuthLayout = () => {const me = useGetMe();+ const clickCountRef = useRef(0);+ const clickTimerRef = useRef<ReturnType<typeof setTimeout>>();++ const handleLogoClick = useCallback(() => {+ clickCountRef.current += 1;+ clearTimeout(clickTimerRef.current);+ clickTimerRef.current = setTimeout(() => { clickCountRef.current = 0; }, 2000);++ if (clickCountRef.current >= 5) {+ clickCountRef.current = 0;+ showInfo(`HiEvents v${__APP_VERSION__}`);+ }+ }, []);if (me.isSuccess) {return <Navigate to={'/manage/events'} />@@ -117,7 +131,7 @@ const AuthLayout = () => {<div className={classes.splitLayout}><div className={classes.leftPanel}><main className={classes.container}>- <div className={classes.logo}>+ <div className={classes.logo} onClick={handleLogoClick} style={{cursor: 'pointer'}}><imgsrc={getConfig("VITE_APP_LOGO_DARK", "/logos/hi-events-stacked-light.svg")}alt={t`${getConfig("VITE_APP_NAME", "Hi.Events")} logo`}diff --git a/frontend/src/globals.d.ts b/frontend/src/globals.d.tsnew file mode 100644index 000000000..41fad5b54--- /dev/null+++ b/frontend/src/globals.d.ts@@ -0,0 +1 @@+declare const __APP_VERSION__: string;diff --git a/frontend/vite.config.ts b/frontend/vite.config.tsindex 722202add..529092e48 100644--- a/frontend/vite.config.ts+++ b/frontend/vite.config.ts@@ -2,6 +2,22 @@ import {defineConfig} from "vite";import {lingui} from "@lingui/vite-plugin";import react from "@vitejs/plugin-react";import {copy} from "vite-plugin-copy";+import {existsSync, readFileSync} from "fs";+import {resolve} from "path";++function getVersion(): string {+ const candidates = [+ resolve(__dirname, "../VERSION"),+ resolve(__dirname, "../../VERSION"),+ "/app/VERSION",+ ];+ for (const path of candidates) {+ if (existsSync(path)) {+ return readFileSync(path, "utf-8").trim();+ }+ }+ return "unknown";+}export default defineConfig({optimizeDeps: {@@ -27,6 +43,7 @@ export default defineConfig({],define: {"process.env": process.env,+ "__APP_VERSION__": JSON.stringify(getVersion()),},ssr: {noExternal: ["react-helmet-async"],diff --git a/scripts/set-version.sh b/scripts/set-version.shnew file mode 100755index 000000000..f692f6d8e--- /dev/null+++ b/scripts/set-version.sh@@ -0,0 +1,24 @@+#!/bin/bash++set -e++if [ -z "$1" ]; then+ echo "Usage: $0 <version>"+ echo "Example: $0 1.7.0-beta"+ exit 1+fi++VERSION="$1"+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"+ROOT_DIR="$(dirname "$SCRIPT_DIR")"++echo "$VERSION" > "$ROOT_DIR/VERSION"+echo "Updated VERSION file to $VERSION"++awk -v ver="$VERSION" '!done && /"version":/ { sub(/"version": ".*"/, "\"version\": \"" ver "\""); done=1 } 1' "$ROOT_DIR/backend/composer.json" > "$ROOT_DIR/backend/composer.json.tmp" && mv "$ROOT_DIR/backend/composer.json.tmp" "$ROOT_DIR/backend/composer.json"+echo "Updated backend/composer.json to $VERSION"++awk -v ver="$VERSION" '!done && /"version":/ { sub(/"version": ".*"/, "\"version\": \"" ver "\""); done=1 } 1' "$ROOT_DIR/frontend/package.json" > "$ROOT_DIR/frontend/package.json.tmp" && mv "$ROOT_DIR/frontend/package.json.tmp" "$ROOT_DIR/frontend/package.json"+echo "Updated frontend/package.json to $VERSION"++echo "All files updated to version $VERSION"