diff --git a/src/main/frontend/src/components/Icon.vue b/src/main/frontend/src/components/Icon.vue index 9b734fbb9..9f1f2fc11 100644 --- a/src/main/frontend/src/components/Icon.vue +++ b/src/main/frontend/src/components/Icon.vue @@ -20,7 +20,7 @@ export default { if (this.href != null) { return this.href; } else if (this.name != null) { - return window.jsRoutes.controllers.Users.showProjects(this.name, null).absoluteURL(); + return window.ROUTES.parse('USERS_SHOW_PROJECTS', this.name); } else { return '#'; } diff --git a/src/main/frontend/src/components/ProjectList.vue b/src/main/frontend/src/components/ProjectList.vue index 4c0f11c30..4a14a28b8 100644 --- a/src/main/frontend/src/components/ProjectList.vue +++ b/src/main/frontend/src/components/ProjectList.vue @@ -21,7 +21,7 @@
@@ -31,11 +31,12 @@ {{ project.recommended_version.version }} @@ -128,6 +129,7 @@ export default { }, data() { return { + ROUTES: window.ROUTES, projects: [], totalProjects: 0, loading: true, @@ -140,9 +142,6 @@ export default { total: function () { return Math.ceil(this.totalProjects / this.limit); }, - routes: function () { - return window.jsRoutes.controllers.project; - }, }, created() { this.update(); diff --git a/src/main/frontend/src/components/Swagger.vue b/src/main/frontend/src/components/Swagger.vue index f5994c459..715612fc6 100644 --- a/src/main/frontend/src/components/Swagger.vue +++ b/src/main/frontend/src/components/Swagger.vue @@ -19,7 +19,7 @@ export default { requestInterceptor: (req) => { if (!req.loadSpec) { const promise = getApiSession().then((session) => { - req.headers.authorization = 'HangarApi session=' + session; + req.headers.authorization = 'HangarApi session="' + session + '"'; return req; }); // Workaround for fixing the curl URL diff --git a/src/main/frontend/src/components/entrypoints/versions/VersionListView.vue b/src/main/frontend/src/components/entrypoints/versions/VersionListView.vue index 0fa5fafa8..d41c4857a 100644 --- a/src/main/frontend/src/components/entrypoints/versions/VersionListView.vue +++ b/src/main/frontend/src/components/entrypoints/versions/VersionListView.vue @@ -196,9 +196,6 @@ export default { }, }, computed: { - routes() { - return window.jsRoutes.controllers.project; - }, offset() { return (this.page - 1) * this.limit; }, diff --git a/src/main/java/io/papermc/hangar/controller/ApplicationController.java b/src/main/java/io/papermc/hangar/controller/ApplicationController.java index 3a333c64f..611e55151 100644 --- a/src/main/java/io/papermc/hangar/controller/ApplicationController.java +++ b/src/main/java/io/papermc/hangar/controller/ApplicationController.java @@ -3,36 +3,6 @@ package io.papermc.hangar.controller; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.io.ClassPathResource; -import org.springframework.format.annotation.DateTimeFormat; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.annotation.Secured; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -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.bind.annotation.ResponseStatus; -import org.springframework.web.server.ResponseStatusException; -import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.View; - -import java.time.LocalDate; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import javax.servlet.http.HttpServletRequest; - import io.papermc.hangar.config.hangar.HangarConfig; import io.papermc.hangar.controller.util.StatusZ; import io.papermc.hangar.db.customtypes.LoggedActionType; @@ -63,6 +33,34 @@ import io.papermc.hangar.service.VersionService; import io.papermc.hangar.service.project.FlagService; import io.papermc.hangar.service.project.ProjectService; import io.papermc.hangar.util.AlertUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ClassPathResource; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.annotation.Secured; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +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.bind.annotation.ResponseStatus; +import org.springframework.web.server.ResponseStatusException; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.View; + +import javax.servlet.http.HttpServletRequest; +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; @Controller public class ApplicationController extends HangarController { @@ -318,38 +316,6 @@ public class ApplicationController extends HangarController { return sitemapService.getGlobalSitemap(); } - @GetMapping(value = "/javascriptRoutes", produces = "text/javascript") - @ResponseBody - public String javaScriptRoutes() { - // yeah, dont even ask wtf is happening here, I dont have an answer - return "window.jsRoutes = {}; (function(_root){\n" + - "var _nS = function(c,f,b){var e=c.split(f||\".\"),g=b||_root,d,a;for(d=0,a=e.length;d -