Improve layout, styling, file type badges, accessibility, and add cross-panel transfer actions from the context menu.
34 lines
1.3 KiB
Java
34 lines
1.3 KiB
Java
package com.sftp.manager.config;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
@Configuration
|
|
public class WebConfig implements WebMvcConfigurer {
|
|
|
|
@Override
|
|
public void addCorsMappings(CorsRegistry registry) {
|
|
registry.addMapping("/**")
|
|
.allowedOrigins("*")
|
|
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
|
.allowedHeaders("*")
|
|
.maxAge(3600);
|
|
}
|
|
|
|
@Override
|
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
// Spring Boot 默认已经处理了 static 目录,这里可以移除或保留作为额外配置
|
|
// registry.addResourceHandler("/**")
|
|
// .addResourceLocations("classpath:/static/");
|
|
}
|
|
|
|
@Override
|
|
public void addViewControllers(ViewControllerRegistry registry) {
|
|
// 访问根路径时转发到静态首页 /static/index.html
|
|
registry.addViewController("/").setViewName("forward:/index.html");
|
|
}
|
|
}
|