Commit graph

75 commits

Author SHA1 Message Date
Maaxxs
4d4a030b95 Add a Premades management page mirroring the Discord bot's /premade
Ports the bot's premade feature set (cogs/premades.py) to the
website using the raid API's existing, already-deployed premade
endpoints - no bot/API changes needed:

- Overview of all premades: lead, accepted members, open invites
- Found/rename/dissolve your own premade
- Invite a linked website member (sends the same Discord DM with
  Accept/Decline buttons the bot itself sends), remove a member,
  transfer leadership
- "Meine Einladungen": accept/decline invites addressed to you
- premades.manage lets admins manage any premade, not just their own,
  mirroring the bot's admin-only "Admin-Verwaltung" flow

New permissions premades.view/premades.manage (view granted to the
default Mitglied role on fresh installs; existing installs need to
add them manually, documented in README.md). Every mutation is
re-validated server-side against the current premade list (ownership,
one-premade-per-person, can't remove the lead, accept/decline only
for an invite that's actually pending for that user) since the UI's
button visibility alone isn't an authorization check.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 08:00:45 +02:00
Maaxxs
70f050dc19 Turn Archivieren/Wiederherstellen/Endgültig löschen into icon buttons
Replaces the three raid action text-buttons with icon-only buttons
(archive box, restore arrow, trash can) using the existing
icon-button style; the label now only shows as a native tooltip on
hover via the title attribute. The delete button gets a new
icon-button-danger modifier so it still reads as destructive (red on
hover) instead of the default gold.

Also fixes a pre-existing bug this surfaced: .icon-button:hover only
set color/border-color, so the global button:hover rule's gold
background bled through on hover for every icon-button on the site
(edit toggle, modal close, etc.), not just the new ones.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 07:51:56 +02:00
Maaxxs
22a61d28be Allow permanently deleting archived raids
Wires up the bot API's existing DELETE /api/raids/{id}/permanent
endpoint: archived raids now get an "Endgültig löschen" button next
to "Wiederherstellen" (raids.manage only), gated by a confirmation
dialog since it's irreversible - unlike the existing archive action,
which only soft-deletes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 07:34:55 +02:00
Maaxxs
08db95f3a3 Replace Discord avatar sync with self-service profile picture upload
Drops the Discord-derived avatar entirely (discord_avatar,
discord_refresh_token, discord_avatar_synced_at and the background
refresh via OAuth refresh token) in favor of members uploading their
own picture. "Mein Profil" now shows a larger (120px) avatar with a
pencil button pinned to its top-right corner; picking a file uploads
it immediately. Uploads are validated by actual image content
(getimagesize, not the original filename/extension) and stored under
a randomly generated name in assets/uploads/avatars/, which ships
with its own .htaccess disabling script execution so a disguised
upload can never run as PHP. Falls back to the existing letter
placeholder when no picture is set.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 07:34:47 +02:00
Maaxxs
1c9aa0761f Auto-refresh Discord username/avatar via OAuth refresh token
Previously the stored Discord identity only updated when a member
manually unlinked and relinked their account, so a changed Discord
avatar never showed up. The OAuth exchange now also captures the
refresh_token; discord_sync_avatar_if_stale() uses it to silently
pull the current username/avatar (throttled to once per hour) and is
called from profile.php, so opening "Mein Profil" keeps it current
without any re-consent flow. Adds discord_refresh_token and
discord_avatar_synced_at columns.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 07:26:02 +02:00
Maaxxs
4eba8d1fef Add onerror fallback for avatars and show a large one on Mein Profil
The Discord CDN image is now paired with a hidden letter-placeholder
sibling; if the <img> fails to load (stale avatar hash, a tracking
blocker on cdn.discordapp.com, etc.) it swaps to the placeholder
instead of leaving a broken image icon. Also adds the same avatar,
at a larger size, next to the heading on the Mein Profil page.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 07:20:33 +02:00
Maaxxs
fa05cf3ef0 Add profile pictures: Discord avatar or a letter placeholder
Adds a discord_avatar column (captured from Discord's OAuth /users/@me
response and stored alongside discord_id/discord_username) and a new
avatar_html() helper: it renders the linked Discord avatar when one is
set, otherwise a circular placeholder with the display name's first
letter on a color picked deterministically per user from a palette
tuned for the dark/gold Lumina theme. Shown on the Startseite hero for
logged-in members and next to "Angemeldet als" in the sidebar footer.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 07:12:45 +02:00
Maaxxs
6e879a67ed Normalize class icon artwork so all 8 look visually the same size
Fixing the container frame (previous commit) wasn't enough - the
source PNGs have different content-to-canvas ratios and aspect
ratios, so object-fit: contain still rendered each icon at a
different effective size within an identically-sized box.

Cropped each icon to its actual non-transparent bounding box, then
centered it on a uniform 64x64 canvas at a consistent max content
size (46px). class_icon_url() now points at these normalized copies;
originals are untouched. Applies everywhere the function is used
(signup picker and raid member lists), verified via screenshot.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 19:03:04 +02:00
Maaxxs
fea0cc3a91 Overhaul raid signup/management to match the Discord bot's full feature set
Signup is now a single "Anmelden" button that opens a class-icon
picker + optional group choice. A new raid_wish_is_sensible() mirrors
the bot's exact role-cap algorithm (Tank/Heal 1, DPS 3 per 5-player
group, ROLE_MAPPING copied from teamplaner.py) to decide server-side
whether the requested group is honored or the request falls back to
the bot's own auto-assignment - with a message telling the member to
ping the raid lead if they wanted something specific. Verified the
cap logic with 7 synthetic cases (own-signup exclusion, full group,
role caps, bench always allowed) before wiring it up.

Admins get a per-raid edit-mode toggle (pencil icon) that reveals:
inline raid editing (title/date/requirements/gearscore/groups/slots/
group locks) via PATCH, a premade-invite mini-form via the new
premades endpoint, and native HTML5 drag-and-drop to move a signup
between groups/bench via PATCH .../signup/{user_id}.

New pieces: includes/raids_api.php gained move_signup(), update_raid(),
invite_premade(), fetch_premades(), fetch_raid_by_id() and the wish-
sensibility check; four new JSON action endpoints (raid_signup_action,
raid_move_action, raid_edit_action, raid_premade_invite_action) reusing
the session CSRF token via a new verify_csrf_token()/read_json_body()/
json_response() trio in functions.php; assets/js/raids.js drives the
modal, edit-mode, and drag-and-drop with plain fetch() (no framework).

Read-heavy parts (page render, class icons, signup-wish logic) verified
against real data/live API. Edit, move and premade-invite are NOT
tested against the live API yet since they'd mutate the real raid or
send real Discord DMs to guild members - flagging this for a
supervised live check before considering it fully verified.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 18:36:04 +02:00
Maaxxs
e6f170deff Add per-page background images from the Landscapes artwork
Dashboard, Mein Profil, Raids and the admin pages (Benutzerverwaltung/
Berechtigungsgruppen) each get a distinct backdrop behind the panels,
via a page->background map in header.php and a dark gradient overlay
so text stays readable. Raids uses the darkest/most dramatic image as
requested.

Generated compressed 1920px-wide JPEG copies under Landscapes/web/
for actual use on the page - the original PNGs were up to 11.7MB
(landscape4), which would have made every page load painfully slow.
Originals are kept untouched alongside them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 18:16:37 +02:00
Maaxxs
be8373529a Redesign the profile page: side-by-side fields and a proper Discord card
Anzeigename and Passwort ändern now sit in a two-column grid (stacks
on narrow screens). The Discord section gets its own bordered card
with the official Discord mark (inline SVG, brand blurple accent) and
a clear Verbunden/Nicht verbunden status badge, replacing the plain
generic panel. Verified both connection states with a rendered
screenshot.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 18:07:12 +02:00
Maaxxs
706cf97d64 Add a "Mein Profil" page and align raids with the real bot logic
- New profile.php (display name, password, Discord link/unlink),
  reachable from the sidebar; removed the duplicate Discord section
  from the dashboard.
- Corrected class names/icon mapping to match the actual bot config
  (Beschwörer, Kantor) instead of the guessed German terms used
  earlier.
- raids.php now understands the bot's full group model: group 0 is
  the bench ("Ersatzbank"), -1 is a decline ("Abgemeldet"), and class
  "Ausstehend" marks a pending premade invite (now shown with an
  hourglass instead of being silently dropped or mis-rendered). The
  "X / max" counter matches the bot's own active-count logic (pending
  invites don't count). Signup form also lets a member choose the
  bench explicitly.
- A few more inline icons (profile, list) for general visual polish.

Verified grouping/active-count/icon logic with synthetic bench/
declined/pending signups, and the real raids.php flow (profile
update, sidebar nav) against a local DB plus the live raids API.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 13:49:41 +02:00
Maaxxs
8c703f0e1f Add Discord account linking and raid signup/management from the website
- Class name on raid signups now shows only as an icon tooltip instead
  of trailing text (falls back to text when no icon matches).
- Discord OAuth2 linking (discord_login.php/discord_callback.php,
  includes/discord.php): members connect their Discord account from
  the dashboard, storing discord_id/discord_username so raid signups
  can be attributed to their real Discord identity. Needs a Discord
  application's client_id/client_secret in config.php.
- raids.php gets self-service signup/withdraw controls (class + group
  picker, upsert semantics) for members with a linked Discord account,
  plus archive/restore controls gated behind a new raids.manage
  permission. New action scripts raid_signup.php, raid_unsignup.php,
  raid_archive.php, raid_restore.php call the corresponding
  includes/raids_api.php functions.
- Archive/restore already work today (verified live against the bot's
  API - archived and restored the one active raid, signups intact).
  Signup/withdraw are fully wired on the website side but need two new
  bot-side endpoints (POST .../signup, DELETE .../signup/{user_id})
  that don't exist yet - contract documented in the README.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 13:25:41 +02:00
Maaxxs
9ac5a7c97e Map Templar/Templer to the new class icon
Completes the class icon set now that Templar_ICO.png was added.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 13:05:48 +02:00
Maaxxs
2a73e0e473 Show class icons next to raid signups
Maps the class names the raid bot returns (a mix of English icon
filenames and German in-game terms like "Magier"/"Jäger") to the icon
files under assets/images/Classes via class_icon_url(), case- and
whitespace-insensitive. Classes without a matching file (e.g.
"Templer", or the "Ausstehend" placeholder) just keep the plain text
label instead of showing a broken image. Verified against live signup
data from the API.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 13:02:35 +02:00
Maaxxs
4df0149f8b Add active/archived/all filter tabs to the Raids page
Uses the bot's new ?status= query param on /api/raids. fetch_raids()
takes a status argument (whitelisted against active/archived/all,
falls back to active on anything else) and appends it to the request
URL. Archived raids get a dimmed card style and an "Archiviert" badge
using the new archived/archived_at fields. Verified all three filters
end-to-end against the live API.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 12:59:01 +02:00
Maaxxs
620ef68015 Add a Raids page fed by the guild's external raids API
New raids.php shows upcoming raids (date, requirements, gearscore,
groups and their signups) pulled from https://api.maaxxs-coding.de/api/raids
via includes/raids_api.php (cURL + X-API-Key header), gated behind a
new raids.view permission so it fits the existing permission-group
model. Fresh installs seed raids.view onto Mitglied automatically;
existing installs need to add it once via the Berechtigungsgruppen UI
(documented in the README). API/network failures show a friendly
error instead of crashing the page.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 12:44:17 +02:00
Maaxxs
00e52f2308 Replace the "Aion2 Gilde" text brand with the guild logo image
Swaps the text link in the sidebar and the logged-out top bar for
the logo at assets/images/logo.png, sized via CSS (56px in the
sidebar, 40px in the top bar, 32px on the collapsed mobile bar).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 07:19:47 +02:00
Maaxxs
77bb1b3ff5 Use real German umlauts instead of ASCII transliterations
Every "oe/ae/ue" spelling throughout the UI text and comments (fuer,
loeschen, koennen, ...) was my own typo, not an encoding bug - the
charset fix in the last commit was unrelated. Replaced all of them
with proper ö/ä/ü across every PHP file and the README.

Also fix table rows rendering inconsistently: `.actions` and the
status badges were applying `display:flex` directly to a <td>, which
fights the table layout model and renders unreliably across browsers.
Moved the flex layout into a wrapper <div> inside each cell instead,
and restyled row-level delete buttons as plain text links so they
match the height of the "Bearbeiten" link exactly. Tables also get a
horizontal-scroll wrapper so narrow viewports scroll instead of
squeezing cell content.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 07:16:15 +02:00
Maaxxs
3c72d0ed7e Force UTF-8 output and switch the palette to neutral gray
Explicitly set the Content-Type charset (PHP's default_charset can be
overridden by the host, which breaks oe/ae/ue even though the meta
tag says UTF-8) and add matching .htaccess/schema collation. Verified
end-to-end that umlauts round-trip correctly through the DB and render
correctly in the browser. Also replaced the dark blue-tinted palette
with true neutral grays; the gold accent stays.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 06:58:53 +02:00
Maaxxs
5811019908 Redesign the logged-in area with a left icon sidebar layout
Replaces the top navbar with a fixed vertical sidebar (brand, nav
links with inline SVG icons, active-link highlighting, user info and
logout pinned to the bottom) for a more modern dashboard feel. Public
pages (login, install, logged-out landing) keep the simple top bar.
Collapses to an icon-only horizontal bar under 860px since there's no
JS toggle. Dashboard quick-links get matching icon badges.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 06:52:19 +02:00
Maaxxs
a96fdd1b16 Force a password change on first login for newly created users
New users no longer get a manually typed password: admins get a
random one-time password shown once after creation, and the account
is flagged must_change_password. require_login() redirects anyone
with that flag to the new change_password.php page (except that page
and logout) until they set their own password. Admins can also toggle
the flag when editing an existing user to force a re-change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 06:45:44 +02:00
Maaxxs
6dd68a6264 Remove email from user accounts entirely
Guild members only need a username/password, and nothing in the app
used email for anything (no notifications, no password reset). Drops
the column from the schema, the login lookup, install.php, and the
admin user list/form.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 06:37:04 +02:00
Maaxxs
c12fba64f3 Fix 500 error from unguarded RewriteEngine directive in root .htaccess
RewriteEngine/RewriteRule without an <IfModule mod_rewrite.c> guard
breaks every request with a 500 when mod_rewrite isn't loaded. Replace
it with per-folder .htaccess deny rules (already used by includes/,
now added for sql/) that only depend on mod_authz_core/mod_access,
which are essentially universal on Apache.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 06:27:09 +02:00
Maaxxs
4871d29afa Add member/admin dashboard with login, user management, and permission groups
Provides PHP/MySQL-based auth (sessions, CSRF), a permission-and-role
system (permission groups with per-permission keys), and an admin-only
user management area. Homepage left as a placeholder for later.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 05:49:47 +02:00