mirror of https://github.com/halo-dev/halo
🎨 跨域配置
parent
9634af938f
commit
3709d0fdb5
|
@ -98,7 +98,7 @@ public class MvcConfig implements WebMvcConfigurer {
|
|||
*/
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
registry.addMapping("/api/**")
|
||||
.allowCredentials(true)
|
||||
.allowedHeaders("*")
|
||||
.allowedOrigins("*")
|
||||
|
|
|
@ -5,6 +5,7 @@ import cc.ryanc.halo.model.dto.JsonResult;
|
|||
import cc.ryanc.halo.model.enums.ResponseStatusEnum;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -19,6 +20,7 @@ import java.util.List;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/6/6
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/archives")
|
||||
public class ApiArchivesController {
|
||||
|
|
|
@ -5,10 +5,7 @@ import cc.ryanc.halo.model.dto.JsonResult;
|
|||
import cc.ryanc.halo.model.enums.ResponseStatusEnum;
|
||||
import cc.ryanc.halo.service.CategoryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -20,6 +17,7 @@ import java.util.List;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/6/6
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/categories")
|
||||
public class ApiCategoryController {
|
||||
|
|
|
@ -2,6 +2,7 @@ package cc.ryanc.halo.web.controller.api;
|
|||
|
||||
import cc.ryanc.halo.service.CommentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/6/6
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/comments")
|
||||
public class ApiCommentController {
|
||||
|
|
|
@ -5,10 +5,7 @@ import cc.ryanc.halo.model.dto.JsonResult;
|
|||
import cc.ryanc.halo.model.enums.ResponseStatusEnum;
|
||||
import cc.ryanc.halo.service.GalleryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -21,6 +18,7 @@ import java.util.Optional;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/6/6
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/galleries")
|
||||
public class ApiGalleryController {
|
||||
|
|
|
@ -5,6 +5,7 @@ import cc.ryanc.halo.model.dto.JsonResult;
|
|||
import cc.ryanc.halo.model.enums.ResponseStatusEnum;
|
||||
import cc.ryanc.halo.service.LinkService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -19,6 +20,7 @@ import java.util.List;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/6/6
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/links")
|
||||
public class ApiLinkController {
|
||||
|
|
|
@ -5,6 +5,7 @@ import cc.ryanc.halo.model.dto.JsonResult;
|
|||
import cc.ryanc.halo.model.enums.ResponseStatusEnum;
|
||||
import cc.ryanc.halo.service.MenuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -19,6 +20,7 @@ import java.util.List;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/6/6
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/menus")
|
||||
public class ApiMenuController {
|
||||
|
|
|
@ -5,10 +5,7 @@ import cc.ryanc.halo.model.enums.BlogPropertiesEnum;
|
|||
import cc.ryanc.halo.model.enums.ResponseStatusEnum;
|
||||
import cc.ryanc.halo.service.OptionsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -20,6 +17,7 @@ import java.util.Map;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/7/19
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/options")
|
||||
public class ApiOptionController {
|
||||
|
|
|
@ -6,10 +6,7 @@ import cc.ryanc.halo.model.enums.PostTypeEnum;
|
|||
import cc.ryanc.halo.model.enums.ResponseStatusEnum;
|
||||
import cc.ryanc.halo.service.PostService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
|
@ -19,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/6/6
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/pages")
|
||||
public class ApiPageController {
|
||||
|
|
|
@ -14,10 +14,7 @@ import org.springframework.data.domain.Page;
|
|||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -29,6 +26,7 @@ import java.util.List;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/6/6
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/posts")
|
||||
public class ApiPostController {
|
||||
|
|
|
@ -5,10 +5,7 @@ import cc.ryanc.halo.model.dto.JsonResult;
|
|||
import cc.ryanc.halo.model.enums.ResponseStatusEnum;
|
||||
import cc.ryanc.halo.service.TagService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -20,6 +17,7 @@ import java.util.List;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/6/6
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/tags")
|
||||
public class ApiTagController {
|
||||
|
|
|
@ -5,6 +5,7 @@ import cc.ryanc.halo.model.dto.JsonResult;
|
|||
import cc.ryanc.halo.model.enums.ResponseStatusEnum;
|
||||
import cc.ryanc.halo.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
* @author : RYAN0UP
|
||||
* @date : 2018/6/6
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/user")
|
||||
public class ApiUserController {
|
||||
|
|
Loading…
Reference in New Issue