fix: cors (again), isRt flag and build in POM

This commit is contained in:
2026-03-17 03:12:09 +01:00
parent e9682f095b
commit 994b682389
5 changed files with 23 additions and 24 deletions

View File

@@ -83,7 +83,7 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<version>3.2.2</version> <version>${spring.boot.version}</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>
@@ -91,10 +91,6 @@
</goals> </goals>
</execution> </execution>
</executions> </executions>
<configuration>
<mainClass>net.miarma.backend.mpaste.MpasteApplication</mainClass>
<layout>JAR</layout>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@@ -3,6 +3,7 @@ package net.miarma.backend.mpaste.config;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.SecurityFilterChain;
@Configuration @Configuration
@@ -10,8 +11,10 @@ public class NoSecurityConfig {
@Bean @Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http http
.csrf(csrf -> csrf.disable()) .cors(AbstractHttpConfigurer::disable)
.csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(auth -> auth.anyRequest().permitAll()); .authorizeHttpRequests(auth -> auth.anyRequest().permitAll());
return http.build(); return http.build();
} }
} }

View File

@@ -18,7 +18,7 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override @Override
public void registerStompEndpoints(StompEndpointRegistry registry) { public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws") registry.addEndpoint("/ws")
.setAllowedOriginPatterns("*") .setAllowedOrigins("https://paste.miarma.net", "http://localhost:3000")
.withSockJS(); .withSockJS();
} }
} }

View File

@@ -51,7 +51,7 @@ public class PasteDto {
this.syntax = syntax; this.syntax = syntax;
} }
public Boolean isBurnAfter() { public Boolean getIsBurnAfter() {
return burnAfter; return burnAfter;
} }
@@ -59,7 +59,7 @@ public class PasteDto {
this.burnAfter = burnAfter; this.burnAfter = burnAfter;
} }
public Boolean isPrivate() { public Boolean getIsPrivate() {
return isPrivate; return isPrivate;
} }
@@ -67,11 +67,11 @@ public class PasteDto {
this.isPrivate = isPrivate; this.isPrivate = isPrivate;
} }
public Boolean isRt() { public Boolean getIsRt() {
return isRt; return isRt;
} }
public void setRt(Boolean rt) { public void setIsRt(Boolean rt) {
isRt = rt; isRt = rt;
} }
@@ -149,27 +149,27 @@ public class PasteDto {
this.views = views; this.views = views;
} }
public Boolean isBurnAfter() { public Boolean getIsBurnAfter() {
return burnAfter; return burnAfter;
} }
public void setBurnAfter(Boolean burnAfter) { public void setIsBurnAfter(Boolean burnAfter) {
this.burnAfter = burnAfter; this.burnAfter = burnAfter;
} }
public Boolean isPrivate() { public Boolean getIsPrivate() {
return isPrivate; return isPrivate;
} }
public void setPrivate(Boolean isPrivate) { public void setIsPrivate(Boolean isPrivate) {
this.isPrivate = isPrivate; this.isPrivate = isPrivate;
} }
public Boolean isRt() { public Boolean getIsRt() {
return isRt; return isRt;
} }
public void setRt(Boolean rt) { public void setIsRt(Boolean rt) {
isRt = rt; isRt = rt;
} }

View File

@@ -18,9 +18,9 @@ public final class PasteMapper {
paste.setSyntax(request.getSyntax()); paste.setSyntax(request.getSyntax());
paste.setPasteKey(request.getPasteKey()); paste.setPasteKey(request.getPasteKey());
paste.setBurnAfter(Boolean.TRUE.equals(request.isBurnAfter())); paste.setBurnAfter(Boolean.TRUE.equals(request.getIsBurnAfter()));
paste.setPrivate(Boolean.TRUE.equals(request.isPrivate())); paste.setPrivate(Boolean.TRUE.equals(request.getIsPrivate()));
paste.setRt(Boolean.TRUE.equals(request.isRt())); paste.setRt(Boolean.TRUE.equals(request.getIsRt()));
paste.setPassword(request.getPassword()); paste.setPassword(request.getPassword());
@@ -43,9 +43,9 @@ public final class PasteMapper {
response.setViews(paste.getViews()); response.setViews(paste.getViews());
response.setBurnAfter(paste.isBurnAfter()); response.setIsBurnAfter(paste.isBurnAfter());
response.setPrivate(paste.isPrivate()); response.setIsPrivate(paste.isPrivate());
response.setRt(paste.isRt()); response.setIsRt(paste.isRt());
response.setCreatedAt(paste.getCreatedAt()); response.setCreatedAt(paste.getCreatedAt());