mirror of
https://gitee.com/dcren/initializr.git
synced 2025-05-04 20:58:03 +08:00
Remove gs-* links
This commit is contained in:
parent
0ccc883c90
commit
697955e98a
59
app.groovy
59
app.groovy
@ -1,5 +1,6 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
|
@Grab("org.springframework.boot:spring-boot-starter-actuator:0.5.0.M1")
|
||||||
@Grab("org.codehaus.groovy:groovy-ant:2.1.6")
|
@Grab("org.codehaus.groovy:groovy-ant:2.1.6")
|
||||||
@Grab("org.codehaus.groovy.modules.http-builder:http-builder:0.5.2")
|
@Grab("org.codehaus.groovy.modules.http-builder:http-builder:0.5.2")
|
||||||
@Grab(group='net.sf.json-lib', module='json-lib', version='2.3', classifier='jdk15')
|
@Grab(group='net.sf.json-lib', module='json-lib', version='2.3', classifier='jdk15')
|
||||||
@ -18,8 +19,6 @@ class MainController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private Reactor reactor
|
private Reactor reactor
|
||||||
|
|
||||||
private gettingStartedRepos = []
|
|
||||||
|
|
||||||
@RequestMapping("/")
|
@RequestMapping("/")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
String home() {
|
String home() {
|
||||||
@ -108,35 +107,6 @@ class MainController {
|
|||||||
new ResponseEntity<byte[]>(body, ["Content-Type":"application/octet-stream"] as HttpHeaders, HttpStatus.OK)
|
new ResponseEntity<byte[]>(body, ["Content-Type":"application/octet-stream"] as HttpHeaders, HttpStatus.OK)
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/gs")
|
|
||||||
@ResponseBody
|
|
||||||
String gettingStartedList(@RequestHeader("Authorization") auth) {
|
|
||||||
if (gettingStartedRepos.empty) {
|
|
||||||
RESTClient github = new RESTClient("https://api.github.com")
|
|
||||||
if (auth) {
|
|
||||||
github.headers['Authorization'] = auth
|
|
||||||
}
|
|
||||||
github.headers['User-Agent'] = 'Mozilla/4.0'
|
|
||||||
def names = github.get( path : "orgs/springframework-meta/repos").data.collect { it.name }
|
|
||||||
names = names.findAll { it.startsWith "gs-"}
|
|
||||||
gettingStartedRepos = names.collect { [repo:it, name:it.split("-").findAll{it!="gs"}.collect{it.capitalize()}.join(" ")]}
|
|
||||||
}
|
|
||||||
template "gs.html", [repos:gettingStartedRepos]
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping("/gs/{repo}")
|
|
||||||
@ResponseBody
|
|
||||||
ResponseEntity<byte[]> gettingStartedProject(java.security.Principal principal, @RequestHeader("Authorization") auth, @PathVariable String repo) {
|
|
||||||
RESTClient github = new RESTClient("https://api.github.com")
|
|
||||||
if (auth) {
|
|
||||||
github.headers['Authorization'] = auth
|
|
||||||
}
|
|
||||||
github.headers['User-Agent'] = 'Mozilla/4.0'
|
|
||||||
def body = github.get( path : "repos/springframework-meta/${repo}/zipball/master").data.bytes
|
|
||||||
log.info("Downloaded: " + body.length + " bytes of ${repo} for ${principal.name}")
|
|
||||||
new ResponseEntity<byte[]>(body, ["Content-Type":"application/zip"] as HttpHeaders, HttpStatus.OK)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
import reactor.spring.context.ConsumerBeanPostProcessor;
|
import reactor.spring.context.ConsumerBeanPostProcessor;
|
||||||
@ -185,33 +155,6 @@ class TemporaryFileCleaner {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Grab("org.springframework.boot:spring-boot-starter-actuator:0.5.0.M1")
|
|
||||||
import org.springframework.boot.ops.properties.SecurityProperties
|
|
||||||
@EnableWebSecurity
|
|
||||||
@Configuration
|
|
||||||
@Log
|
|
||||||
class SecurityConfiguration {
|
|
||||||
|
|
||||||
@Bean(name = "org.springframework.boot.ops.properties.SecurityProperties")
|
|
||||||
SecurityProperties securityProperties() {
|
|
||||||
SecurityProperties security = new SecurityProperties()
|
|
||||||
security.getBasic().setPath("/gs/**")
|
|
||||||
security.getBasic().setRealm("Github Credentials")
|
|
||||||
security
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
AuthenticationManager authenticationManager() {
|
|
||||||
new AuthenticationManager() {
|
|
||||||
Authentication authenticate(Authentication authentication) {
|
|
||||||
log.info("Authenticating: " + authentication.name)
|
|
||||||
new UsernamePasswordAuthenticationToken(authentication.name, "<N/A>", AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class PomRequest {
|
class PomRequest {
|
||||||
def style = []
|
def style = []
|
||||||
|
|
||||||
|
@ -14,24 +14,19 @@
|
|||||||
Spring
|
Spring
|
||||||
</a>
|
</a>
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
<li>
|
|
||||||
<a href="/spring.zip">
|
|
||||||
Download
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href="/">
|
<a href="/">
|
||||||
Projects
|
Projects
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/installer">
|
<a href="/spring.zip">
|
||||||
Installer
|
Download
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/gs">
|
<a href="/install.sh">
|
||||||
Getting Started
|
Installer
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user