chore: commit all missing files from Qute/Alpine migration
CI / Build Native (push) Successful in 7m9s
CI / Build Native (push) Successful in 7m9s
This commit adds all the files that were created during the frontend migration (Qute templates + Alpine.js) but were never committed to git. Includes: - TemplateData.java (shared Qute page helpers) - Static resources: app.js, defaults.js, calc.js, alpine.min.js, pico.min.css, favicon.svg - Qute templates: changePassword, formulas, insumos, login, register, usuarios - Partial templates: header.html, layout/base.html - Modified: MustChangePasswordFilter.java (added login/register paths) - Modified: AppState.java (added price fields) - Modified: format.js (simplified number formatting) - Modified: application.properties (static resources comment) - Modified: calculadora.html (Qute/Alpine rewrite)
This commit is contained in:
@@ -54,6 +54,9 @@ public class MustChangePasswordFilter implements ContainerRequestFilter {
|
||||
if (path.startsWith("/")) path = path.substring(1);
|
||||
if (path.startsWith("api/auth/change-password")) return;
|
||||
if (path.startsWith("api/auth/logout")) return;
|
||||
if (path.equals("login")) return;
|
||||
if (path.equals("change-password")) return;
|
||||
if (path.equals("register")) return;
|
||||
|
||||
ctx.abortWith(Response.status(403)
|
||||
.entity(new MustChangeBody())
|
||||
|
||||
@@ -16,7 +16,10 @@ public record AppState(
|
||||
Map<String, Integer> cristales,
|
||||
int soulOre,
|
||||
int spiritOre,
|
||||
Map<String, Map<String, Integer>> venta) {
|
||||
int dwarvenFeePerCraft,
|
||||
Map<String, Map<String, Integer>> venta,
|
||||
Map<String, Map<String, Integer>> precioMercado,
|
||||
Map<String, Integer> ngVenta) {
|
||||
}
|
||||
|
||||
@RegisterForReflection
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.l2.shots.ui;
|
||||
|
||||
import com.l2.shots.auth.AuthMeResponse;
|
||||
import com.l2.shots.auth.AuthService;
|
||||
import com.l2.shots.auth.JwtCookieAuth;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.core.HttpHeaders;
|
||||
import org.eclipse.microprofile.jwt.JsonWebToken;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Helpers compartidos por las pages Qute: extracción de usuario desde la cookie
|
||||
* JWT, defaults de navegación, etc.
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class TemplateData {
|
||||
|
||||
@Inject
|
||||
JwtCookieAuth jwtCookieAuth;
|
||||
|
||||
@Inject
|
||||
AuthService authService;
|
||||
|
||||
/**
|
||||
* Devuelve el usuario actual si la cookie JWT es válida, o empty si no hay
|
||||
* sesión. Si devuelve empty, el caller debe redirigir a /login.
|
||||
*/
|
||||
public Optional<AuthMeResponse> currentUser(HttpHeaders headers) {
|
||||
Optional<JsonWebToken> jwt = jwtCookieAuth.extractToken(headers);
|
||||
if (jwt.isEmpty()) return Optional.empty();
|
||||
return authService.getUserFromToken(jwt.get());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user