Skip to content

Commit 9ad3c39

Browse files
Merge pull request #162 from flocko-motion/development
Version 1.44 for prod
2 parents 78f1b93 + 1e4c983 commit 9ad3c39

File tree

10 files changed

+81
-70
lines changed

10 files changed

+81
-70
lines changed

.github/workflows/docker-image.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -198,25 +198,17 @@ jobs:
198198
echo "Release version: ${{ needs.semantic-release.outputs.version }}"
199199
200200
if [ "${{ github.ref_name }}" = "main" ]; then
201-
# Production: trigger omnitopos only
202-
echo "Triggering production webhook..."
201+
echo "Triggering Coolify prod webhook..."
203202
curl -X POST \
204-
-u "${{ secrets.OMNITOPOS_USERNAME }}:${{ secrets.OMNITOPOS_PASSWORD }}" \
203+
-H "Authorization: Bearer ${{ secrets.COOLIFY_WEBHOOK_TOKEN }}" \
205204
-f \
206-
"https://omnitopos.net/dashctl/cgl-prod/restart"
205+
"${{ secrets.COOLIFY_WEBHOOK_URL_PROD }}" || echo "⚠️ Coolify prod webhook failed"
207206
else
208-
# Development: trigger both omnitopos and coolify
209-
echo "Triggering omnitopos dev webhook..."
210-
curl -X POST \
211-
-u "${{ secrets.OMNITOPOS_USERNAME }}:${{ secrets.OMNITOPOS_PASSWORD }}" \
212-
-f \
213-
"https://omnitopos.net/dashctl/cgl-dev/restart" || echo "⚠️ Omnitopos webhook failed"
214-
215207
echo "Triggering Coolify dev webhook..."
216208
curl -X POST \
217209
-H "Authorization: Bearer ${{ secrets.COOLIFY_WEBHOOK_TOKEN }}" \
218210
-f \
219-
"${{ secrets.COOLIFY_WEBHOOK_URL }}" || echo "⚠️ Coolify webhook failed"
211+
"${{ secrets.COOLIFY_WEBHOOK_URL }}" || echo "⚠️ Coolify dev webhook failed"
220212
fi
221213
222214
summary:

server/db/api_key_shares.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ func DeleteApiKey(ctx context.Context, userID uuid.UUID, shareID uuid.UUID) erro
139139
return obj.ErrServerError("failed to clear game sponsored api key references")
140140
}
141141

142+
// Clear system free-use key reference if it points to this key
143+
if err := queries().ClearSystemSettingsFreeUseApiKey(ctx, uuid.NullUUID{UUID: key.ID, Valid: true}); err != nil {
144+
return obj.ErrServerError("failed to clear system free-use api key reference")
145+
}
146+
142147
wasDefault := key.IsDefault
143148

144149
// Delete all shares

server/db/queries/system_settings.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ SET
2929
free_use_api_key_id = $1,
3030
modified_at = now();
3131

32+
-- name: ClearSystemSettingsFreeUseApiKey :exec
33+
UPDATE system_settings
34+
SET
35+
free_use_api_key_id = NULL,
36+
modified_at = now()
37+
WHERE free_use_api_key_id = $1;
38+
3239
-- name: InitSystemSettings :exec
3340
INSERT INTO system_settings (id, default_ai_quality_tier)
3441
VALUES ('00000000-0000-0000-0000-000000000001'::uuid, $1)

server/db/sqlc/system_settings.sql.go

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/src/common/lib/roles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const ROLE_MAP: Record<RoleString, Role> = {
5353
const ROLE_LABELS: Record<Role, string> = {
5454
[Role.Participant]: "Participant",
5555
[Role.Individual]: "Individual",
56-
[Role.Staff]: "Staff",
56+
[Role.Staff]: "Workshop Lead",
5757
[Role.Head]: "Head",
5858
[Role.Admin]: "Admin",
5959
};

web/src/features/admin/components/ServerSettings.tsx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,6 @@ export function ServerSettings() {
132132
{t("serverSettings.freeUseKey.remove")}
133133
</Button>
134134
</Group>
135-
) : currentKeyId ? (
136-
<Group gap="sm" wrap="wrap">
137-
<Badge color="orange" variant="light" size="lg">
138-
{t("serverSettings.freeUseKey.unknownKey")}
139-
</Badge>
140-
<Button
141-
variant="subtle"
142-
color="red"
143-
size="xs"
144-
onClick={() => setFreeUseKey.mutate({ apiKeyId: null })}
145-
loading={setFreeUseKey.isPending}
146-
>
147-
{t("serverSettings.freeUseKey.remove")}
148-
</Button>
149-
</Group>
150135
) : (
151136
<Select
152137
placeholder={t("serverSettings.freeUseKey.selectPlaceholder")}

web/src/features/admin/components/UserManagement.tsx

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function UserManagement() {
7474
null,
7575
);
7676
const [userToEdit, setUserToEdit] = useState<ObjUser | null>(null);
77-
const [editEmail, setEditEmail] = useState("");
77+
const [editName, setEditName] = useState("");
7878
const [
7979
deleteModalOpened,
8080
{ open: openDeleteModal, close: closeDeleteModal },
@@ -141,20 +141,14 @@ export function UserManagement() {
141141

142142
// Update user mutation
143143
const updateUserMutation = useMutation({
144-
mutationFn: async ({
145-
userId,
146-
email,
147-
}: {
148-
userId: string;
149-
email: string;
150-
}) => {
151-
await api.users.usersCreate(userId, { email });
144+
mutationFn: async ({ userId, name }: { userId: string; name: string }) => {
145+
await api.users.usersCreate(userId, { name });
152146
},
153147
onSuccess: () => {
154148
queryClient.invalidateQueries({ queryKey: queryKeys.adminUsers });
155149
closeEditModal();
156150
setUserToEdit(null);
157-
setEditEmail("");
151+
setEditName("");
158152
},
159153
});
160154

@@ -229,7 +223,7 @@ export function UserManagement() {
229223
const handleEdit = useCallback(
230224
(user: ObjUser) => {
231225
setUserToEdit(user);
232-
setEditEmail(user.email || "");
226+
setEditName(user.name || "");
233227
openEditModal();
234228
},
235229
[openEditModal],
@@ -264,8 +258,11 @@ export function UserManagement() {
264258
if (!users) return [];
265259

266260
return users.filter((user) => {
267-
// Filter out guests if toggle is on
268-
if (hideGuests && user.role?.role === "participant") {
261+
// Filter out guests and participants if toggle is on
262+
if (
263+
hideGuests &&
264+
(!user.role?.role || user.role.role === "participant")
265+
) {
269266
return false;
270267
}
271268

@@ -330,7 +327,8 @@ export function UserManagement() {
330327
// Count guests for display
331328
const guestCount = useMemo(() => {
332329
if (!users) return 0;
333-
return users.filter((u) => u.role?.role === "participant").length;
330+
return users.filter((u) => !u.role?.role || u.role.role === "participant")
331+
.length;
334332
}, [users]);
335333

336334
if (error) {
@@ -482,7 +480,7 @@ export function UserManagement() {
482480
</ActionIcon>
483481
</Tooltip>
484482
)}
485-
<Tooltip label={t("admin.users.editEmail")}>
483+
<Tooltip label={t("admin.users.editName")}>
486484
<ActionIcon
487485
variant="subtle"
488486
color="blue"
@@ -590,7 +588,7 @@ export function UserManagement() {
590588
</ActionIcon>
591589
</Tooltip>
592590
)}
593-
<Tooltip label={t("admin.users.editEmail")}>
591+
<Tooltip label={t("admin.users.editName")}>
594592
<ActionIcon
595593
variant="subtle"
596594
color="blue"
@@ -760,10 +758,10 @@ export function UserManagement() {
760758
{t("admin.users.editingUser", { name: userToEdit?.name })}
761759
</Text>
762760
<TextInput
763-
label={t("admin.users.email")}
764-
placeholder={t("admin.users.emailPlaceholder")}
765-
value={editEmail}
766-
onChange={(e) => setEditEmail(e.currentTarget.value)}
761+
label={t("admin.users.name")}
762+
placeholder={t("admin.users.namePlaceholder")}
763+
value={editName}
764+
onChange={(e) => setEditName(e.currentTarget.value)}
767765
/>
768766
<Group justify="flex-end">
769767
<Text
@@ -782,11 +780,11 @@ export function UserManagement() {
782780
userToEdit?.id &&
783781
updateUserMutation.mutate({
784782
userId: userToEdit.id,
785-
email: editEmail,
783+
name: editName,
786784
})
787785
}
788786
loading={updateUserMutation.isPending}
789-
disabled={editEmail === (userToEdit?.email || "")}
787+
disabled={editName === (userToEdit?.name || "")}
790788
>
791789
<IconEdit size={16} />
792790
</ActionIcon>

web/src/i18n/locales/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@
11901190
"you": "Du"
11911191
},
11921192
"navigation": {
1193+
"adminPanel": "Admin-Bereich",
11931194
"allGames": "Alle Spiele",
11941195
"create": "Eigene Spiele erstellen",
11951196
"createGame": "Spiel erstellen",

web/src/i18n/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,7 @@
11411141
"you": "You"
11421142
},
11431143
"navigation": {
1144+
"adminPanel": "Admin Panel",
11441145
"allGames": "All Games",
11451146
"create": "Create Your Own Game",
11461147
"createGame": "Create Game",

web/src/routes/__root.tsx

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
IconSchool,
1212
IconSettings,
1313
IconTools,
14+
IconShield,
1415
} from "@tabler/icons-react";
1516
import { useTranslation } from "react-i18next";
1617
import { useEffect } from "react";
@@ -233,26 +234,34 @@ function RootComponent() {
233234

234235
// Admin-only navigation items
235236
if (isAdmin(backendUser)) {
236-
navItems.push(
237-
{
238-
label: t("serverSettings"),
239-
icon: <IconSettings size={18} />,
240-
onClick: () => navigate({ to: ROUTES.ADMIN_SERVER_SETTINGS as "/" }),
241-
active: pathname.startsWith(ROUTES.ADMIN_SERVER_SETTINGS),
242-
},
243-
{
244-
label: t("manageOrganizations"),
245-
icon: <IconBuilding size={18} />,
246-
onClick: () => navigate({ to: ROUTES.ADMIN_ORGANIZATIONS as "/" }),
247-
active: pathname.startsWith(ROUTES.ADMIN_ORGANIZATIONS),
248-
},
249-
{
250-
label: t("manageUsers"),
251-
icon: <IconUsers size={18} />,
252-
onClick: () => navigate({ to: ROUTES.ADMIN_USERS as "/" }),
253-
active: pathname.startsWith(ROUTES.ADMIN_USERS),
254-
},
255-
);
237+
navItems.push({
238+
label: t("adminPanel"),
239+
icon: <IconShield size={18} />,
240+
active:
241+
pathname.startsWith(ROUTES.ADMIN_SERVER_SETTINGS) ||
242+
pathname.startsWith(ROUTES.ADMIN_ORGANIZATIONS) ||
243+
pathname.startsWith(ROUTES.ADMIN_USERS),
244+
children: [
245+
{
246+
label: t("serverSettings"),
247+
icon: <IconSettings size={18} />,
248+
onClick: () => navigate({ to: ROUTES.ADMIN_SERVER_SETTINGS as "/" }),
249+
active: pathname.startsWith(ROUTES.ADMIN_SERVER_SETTINGS),
250+
},
251+
{
252+
label: t("manageOrganizations"),
253+
icon: <IconBuilding size={18} />,
254+
onClick: () => navigate({ to: ROUTES.ADMIN_ORGANIZATIONS as "/" }),
255+
active: pathname.startsWith(ROUTES.ADMIN_ORGANIZATIONS),
256+
},
257+
{
258+
label: t("manageUsers"),
259+
icon: <IconUsers size={18} />,
260+
onClick: () => navigate({ to: ROUTES.ADMIN_USERS as "/" }),
261+
active: pathname.startsWith(ROUTES.ADMIN_USERS),
262+
},
263+
],
264+
});
256265
}
257266

258267
// Header navigation callbacks

0 commit comments

Comments
 (0)