Compare commits

..
Author SHA1 Message Date
LudyandGitHub 9a142bd462 Merge branch 'main' into fix_win_desktop_task 2026-07-09 23:16:03 +02:00
LudyandGitHub f2b3871448 Merge branch 'main' into fix_win_desktop_task 2026-07-09 11:05:25 +02:00
LudyandGitHub 7800fb1b60 Merge branch 'main' into fix_win_desktop_task 2026-07-07 11:46:09 +02:00
LudyandGitHub 2815b2b535 Merge branch 'main' into fix_win_desktop_task 2026-07-06 15:36:49 +02:00
LudyandGitHub 999079e6ba Merge branch 'main' into fix_win_desktop_task 2026-07-06 14:02:22 +02:00
LudyandGitHub ff13d7360a Merge branch 'main' into fix_win_desktop_task 2026-07-06 13:52:37 +02:00
Ludy87 e91426e371 Remove configurable JRE path from verification
The bundled JRE verification script previously accepted a custom path via command-line argument, but this parameter was never used. Hardcoding the path simplifies the script, removes the validation checks, and eliminates unnecessary complexity.
2026-07-06 10:00:56 +02:00
Ludy87 ca739e14b0 Harden JRE verification and jlink modules
Tighten JRE/runtime handling and jlink safety.

- frontend/editor/scripts/verify-bundled-jre.mjs: import path.resolve, compute expected release path (src-tauri/runtime/jre/release) and refuse to read any unexpected release file path to avoid accidental/malicious file reads.
- scripts/build-jlink-runtime.ps1: add an allowed jlink module whitelist, sanitize/split the $Modules input, require at least one module, validate requested modules against the whitelist, and pass a safe ModulesArg to --add-modules to prevent injection or unsupported modules.
2026-07-06 09:38:15 +02:00
Ludy87 153dde8291 Add Windows support to desktop JAR copy task
Split the JAR copy command into platform-specific implementations. Unix systems (linux/darwin) use `cp`, while Windows uses PowerShell's Copy-Item with proper directory creation and glob handling. This fixes the desktop build on Windows by replacing the Unix-only `cp` command with a compatible PowerShell equivalent.
2026-07-06 09:28:07 +02:00
Ludy87 ca48361d26 Improve desktop build config and Windows support
Rename CACHE to JLINK_REUSE_CACHE for clarity about JAR reuse. Fix desktop:dev:login task to properly pass SECURITY_ENABLELOGIN as env var. Improve Windows compatibility in verify-bundled-jre.mjs by using cmd.exe as Task launcher. Rename desktop_enable_login_flag() to desktop_login_enabled_from_env() for clarity. Add documentation for desktop dev modes and override options. Add comments explaining compression fallback and file permissions handling.
2026-07-06 09:19:15 +02:00
Ludy87 f7c60e1fb4 Add desktop login support and improve jlink build
- Extract Windows jlink runtime building into dedicated PowerShell script (build-jlink-runtime.ps1) to improve maintainability and permission handling
- Add SECURITY_ENABLELOGIN environment variable support in Tauri backend to conditionally enable desktop login
- Enhance JRE verification script to automatically rebuild runtime if missing or outdated
- Add env section and new dev:login task to desktop.yml
- Add cache control (CACHE variable) to optionally remove build artifacts before rebuilding
- Improve error handling and user feedback in verify-bundled-jre.mjs with helper functions
2026-07-06 09:01:23 +02:00
45 changed files with 531 additions and 298 deletions
+43 -20
View File
@@ -26,6 +26,14 @@ vars:
esac
fi
env:
# Desktop builds default to the smallest useful backend surface unless a task
# explicitly opts into extra features or login.
DISABLE_ADDITIONAL_FEATURES: '{{.DISABLE_ADDITIONAL_FEATURES | default "true"}}'
SECURITY_ENABLELOGIN: '{{.SECURITY_ENABLELOGIN | default "false"}}'
# Reuse the previously built backend JAR unless a clean rebuild is requested.
JLINK_REUSE_CACHE: '{{.JLINK_REUSE_CACHE | default "true"}}'
tasks:
prepare:
desc: "Prepare desktop build dependencies"
@@ -50,6 +58,19 @@ tasks:
cmds:
- npx tauri dev --no-watch
dev:login:
desc: "Start Tauri desktop dev mode with login enabled and cache reuse"
deps:
- task: prepare
vars:
SECURITY_ENABLELOGIN: "true"
ignore_error: true
dir: editor
env:
SECURITY_ENABLELOGIN: "true"
cmds:
- npx tauri dev --no-watch
build:
desc: "Build Tauri desktop app (production)"
deps: [prepare]
@@ -106,7 +127,7 @@ tasks:
jlink:
desc: "Build backend JAR and create JLink runtime for Tauri"
deps: [jlink:jar, jlink:runtime]
deps: [jlink:cacheremove, jlink:jar, jlink:runtime]
# Runs after the runtime is in place. Lives here (not in jlink:runtime's
# cmds) so it still fires when jlink:runtime short-circuits on its `status:`
# check and reuses an existing runtime/jre - that reuse path is exactly how
@@ -115,27 +136,40 @@ tasks:
- task: jlink:verify
jlink:verify:
desc: "Fail the build if the bundled JRE is older than the app JAR requires"
desc: "Verify the bundled JRE exists and matches the app JAR's required Java version"
dir: editor
env:
REQUIRED_JAVA: "{{.REQUIRED_JAVA}}"
cmds:
- node scripts/verify-bundled-jre.mjs src-tauri/runtime/jre/release
- node scripts/verify-bundled-jre.mjs
jlink:cacheremove:
desc: "Remove cached backend JARs before a clean desktop rebuild"
dir: ..
if: '{{eq .JLINK_REUSE_CACHE "false"}}'
cmds:
- cmd: rm -rf app/core/build/libs
- 'echo "rm -rf app/core/build/libs"'
- task: jlink:clean
jlink:jar:
desc: "Build backend JAR for Tauri bundling (host-OS natives only by default)"
run: once
dir: ..
env:
DISABLE_ADDITIONAL_FEATURES: "true"
DISABLE_ADDITIONAL_FEATURES: '{{.DISABLE_ADDITIONAL_FEATURES}}'
SECURITY_ENABLELOGIN: '{{.SECURITY_ENABLELOGIN}}'
cmds:
- echo "Building bootJar with JPDFium natives for {{.JPDFIUM_PLATFORMS}}"
- cmd: cmd /c gradlew.bat bootJar --no-daemon -PjpdfiumPlatforms={{.JPDFIUM_PLATFORMS}}
- 'echo "Building bootJar with JPDFium natives for {{.JPDFIUM_PLATFORMS}}"'
- cmd: 'cmd /c "gradlew.bat bootJar --no-daemon -PjpdfiumPlatforms={{.JPDFIUM_PLATFORMS}}"'
platforms: [windows]
- cmd: ./gradlew bootJar --no-daemon -PjpdfiumPlatforms={{.JPDFIUM_PLATFORMS}}
- cmd: './gradlew bootJar --no-daemon -PjpdfiumPlatforms={{.JPDFIUM_PLATFORMS}}'
platforms: [linux, darwin]
- mkdir -p frontend/editor/src-tauri/libs
- cp app/core/build/libs/stirling-pdf-*.jar frontend/editor/src-tauri/libs/
- cmd: cp app/core/build/libs/stirling-pdf-*.jar frontend/editor/src-tauri/libs/
platforms: [linux, darwin]
- cmd: powershell -NoProfile -ExecutionPolicy Bypass -Command "New-Item -ItemType Directory -Force -Path 'frontend/editor/src-tauri/libs' | Out-Null; Copy-Item -Force (Get-ChildItem 'app/core/build/libs/stirling-pdf-*.jar' | Select-Object -First 1) 'frontend/editor/src-tauri/libs'"
platforms: [windows]
status:
- test -f frontend/editor/src-tauri/libs/stirling-pdf-*.jar
@@ -153,16 +187,7 @@ tasks:
# jdk.crypto.mscapi (the Windows certificate store / SunMSCAPI provider, used by
# hardware-backed cert signing) is a Windows-only module - it only exists in a Windows
# JDK's jmods, so it is added on Windows only or jlink fails to resolve it elsewhere.
- cmd: |
JLINK="${JAVA_HOME:+$JAVA_HOME/bin/}jlink"
JLINK_COMPRESS="$("$JLINK" --help 2>&1 | grep -q 'zip-\[0-9\]' && echo zip-6 || echo 2)"
"$JLINK" \
--add-modules {{.JLINK_MODULES}},jdk.crypto.mscapi \
--strip-debug \
--compress="$JLINK_COMPRESS" \
--no-header-files \
--no-man-pages \
--output runtime/jre
- cmd: powershell -NoProfile -ExecutionPolicy Bypass -File ../../../scripts/build-jlink-runtime.ps1 -Modules "{{.JLINK_MODULES}}"
platforms: [windows]
- cmd: |
JLINK="${JAVA_HOME:+$JAVA_HOME/bin/}jlink"
@@ -194,8 +219,6 @@ tasks:
# `desktop:build` run `jlink:clean` first to force a fresh build.
- cmd: chmod -R u+w runtime/jre
platforms: [linux, darwin]
- cmd: powershell -NoProfile -Command "Get-ChildItem -Recurse runtime/jre | ForEach-Object { $_.IsReadOnly = $false }"
platforms: [windows]
status:
- test -f runtime/jre/release
File diff suppressed because it is too large Load Diff
@@ -6,12 +6,14 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.proprietary.access.model.PrincipalType;
import stirling.software.proprietary.access.model.ResourceGrant;
import stirling.software.proprietary.access.model.ResourceType;
import stirling.software.proprietary.security.model.User;
@Repository
public interface ResourceGrantRepository extends JpaRepository<ResourceGrant, Long> {
List<ResourceGrant> findByResourceTypeAndResourceId(
@@ -3,7 +3,9 @@ package stirling.software.proprietary.accountlink;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface DeviceCredentialRepository extends JpaRepository<DeviceCredential, Long> {
/** The singleton credential, if this instance has linked. */
@@ -1,5 +1,7 @@
package stirling.software.proprietary.classification.store;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface TeamLabelsRepository extends JpaRepository<TeamLabelsEntity, Long> {}
@@ -3,12 +3,14 @@ package stirling.software.proprietary.integration.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import stirling.software.proprietary.access.model.OwnerScope;
import stirling.software.proprietary.integration.model.IntegrationConfig;
import stirling.software.proprietary.model.Team;
import stirling.software.proprietary.security.model.User;
@Repository
public interface IntegrationConfigRepository extends JpaRepository<IntegrationConfig, Long> {
List<IntegrationConfig> findByOwnerUser(User ownerUser);
@@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -14,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
* clause the state it was decided against, so a racing claim loses cleanly with 0 rows updated.
* Transactional per call so the ledger can run them without an enclosing transaction.
*/
@Repository
public interface ProcessedFileRepository
extends JpaRepository<ProcessedFileEntity, ProcessedFileId> {
@@ -7,8 +7,10 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
public interface SourceDocCountRepository
extends JpaRepository<SourceDocCountEntity, SourceDocCountId> {
@@ -7,8 +7,10 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
public interface SourceDocTotalRepository extends JpaRepository<SourceDocTotalEntity, String> {
/**
@@ -5,7 +5,9 @@ import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
@Repository
public interface SourceRepository extends JpaRepository<SourceEntity, String> {
/**
@@ -6,9 +6,11 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import jakarta.persistence.LockModeType;
@Repository
public interface PolicyRepository extends JpaRepository<PolicyEntity, String> {
/** Enabled policies of a given trigger type, for background triggers to activate. */
@@ -10,10 +10,12 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import stirling.software.proprietary.model.security.PersistentAuditEvent;
@Repository
public interface PersistentAuditEventRepository extends JpaRepository<PersistentAuditEvent, Long> {
// Basic queries
@@ -3,9 +3,11 @@ package stirling.software.proprietary.security.database.repository;
import java.util.Set;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import stirling.software.proprietary.security.model.Authority;
@Repository
public interface AuthorityRepository extends JpaRepository<Authority, Long> {
// Set<Authority> findByUsername(String username);
Set<Authority> findByUser_Username(String username);
@@ -1,9 +1,11 @@
package stirling.software.proprietary.security.database.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import stirling.software.proprietary.security.model.PersistentLogin;
@Repository
public interface PersistentLoginRepository extends JpaRepository<PersistentLogin, String> {
void deleteByUsername(String username);
}
@@ -7,11 +7,13 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import jakarta.transaction.Transactional;
import stirling.software.proprietary.security.model.SessionEntity;
@Repository
public interface SessionRepository extends JpaRepository<SessionEntity, String> {
List<SessionEntity> findByPrincipalName(String principalName);
@@ -10,10 +10,12 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.proprietary.model.Team;
import stirling.software.proprietary.security.model.User;
@Repository
public interface UserRepository extends JpaRepository<User, Long> {
Optional<User> findByUsernameIgnoreCase(String username);
@@ -8,9 +8,11 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.proprietary.security.model.InviteToken;
@Repository
public interface InviteTokenRepository extends JpaRepository<InviteToken, Long> {
Optional<InviteToken> findByToken(String token);
@@ -7,11 +7,13 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.common.model.enumeration.TeamRole;
import stirling.software.proprietary.model.TeamMembership;
import stirling.software.proprietary.security.model.User;
@Repository
public interface TeamMembershipRepository extends JpaRepository<TeamMembership, Long> {
/**
@@ -5,10 +5,12 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import stirling.software.proprietary.model.Team;
import stirling.software.proprietary.model.dto.TeamWithUserCountDTO;
@Repository
public interface TeamRepository extends JpaRepository<Team, Long> {
Optional<Team> findByName(String name);
@@ -3,9 +3,11 @@ package stirling.software.proprietary.security.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import stirling.software.proprietary.model.UserLicenseSettings;
@Repository
public interface UserLicenseSettingsRepository extends JpaRepository<UserLicenseSettings, Long> {
/**
@@ -5,9 +5,11 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.proprietary.workflow.model.UserServerCertificateEntity;
@Repository
public interface UserServerCertificateRepository
extends JpaRepository<UserServerCertificateEntity, Long> {
@@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import stirling.software.proprietary.security.model.User;
@@ -14,6 +15,7 @@ import stirling.software.proprietary.workflow.model.ParticipantStatus;
import stirling.software.proprietary.workflow.model.WorkflowParticipant;
import stirling.software.proprietary.workflow.model.WorkflowSession;
@Repository
public interface WorkflowParticipantRepository extends JpaRepository<WorkflowParticipant, Long> {
/** Find participant by share token */
@@ -6,12 +6,14 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.proprietary.security.model.User;
import stirling.software.proprietary.workflow.model.WorkflowSession;
import stirling.software.proprietary.workflow.model.WorkflowStatus;
import stirling.software.proprietary.workflow.model.WorkflowType;
@Repository
public interface WorkflowSessionRepository extends JpaRepository<WorkflowSession, Long> {
/** Find workflow session by unique session ID */
@@ -7,10 +7,12 @@ import java.util.UUID;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.saas.billing.model.BillingSubscription;
/** Read/write access to the Stripe subscription mirror table. */
@Repository
public interface BillingSubscriptionRepository extends JpaRepository<BillingSubscription, String> {
List<BillingSubscription> findByUserId(UUID userId);
@@ -7,7 +7,7 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
/**
* Registers the {@code :saas} module's entities and repositories with Spring Data JPA. Any new
* package holding repository interfaces or {@code @Entity} classes must be added here, or the beans
* package holding {@code @Repository} or {@code @Entity} classes must be added here, or the beans
* won't wire at startup.
*/
@Configuration
@@ -9,12 +9,14 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.saas.payg.job.JobArtifactHash;
import stirling.software.saas.payg.job.JobArtifactHash.JobArtifactHashId;
import stirling.software.saas.payg.lineage.LineageMatch;
import stirling.software.saas.payg.model.JobStatus;
@Repository
public interface JobArtifactHashRepository
extends JpaRepository<JobArtifactHash, JobArtifactHashId> {
@@ -9,10 +9,12 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import stirling.software.saas.payg.meter.PaygMeterEventLog;
@Repository
public interface PaygMeterEventLogRepository extends JpaRepository<PaygMeterEventLog, Long> {
/**
@@ -8,9 +8,11 @@ import java.util.UUID;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.saas.payg.shadow.PaygShadowCharge;
@Repository
public interface PaygShadowChargeRepository extends JpaRepository<PaygShadowCharge, Long> {
@Query(
@@ -7,11 +7,13 @@ import org.springframework.data.jpa.repository.Lock;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import jakarta.persistence.LockModeType;
import stirling.software.saas.payg.policy.PaygTeamExtensions;
@Repository
public interface PaygTeamExtensionsRepository extends JpaRepository<PaygTeamExtensions, Long> {
Optional<PaygTeamExtensions> findByStripeCustomerId(String stripeCustomerId);
@@ -5,9 +5,11 @@ import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import stirling.software.saas.payg.policy.PricingPolicy;
@Repository
public interface PricingPolicyRepository extends JpaRepository<PricingPolicy, Long> {
Optional<PricingPolicy> findByVersion(String version);
@@ -7,10 +7,12 @@ import java.util.UUID;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.saas.payg.job.ProcessingJob;
import stirling.software.saas.payg.model.JobStatus;
@Repository
public interface ProcessingJobRepository extends JpaRepository<ProcessingJob, UUID> {
List<ProcessingJob> findByOwnerUserIdAndStatus(Long ownerUserId, JobStatus status);
@@ -4,9 +4,11 @@ import java.util.List;
import java.util.UUID;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import stirling.software.saas.payg.job.ProcessingJobStep;
@Repository
public interface ProcessingJobStepRepository extends JpaRepository<ProcessingJobStep, Long> {
List<ProcessingJobStep> findByJobIdOrderByStartedAtAsc(UUID jobId);
@@ -3,10 +3,12 @@ package stirling.software.saas.payg.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import stirling.software.saas.payg.entitlement.WalletEntitlementSnapshot;
import stirling.software.saas.payg.entitlement.WalletEntitlementSnapshot.WalletEntitlementSnapshotId;
@Repository
public interface WalletEntitlementSnapshotRepository
extends JpaRepository<WalletEntitlementSnapshot, WalletEntitlementSnapshotId> {
@@ -6,10 +6,12 @@ import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.saas.payg.model.LedgerEntryType;
import stirling.software.saas.payg.wallet.WalletLedgerEntry;
@Repository
public interface WalletLedgerRepository extends JpaRepository<WalletLedgerEntry, Long> {
/** Most recent entries for the Plan page activity feed. */
@@ -3,9 +3,11 @@ package stirling.software.saas.payg.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import stirling.software.saas.payg.wallet.WalletPolicy;
@Repository
public interface WalletPolicyRepository extends JpaRepository<WalletPolicy, Long> {
Optional<WalletPolicy> findByTeamId(Long teamId);
@@ -6,9 +6,11 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.saas.model.SaasTeamExtensions;
@Repository
public interface SaasTeamExtensionsRepository extends JpaRepository<SaasTeamExtensions, Long> {
Optional<SaasTeamExtensions> findByTeamId(Long teamId);
@@ -6,9 +6,11 @@ import java.util.UUID;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.saas.model.SaasUserExtensions;
@Repository
public interface SaasUserExtensionsRepository extends JpaRepository<SaasUserExtensions, Long> {
Optional<SaasUserExtensions> findByUserId(Long userId);
@@ -9,9 +9,11 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.saas.model.SupabaseUser;
@Repository
public interface SupabaseUserRepository extends JpaRepository<SupabaseUser, UUID> {
/**
@@ -8,10 +8,12 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import stirling.software.common.model.enumeration.InvitationStatus;
import stirling.software.saas.model.TeamInvitation;
@Repository
public interface TeamInvitationRepository extends JpaRepository<TeamInvitation, Long> {
/**
@@ -43,7 +43,7 @@ class SaasJpaConfigScanTest {
Set<String> actual = Set.copyOf(Arrays.asList(annotation.basePackages()));
assertThat(actual)
.as("Every package holding repository interfaces must be listed")
.as("Every package holding @Repository interfaces must be listed")
.containsAll(EXPECTED_REPO_PACKAGES);
}
+4 -20
View File
@@ -2,11 +2,11 @@ plugins {
id "java"
id "jacoco"
id "io.spring.dependency-management" version "1.1.7"
id "org.springframework.boot" version "4.1.0"
id "org.springframework.boot" version "4.0.6"
id "org.springdoc.openapi-gradle-plugin" version "1.9.0"
id "io.swagger.swaggerhub" version "1.3.2"
id "com.diffplug.spotless" version "8.5.0"
id "com.github.jk1.dependency-license-report" version "3.1.4"
id "com.github.jk1.dependency-license-report" version "3.1.2"
//id "nebula.lint" version "19.0.3"
id "org.sonarqube" version "7.2.3.7755"
}
@@ -20,12 +20,12 @@ import org.gradle.api.tasks.testing.Test
import org.gradle.jvm.toolchain.JavaLanguageVersion
ext {
springBootVersion = "4.1.0"
springBootVersion = "4.0.6"
pdfboxVersion = "3.0.7"
imageioVersion = "3.13.1"
lombokVersion = "1.18.46"
bouncycastleVersion = "1.84"
springSecuritySamlVersion = "7.1.0"
springSecuritySamlVersion = "7.0.5"
openSamlVersion = "5.2.1"
commonmarkVersion = "0.28.0"
googleJavaFormatVersion = "1.28.0"
@@ -62,19 +62,6 @@ ext.isSecurityDisabled = { ->
System.getProperty('DISABLE_ADDITIONAL_FEATURES') == 'true')
}
ext.getEnv = { ->
def sel = System.getenv('SECURITY_ENABLELOGIN')
logger.lifecycle("SECURITY_ENABLELOGIN: ${sel}")
def des = System.getenv('DOCKER_ENABLE_SECURITY')
logger.lifecycle("DOCKER_ENABLE_SECURITY: ${des}")
def flavorValue = System.getenv('STIRLING_FLAVOR')
logger.lifecycle("STIRLING_FLAVOR: ${flavorValue}")
def saas = System.getenv('ENABLE_SAAS')
logger.lifecycle("ENABLE_SAAS: ${saas}")
def daf = System.getenv('DISABLE_ADDITIONAL_FEATURES')
logger.lifecycle("DISABLE_ADDITIONAL_FEATURES: ${daf}")
}
ext.mavenUrl = System.getenv("MAVEN_PUBLIC_URL") ?: ""
ext.username = System.getenv('MAVEN_USER') ?: ""
ext.password = System.getenv('MAVEN_PASSWORD') ?: ""
@@ -239,8 +226,6 @@ subprojects {
resolutionStrategy.force "org.bouncycastle:bcprov-jdk18on:${bouncycastleVersion}"
resolutionStrategy.force "org.bouncycastle:bcpkix-jdk18on:${bouncycastleVersion}"
resolutionStrategy.force "org.bouncycastle:bcutil-jdk18on:${bouncycastleVersion}"
resolutionStrategy.force "org.apache.santuario:xmlsec:4.0.4"
resolutionStrategy.force "com.google.guava:guava:${guavaVersion}"
}
dependencyManagement {
@@ -623,7 +608,6 @@ dependencies {
if (rootProject.ext.isSecurityDisabled()) {
implementation project(':proprietary')
}
rootProject.ext.getEnv()
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
+24
View File
@@ -50,6 +50,26 @@ task desktop:dev
This ensures the JLink runtime and backend JAR exist (skipping if already built), then starts Tauri in dev mode.
For local login testing, use the login-enabled variant:
```bash
task desktop:dev:login
```
That task reuses the same desktop launcher, but it keeps the backend cache and enables the login flow through the desktop taskfile defaults.
You can override the desktop task defaults inline:
- `JLINK_REUSE_CACHE=false` - force a clean backend JAR/JRE rebuild before launch
- `DISABLE_ADDITIONAL_FEATURES=false` - keep the full backend feature set for the bundled desktop run
- `SECURITY_ENABLELOGIN=true` - enable the normal login flow in desktop mode
Example:
```bash
task desktop:dev:login JLINK_REUSE_CACHE=false DISABLE_ADDITIONAL_FEATURES=false SECURITY_ENABLELOGIN=true
```
### Build
```bash
@@ -78,6 +98,10 @@ task desktop:jlink:runtime # Create JLink custom JRE only
task desktop:jlink:clean # Remove JLink artifacts
```
`task desktop:jlink` verifies the bundled runtime after it is built. If the
runtime release file is missing or too old, the verification script will
rebuild `desktop:jlink:runtime` automatically and re-check the version.
### Clean
```bash
+70 -7
View File
@@ -9,24 +9,87 @@
//
// Required major comes from REQUIRED_JAVA (wired from .taskfiles/desktop.yml,
// which mirrors build.gradle `modernJavaVersion`). Keep them in sync.
import { spawnSync } from "node:child_process";
import { resolve } from "node:path";
import { readFileSync } from "node:fs";
const required = Number(process.env.REQUIRED_JAVA ?? "25");
const releasePath = process.argv[2] ?? "runtime/jre/release";
const releasePath = resolve(process.cwd(), "src-tauri/runtime/jre/release");
function rebuildRuntime(reason) {
console.warn(
`${reason} Rebuilding runtime with 'task desktop:jlink:runtime'.`,
);
const isWindows = process.platform === "win32";
// Node does not reliably spawn the Task .cmd shim directly on Windows in
// this repo environment, so use cmd.exe as the stable trampoline.
const command = isWindows ? "cmd.exe" : "task";
const args = isWindows
? ["/d", "/s", "/c", "task desktop:jlink:runtime"]
: ["desktop:jlink:runtime"];
const result = spawnSync(command, args, {
stdio: "inherit",
});
if (result.error) {
console.error(
`FATAL: failed to launch 'task desktop:jlink:runtime': ${result.error.message}`,
);
process.exit(1);
}
if (result.status !== 0) {
console.error(
`FATAL: 'task desktop:jlink:runtime' exited with status ${result.status}.`,
);
process.exit(result.status ?? 1);
}
}
function readReleaseFile() {
return readFileSync(releasePath, "utf8");
}
function readReleaseOrFail() {
try {
return readReleaseFile();
} catch (err) {
console.error(
`FATAL: cannot read bundled JRE release file at "${releasePath}" after rebuilding: ${err.message}.`,
);
process.exit(1);
}
}
function parseMajor(raw) {
// jlink writes release metadata as plain text, so we can validate the
// embedded runtime without starting Java.
const match = raw.match(/JAVA_VERSION="?(\d+)/);
return match ? Number(match[1]) : 0;
}
let raw;
try {
raw = readFileSync(releasePath, "utf8");
raw = readReleaseFile();
} catch (err) {
console.error(
`FATAL: cannot read bundled JRE release file at "${releasePath}": ${err.message}. ` +
`Is the runtime built? Run 'task desktop:jlink'.`,
`WARN: cannot read bundled JRE release file at "${releasePath}": ${err.message}.`,
);
process.exit(1);
rebuildRuntime("Bundled runtime is missing.");
raw = readReleaseOrFail();
}
const match = raw.match(/JAVA_VERSION="?(\d+)/);
const major = match ? Number(match[1]) : 0;
let major = parseMajor(raw);
if (!major || major < required) {
// Rebuild stale or too-old runtimes automatically so desktop launches can
// recover from a cached JRE instead of failing at app start.
rebuildRuntime(
`Bundled runtime/jre is Java ${major || "unknown"} but the app JAR requires Java ${required}.`,
);
raw = readReleaseOrFail();
major = parseMajor(raw);
}
console.log(
`Bundled JRE major: ${major || "unknown"} (required >= ${required})`,
@@ -54,6 +54,18 @@ fn check_backend_status() -> Result<(), String> {
Ok(())
}
/// Allow desktop launches to opt into the normal login flow when either the
/// new desktop-specific flag or the existing SECURITY_ENABLELOGIN flag is set.
fn desktop_login_enabled_from_env() -> bool {
matches!(
std::env::var("STIRLING_PDF_DESKTOP_ENABLE_LOGIN")
.or_else(|_| std::env::var("SECURITY_ENABLELOGIN"))
.ok()
.as_deref(),
Some("true" | "TRUE" | "True" | "1" | "yes" | "YES" | "on" | "ON")
)
}
// Find the bundled JRE and return the java executable path
fn find_bundled_jre(resource_dir: &PathBuf) -> Result<PathBuf, String> {
let jre_dir = resource_dir.join("runtime").join("jre");
@@ -213,7 +225,11 @@ fn run_stirling_pdf_jar(app: &tauri::AppHandle, java_path: &PathBuf, jar_path: &
// No reverse proxy in front of the local sidecar, so don't trust forwarded headers.
// Stops a LAN caller spoofing X-Forwarded-For to defeat the desktop-only signing gate.
"-Dserver.forward-headers-strategy=none",
"-Dsecurity.enableLogin=false", // Disable login for desktop mode
if desktop_login_enabled_from_env() {
"-Dsecurity.enableLogin=true"
} else {
"-Dsecurity.enableLogin=false"
},
"-Dsecurity.csrfDisabled=true", // Disable CSRF for desktop mode
];
+70
View File
@@ -0,0 +1,70 @@
param(
[Parameter(Mandatory = $true)]
[string]$Modules
)
$ErrorActionPreference = "Stop"
$AllowedModules = @(
"java.base",
"java.compiler",
"java.desktop",
"java.instrument",
"java.logging",
"java.management",
"java.naming",
"java.net.http",
"java.prefs",
"java.rmi",
"java.scripting",
"java.security.jgss",
"java.security.sasl",
"java.sql",
"java.transaction.xa",
"java.xml",
"java.xml.crypto",
"jdk.crypto.ec",
"jdk.crypto.cryptoki",
"jdk.unsupported",
"jdk.dynalink"
)
$RequestedModules = @($Modules -split "," | ForEach-Object { $_.Trim() } | Where-Object { $_ })
if ($RequestedModules.Count -eq 0) {
throw "At least one jlink module is required."
}
$InvalidModules = $RequestedModules | Where-Object {
($_ -notmatch '^[A-Za-z0-9_.]+$') -or ($_ -notin $AllowedModules)
}
if ($InvalidModules) {
throw "Unsupported jlink module(s): $($InvalidModules -join ', ')"
}
$ModulesArg = $RequestedModules -join ","
$Jlink = if ($env:JAVA_HOME) {
Join-Path $env:JAVA_HOME "bin/jlink.exe"
} else {
"jlink.exe"
}
$HelpText = & $Jlink --help 2>&1 | Out-String
# Older JDKs do not support the newer zip compressor selector, so fall back to
# the numeric compression level they do understand.
$Compress = if ($HelpText -match "zip-\[0-9\]") { "zip-6" } else { "2" }
& $Jlink `
--add-modules "$ModulesArg,jdk.crypto.mscapi" `
--strip-debug `
--compress="$Compress" `
--no-header-files `
--no-man-pages `
--output runtime/jre
# Tauri's resource staging preserves source permissions, so the bundled runtime
# must be writable here or the next incremental build can fail on read-only JRE
# files copied into the target directory.
Get-ChildItem -Recurse runtime/jre -Force -File | ForEach-Object {
$_.Attributes = $_.Attributes -band (-bnot [System.IO.FileAttributes]::ReadOnly)
}