CORS
Some checks failed
Deploy / docker (17, 3.8.5) (push) Failing after 1m52s

This commit is contained in:
Braydon 2024-06-20 11:35:35 -04:00
parent 523c4789a3
commit fc1b732dfd
2 changed files with 31 additions and 0 deletions

@ -0,0 +1,27 @@
package me.braydon.profanity.config;
import lombok.NonNull;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author Braydon
*/
@Configuration
public class AppConfig {
@Bean
public WebMvcConfigurer configureCors() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(@NonNull CorsRegistry registry) {
// Allow all origins to access the API
registry.addMapping("/**")
.allowedOrigins("*") // Allow all origins
.allowedMethods("*") // Allow all methods
.allowedHeaders("*"); // Allow all headers
}
};
}
}

@ -13,6 +13,10 @@ import org.springframework.stereotype.Service;
@Service @Service
public final class ModerationService { public final class ModerationService {
public void handleAlerts(@NonNull ContentProcessResponse response) { public void handleAlerts(@NonNull ContentProcessResponse response) {
// Likely safe content, no need to alert anyone
if (response.getScore() < 0.6D) {
return;
}
// TODO: handle alerting of the content to the appropriate parties // TODO: handle alerting of the content to the appropriate parties
} }
} }