Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile.all-in-one
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN yarn config set network-timeout 600000
COPY ./frontend/package.json ./frontend/yarn.lock ./

COPY ./frontend .
COPY ./VERSION /app/VERSION

RUN yarn install --network-timeout 600000 --frozen-lockfile && yarn build

Expand All @@ -28,6 +29,7 @@ RUN apk add --no-cache nodejs yarn nginx supervisor dos2unix
COPY --from=node-frontend /app/frontend /app/frontend

COPY ./backend /app/backend
COPY ./VERSION /app/backend/VERSION
RUN mkdir -p /app/backend/bootstrap/cache \
&& mkdir -p /app/backend/storage \
&& chown -R www-data:www-data /app/backend \
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.7.0-beta
29 changes: 29 additions & 0 deletions backend/app/Http/Actions/Admin/GetSystemInfoAction.php
Original file line number Diff line number Diff line change
@@ -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,
]);
}
}
2 changes: 1 addition & 1 deletion backend/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down
4 changes: 4 additions & 0 deletions backend/routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
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;
Expand Down Expand Up @@ -472,6 +473,9 @@ function (Router $router): void {
// 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);
}
);

Expand Down
3 changes: 3 additions & 0 deletions docker/development/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:ro
environment:
APP_ENV: '${APP_ENV:-local}'
APP_KEY: '${APP_KEY}'
Expand All @@ -32,6 +33,7 @@ services:
volumes:
- ./../../frontend:/app
- /app/node_modules
- ./../../VERSION:/app/VERSION:ro

command: yarn dev:csr
environment:
Expand All @@ -49,6 +51,7 @@ services:
volumes:
- ./../../frontend:/app
- /app/node_modules
- ./../../VERSION:/app/VERSION:ro

command: yarn dev:ssr
environment:
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
18 changes: 16 additions & 2 deletions frontend/src/components/layouts/AuthLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
{
Expand Down Expand Up @@ -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'} />
Expand All @@ -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'}}>
<img
src={getConfig("VITE_APP_LOGO_DARK", "/logos/hi-events-stacked-light.svg")}
alt={t`${getConfig("VITE_APP_NAME", "Hi.Events")} logo`}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare const __APP_VERSION__: string;
17 changes: 17 additions & 0 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -27,6 +43,7 @@ export default defineConfig({
],
define: {
"process.env": process.env,
"__APP_VERSION__": JSON.stringify(getVersion()),
},
ssr: {
noExternal: ["react-helmet-async"],
Expand Down
24 changes: 24 additions & 0 deletions scripts/set-version.sh
Original file line number Diff line number Diff line change
@@ -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"
Loading