mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2026-09-03 05:10:16 +03:00
Port main's connect flow and OCR rotatePages onto the Quarkus branch
This commit is contained in:
+2
@@ -63,6 +63,8 @@ public class AccountLinkController {
|
|||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public record LinkRequest(String supabaseJwt, String name) {}
|
||||||
|
|
||||||
/** {@code callbackUrl} is the portal telling us where its own callback route lives. */
|
/** {@code callbackUrl} is the portal telling us where its own callback route lives. */
|
||||||
public record ConnectStartRequest(String name, String callbackUrl) {}
|
public record ConnectStartRequest(String name, String callbackUrl) {}
|
||||||
|
|
||||||
|
|||||||
+9
-8
@@ -12,20 +12,21 @@ import java.util.Base64;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import io.quarkus.arc.profile.IfBuildProfile;
|
||||||
import org.springframework.context.annotation.Profile;
|
|
||||||
import org.springframework.stereotype.Service;
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
|
|
||||||
/** Browser-mediated account linking, instance side. */
|
/** Browser-mediated account linking, instance side. */
|
||||||
|
// Arc cannot gate a bean on a runtime property, so the account-link flag no longer removes this
|
||||||
|
// bean; only the flag-gated endpoints reach it, so nothing links while the flag is off.
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@ApplicationScoped
|
||||||
@Profile("!saas")
|
@IfBuildProfile("!saas")
|
||||||
@ConditionalOnProperty(name = "stirling.billing.account-link.enabled", havingValue = "true")
|
|
||||||
public class ConnectService {
|
public class ConnectService {
|
||||||
|
|
||||||
/** Frontend route that consumes the callback fragment. */
|
/** Frontend route that consumes the callback fragment. */
|
||||||
@@ -184,7 +185,7 @@ public class ConnectService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional
|
||||||
public ConnectStatus status() {
|
public ConnectStatus status() {
|
||||||
Optional<DeviceCredential> credential = credentialStore.get();
|
Optional<DeviceCredential> credential = credentialStore.get();
|
||||||
if (credential.isPresent()) {
|
if (credential.isPresent()) {
|
||||||
|
|||||||
+17
-2
@@ -1,6 +1,21 @@
|
|||||||
package stirling.software.proprietary.accountlink;
|
package stirling.software.proprietary.accountlink;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
|
||||||
|
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
|
|
||||||
/** Data access for the singleton {@link ConnectState} row. */
|
/** Data access for the singleton {@link ConnectState} row. */
|
||||||
public interface ConnectStateRepository extends JpaRepository<ConnectState, Long> {}
|
@ApplicationScoped
|
||||||
|
public class ConnectStateRepository implements PanacheRepositoryBase<ConnectState, Long> {
|
||||||
|
|
||||||
|
/** Spring Data's {@code save}: the id is assigned, so a detached row has to merge. */
|
||||||
|
@Transactional
|
||||||
|
public ConnectState save(ConnectState state) {
|
||||||
|
if (state.getId() == null || getEntityManager().contains(state)) {
|
||||||
|
persist(state);
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
return getEntityManager().merge(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
-4
@@ -11,10 +11,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
|
|
||||||
import io.quarkus.redis.datasource.RedisDataSource;
|
import io.quarkus.redis.datasource.RedisDataSource;
|
||||||
import io.quarkus.redis.datasource.hash.HashCommands;
|
import io.quarkus.redis.datasource.hash.HashCommands;
|
||||||
import io.quarkus.redis.datasource.keys.KeyCommands;
|
import io.quarkus.redis.datasource.keys.KeyCommands;
|
||||||
|
|||||||
Reference in New Issue
Block a user