mirror of
https://github.com/HangarMC/Hangar.git
synced 2025-02-05 14:40:33 +08:00
removed /javascriptRoutes route
This commit is contained in:
parent
b772cd8217
commit
295b9f7216
@ -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 '#';
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
<div class="col-12 col-sm-11">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<a :href="routes.Projects.show(project.namespace.owner, project.namespace.slug).absoluteURL()" class="title">
|
||||
<a :href="ROUTES.parse('PROJECTS_SHOW', project.namespace.owner, project.namespace.slug)" class="title">
|
||||
{{ project.name }}
|
||||
</a>
|
||||
</div>
|
||||
@ -31,11 +31,12 @@
|
||||
<i class="far fa-gem"></i>
|
||||
<a
|
||||
:href="
|
||||
routes.Versions.show(
|
||||
ROUTES.parse(
|
||||
'VERSIONS_SHOW',
|
||||
project.namespace.owner,
|
||||
project.namespace.slug,
|
||||
project.recommended_version.version
|
||||
).absoluteURL()
|
||||
)
|
||||
"
|
||||
>
|
||||
{{ 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();
|
||||
|
@ -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
|
||||
|
@ -196,9 +196,6 @@ export default {
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
routes() {
|
||||
return window.jsRoutes.controllers.project;
|
||||
},
|
||||
offset() {
|
||||
return (this.page - 1) * this.limit;
|
||||
},
|
||||
|
@ -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<a;d++){g=g[e[d]]=g[e[d]]||{}}return g}\n" +
|
||||
"var _qS = function(items){var qs = ''; for(var i=0;i<items.length;i++) {if(items[i]) qs += (qs ? '&' : '') + items[i]}; return qs ? ('?' + qs) : ''}\n" +
|
||||
"var _s = function(p,s){return p+((s===true||(s&&s.secure))?'s':'')+'://'}\n" +
|
||||
"var _wA = function(r){return {ajax:function(c){c=c||{};c.url=r.url;c.type=r.method;return jQuery.ajax(c)}, method:r.method,type:r.method,url:r.url,absoluteURL: function(s){return _s('http',s)+'localhost:8080'+r.url},webSocketURL: function(s){return _s('ws',s)+'localhost:9000'+r.url}}}\n" +
|
||||
"_nS('controllers.project.Projects'); _root['controllers']['project']['Projects']['show'] = \n" +
|
||||
" function(author0,slug1) {\n" +
|
||||
" return _wA({method:\"GET\", url:\"/\" + encodeURIComponent((function(k,v) {return v})(\"author\", author0)) + \"/\" + encodeURIComponent((function(k,v) {return v})(\"slug\", slug1))})\n" +
|
||||
" }\n" +
|
||||
" ;\n" +
|
||||
"_nS('controllers.project.Versions'); _root['controllers']['project']['Versions']['show'] = \n" +
|
||||
" function(author0,slug1,version2) {\n" +
|
||||
" return _wA({method:\"GET\", url:\"/\" + encodeURIComponent((function(k,v) {return v})(\"author\", author0)) + \"/\" + encodeURIComponent((function(k,v) {return v})(\"slug\", slug1)) + \"/versions/\" + encodeURIComponent((function(k,v) {return v})(\"version\", version2))})\n" +
|
||||
" }\n" +
|
||||
" ;\n" +
|
||||
"_nS('controllers.project.Versions'); _root['controllers']['project']['Versions']['showCreator'] = \n" +
|
||||
" function(author0,slug1) {\n" +
|
||||
" return _wA({method:\"GET\", url:\"/\" + encodeURIComponent((function(k,v) {return v})(\"author\", author0)) + \"/\" + encodeURIComponent((function(k,v) {return v})(\"slug\", slug1)) + \"/versions/new\"})\n" +
|
||||
" }\n" +
|
||||
" ;\n" +
|
||||
"_nS('controllers.Users'); _root['controllers']['Users']['showProjects'] = \n" +
|
||||
" function(user0) {\n" +
|
||||
" return _wA({method:\"GET\", url:\"/\" + encodeURIComponent((function(k,v) {return v})(\"user\", user0))})\n" +
|
||||
" }\n" +
|
||||
" ;\n" +
|
||||
"})(jsRoutes)"; // TODO implement javaScriptRoutes request controller
|
||||
}
|
||||
|
||||
@GetMapping("/linkout")
|
||||
public ModelAndView linkOut(@RequestParam(defaultValue = "") String remoteUrl) {
|
||||
ModelAndView view = new ModelAndView("linkout");
|
||||
|
@ -33,7 +33,6 @@ public enum Routes {
|
||||
SWAGGER("swagger", Paths.SWAGGER, of(), of()),
|
||||
SHOW_ACTIVITIES("showActivities", Paths.SHOW_ACTIVITIES, of("user"), of()),
|
||||
USER_ADMIN("userAdmin", Paths.USER_ADMIN, of("user"), of()),
|
||||
JAVA_SCRIPT_ROUTES("javaScriptRoutes", Paths.JAVA_SCRIPT_ROUTES, of(), of()),
|
||||
|
||||
PROJECTS_RENAME("projects.rename", Paths.PROJECTS_RENAME, of("author", "slug"), of()),
|
||||
PROJECTS_SET_WATCHING("projects.setWatching", Paths.PROJECTS_SET_WATCHING, of("author", "slug", "watching"), of()),
|
||||
@ -250,7 +249,6 @@ public enum Routes {
|
||||
public static final String SWAGGER = "/api";
|
||||
public static final String SHOW_ACTIVITIES = "/admin/activities/{user}";
|
||||
public static final String USER_ADMIN = "/admin/user/{user}";
|
||||
public static final String JAVA_SCRIPT_ROUTES = "/javascriptRoutes";
|
||||
|
||||
public static final String PROJECTS_RENAME = "/{author}/{slug}/manage/rename";
|
||||
public static final String PROJECTS_SET_WATCHING = "/{author}/{slug}/watchers/{watching}";
|
||||
|
@ -161,7 +161,6 @@ showFooter: Boolean = true, noContainer: Boolean = false, additionalMeta: Html =
|
||||
</script>
|
||||
</#if>
|
||||
|
||||
<script type="text/javascript" src="${Routes.JAVA_SCRIPT_ROUTES.getRouteUrl()}"></script>
|
||||
<script type="text/javascript" src="<@hangar.url "js/chunk-vendors.js" />"></script>
|
||||
<script type="text/javascript" src="<@hangar.url "js/chunk-common.js" />"></script>
|
||||
<script type="text/javascript" src="<@hangar.url "js/font-awesome.js" />"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user