1
0
Fork 0
mirror of https://github.com/imjasonh/nopullrequests synced 2026-07-07 03:22:24 +00:00

make / a static file

This commit is contained in:
Jason Hall 2015-03-29 16:07:04 -04:00
parent 14821f82ab
commit e2be37d779
4 changed files with 20 additions and 23 deletions

View file

@ -11,5 +11,9 @@ handlers:
static_files: static/favicon.ico
upload: static/favicon.ico
- url: /
static_files: static/home.html
upload: static/home.html
- url: /.*
script: _go_app

View file

@ -40,7 +40,6 @@ var scopes = strings.Join([]string{
}, ",")
func init() {
http.HandleFunc("/", homeHandler)
http.HandleFunc("/start", startHandler)
http.HandleFunc(redirectURLPath, oauthHandler)
http.HandleFunc("/user", userHandler)
@ -49,11 +48,6 @@ func init() {
http.HandleFunc("/hook", webhookHandler)
}
// TODO: make this a static file, make it not ugly
func homeHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, homeTmpl)
}
func startHandler(w http.ResponseWriter, r *http.Request) {
ctx := appengine.NewContext(r)
u := user.Current(ctx)

16
static/home.html Normal file
View file

@ -0,0 +1,16 @@
<html><head>
<title>No Pull Requests</title>
<link rel="stylesheet" href="/static/style.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/2.2.0/octicons.css" />
</head><body><div id="container">
<h1><span class="mega-octicon octicon-git-pull-request"></span>
GitHub Pull Request Rejection Bot</h1>
<p>Some projects on GitHub don't accept GitHub Pull Requests. Maybe they have their own contribution processes. Maybe they hate freedom. Either way, GitHub doesn't provide a way to disable pull requests officially.</p>
<p>So I wrote this.</p>
<p>Using this tool, you can effectively <b>disable pull requests</b> for your repo on GitHub. When pull requests are disabled, any time a new one is opened it will immediately be closed by the bot.
<h3>Sound fun? <a href="/user">Let's get started.</a></h3>
</div><small>This project is not affiliated with GitHub.com.</small>
</body></html>

View file

@ -2,23 +2,6 @@ package nopr
import "text/template"
const homeTmpl = `<html><head>
<title>No Pull Requests</title>
<link rel="stylesheet" href="/static/style.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/2.2.0/octicons.css" />
</head><body><div id="container">
<h1><span class="mega-octicon octicon-git-pull-request"></span>
GitHub Pull Request Rejection Bot</h1>
<p>Some projects on GitHub don't accept GitHub Pull Requests. Maybe they have their own contribution processes. Maybe they hate freedom. Either way, GitHub doesn't provide a way to disable pull requests officially.</p>
<p>So I wrote this.</p>
<p>Using this tool, you can effectively <b>disable pull requests</b> for your repo on GitHub. When pull requests are disabled, any time a new one is opened it will immediately be closed by the bot.
<h3>Sound fun? <a href="/user">Let's get started.</a></h3>
</div><small>This project is not affiliated with GitHub.com.</small>
</body></html>`
var userTmpl = template.Must(template.New("user").Parse(`<html><head>
<title>No Pull Requests</title>
<link rel="stylesheet" href="/static/style.css" />