move controllers, combine with old controllers, make assets live under /assets

This commit is contained in:
MiniDigger 2020-07-14 00:09:41 +02:00
parent 578e60fd10
commit 93e24c9e08
14 changed files with 28 additions and 65 deletions

View File

@ -60,7 +60,7 @@ public class MvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// TODO we kinda want this to be /assets, via the hangar.url macro maybe?
registry.addResourceHandler("/**")
registry.addResourceHandler("/assets/**")
.addResourceLocations("classpath:/public/")
.setCacheControl(CacheControl.maxAge(1, TimeUnit.DAYS))
.resourceChain(true)

View File

@ -1,4 +1,4 @@
package me.minidigger.hangar.controller.dummy;
package me.minidigger.hangar.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;

View File

@ -1,9 +1,10 @@
package me.minidigger.hangar.controller.dummy;
package me.minidigger.hangar.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import me.minidigger.hangar.controller.HangarController;
@ -12,8 +13,8 @@ import me.minidigger.hangar.controller.HangarController;
public class ApplicationController extends HangarController {
@RequestMapping("/")
public Object showHome() {
return null; // TODO implement showHome request controller
public ModelAndView showHome() {
return fillModel( new ModelAndView("home"));
}
@RequestMapping("/admin/activities/{user}")
@ -72,8 +73,9 @@ public class ApplicationController extends HangarController {
}
@RequestMapping("/favicon.ico")
@ResponseBody
public Object faviconRedirect() {
return null; // TODO implement faviconRedirect request controller
return "no u"; // TODO implement faviconRedirect request controller
}
@RequestMapping("/global-sitemap.xml")
@ -82,13 +84,16 @@ public class ApplicationController extends HangarController {
}
@RequestMapping("/javascriptRoutes")
@ResponseBody
public Object javaScriptRoutes() {
return null; // TODO implement javaScriptRoutes request controller
return "no u"; // TODO implement javaScriptRoutes request controller
}
@RequestMapping("/linkout")
public Object linkOut(@RequestParam Object remoteUrl) {
return null; // TODO implement linkOut request controller
public ModelAndView linkOut(@RequestParam(defaultValue = "") String remoteUrl) {
ModelAndView view = new ModelAndView("linkout");
view.addObject("remoteUrl", remoteUrl);
return fillModel(view);
}
@RequestMapping("/pantopticon/actor-count")
@ -115,6 +120,5 @@ public class ApplicationController extends HangarController {
public Object removeTrail(@PathVariable Object path) {
return null; // TODO implement removeTrail request controller
}
}

View File

@ -1,4 +1,4 @@
package me.minidigger.hangar.controller.dummy;
package me.minidigger.hangar.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

View File

@ -1,14 +0,0 @@
package me.minidigger.hangar.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class HomeController extends HangarController{
@GetMapping("/")
public ModelAndView home() {
return fillModel( new ModelAndView("home"));
}
}

View File

@ -1,17 +0,0 @@
package me.minidigger.hangar.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class LinkoutController extends HangarController {
@GetMapping(path = "/linkout", params = "remoteUrl")
public ModelAndView linkout(@RequestParam(value = "remoteUrl", defaultValue = "") String remoteUrl) {
ModelAndView view = new ModelAndView("linkout");
view.addObject("remoteUrl", remoteUrl);
return fillModel(view);
}
}

View File

@ -1,4 +1,4 @@
package me.minidigger.hangar.controller.dummy;
package me.minidigger.hangar.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

View File

@ -1,4 +1,4 @@
package me.minidigger.hangar.controller.dummy;
package me.minidigger.hangar.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

View File

@ -1,4 +1,4 @@
package me.minidigger.hangar.controller.dummy;
package me.minidigger.hangar.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

View File

@ -1,4 +1,4 @@
package me.minidigger.hangar.controller.dummy;
package me.minidigger.hangar.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;

View File

@ -1,14 +0,0 @@
package me.minidigger.hangar.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class UserController extends HangarController {
@GetMapping("/staff")
public ModelAndView staff() {
return fillModel( new ModelAndView("users/staff"));
}
}

View File

@ -1,6 +1,7 @@
package me.minidigger.hangar.controller.dummy;
package me.minidigger.hangar.controller;
import org.springframework.stereotype.Controller;
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.RequestParam;
@ -46,9 +47,9 @@ public class UsersController extends HangarController {
return null; // TODO implement signUp request controller
}
@RequestMapping("/staff")
public Object showStaff(@RequestParam Object sort, @RequestParam Object page) {
return null; // TODO implement showStaff request controller
@GetMapping("/staff")
public Object showStaff(@RequestParam(required = false) Object sort, @RequestParam(required = false) Object page) {
return fillModel( new ModelAndView("users/staff")); // TODO implement showStaff request controller
}
@RequestMapping("/verify")

View File

@ -1,4 +1,4 @@
package me.minidigger.hangar.controller.dummy;
package me.minidigger.hangar.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

View File

@ -17,6 +17,9 @@
<#macro url path>
<#compress>
<#if path?starts_with("bootstrap") || path?starts_with("build") || path?starts_with("diff-match-patch") || path?starts_with("highlight") || path?starts_with("images") || path?starts_with("javascripts") || path?starts_with("manifest")>
/assets
</#if>
/${path}
</#compress>
</#macro>