package io.loli.box;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
@ConditionalOnProperty(name = "storage.type", havingValue = "filesystem")
public class MvcConfig extends WebMvcConfigurerAdapter {

    @Value(value = "${storage.filesystem.imgFolder}")
    private String imgFolder;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/images/**").addResourceLocations(
                "file:///" + imgFolder.replace("\\","/"));
    }
}

@@ -214,16 +214,62 @@
 ration;%0A
+import org.springframework.http.CacheControl;%0A
 import o
@@ -342,16 +342,16 @@
 gistry;%0A
-
 import o
@@ -425,16 +425,55 @@
 apter;%0A%0A
+import java.util.concurrent.TimeUnit;%0A%0A
 @Configu
@@ -782,16 +782,36 @@
 stry) %7B%0A
+        // %E5%9B%BE%E7%89%87%E7%BC%93%E5%AD%98 7 %E5%A4%A9%0A
         
@@ -851,16 +851,33 @@
 ges/**%22)
+%0A                
 .addReso
@@ -947,13 +947,86 @@
 %5C%5C%22,
+ 
 %22/%22))
+%0A                .setCacheControl(CacheControl.maxAge(7, TimeUnit.DAYS))
 ;%0A  

Add image cache