use bool for checking tauri mode in webmvc

This commit is contained in:
Connor Yoh 2025-07-22 18:18:41 +01:00
parent 1aa5430b67
commit bc09bdedf9

View File

@ -1,6 +1,5 @@
package stirling.software.SPDF.config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
@ -32,11 +31,15 @@ public class WebMvcConfig implements WebMvcConfigurer {
}
@Override
@ConditionalOnProperty(name = "STIRLING_PDF_TAURI_MODE", havingValue = "true")
public void addCorsMappings(CorsRegistry registry) {
if (Boolean.parseBoolean(System.getProperty("STIRLING_PDF_TAURI_MODE", "false"))) {
// Tauri mode CORS configuration
registry.addMapping("/**")
.allowedOrigins("http://localhost:5173", "http://tauri.localhost", "tauri://localhost")
.allowedOrigins(
"http://localhost:5173", "http://tauri.localhost", "tauri://localhost")
.allowedMethods("*")
.allowedHeaders("*");
return;
}
}
}