New simple bootstrap layout and audio files readme
minor tweak to check files for ".dca" substring first.
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
run.bat
|
run.bat
|
||||||
run.sh
|
run.sh
|
||||||
|
audio/*.dca
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Place .dca audio files here.
|
||||||
|
Naming convention is as follows: command_soundname.dca
|
||||||
|
This will result in "!command soundname".
|
||||||
@@ -82,6 +82,7 @@ var COLLECTIONS []*SoundCollection
|
|||||||
func createCollections() {
|
func createCollections() {
|
||||||
files, _ := ioutil.ReadDir("./audio")
|
files, _ := ioutil.ReadDir("./audio")
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
|
if strings.Contains(f.Name(), ".dca") {
|
||||||
soundfile := strings.Split(strings.Replace(f.Name(), ".dca", "", -1), "_")
|
soundfile := strings.Split(strings.Replace(f.Name(), ".dca", "", -1), "_")
|
||||||
containsPrefix := false
|
containsPrefix := false
|
||||||
containsSound := false
|
containsSound := false
|
||||||
@@ -107,6 +108,7 @@ func createCollections() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func addNewSoundCollection(prefix string, soundname string) {
|
func addNewSoundCollection(prefix string, soundname string) {
|
||||||
var SC = &SoundCollection{
|
var SC = &SoundCollection{
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
{{ define "title"}}<title>Example</title>{{ end }}
|
|
||||||
{{ define "content" }}
|
{{ define "content" }}
|
||||||
<a href="/discordLogin">Login with Discord</a>
|
<a href="/discordLogin">Login with Discord</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{{ define "content" }}
|
||||||
|
<a href="/logout">Logout</a>
|
||||||
|
{{ end }}
|
||||||
+50
-8
@@ -1,17 +1,59 @@
|
|||||||
{{ define "base" }}
|
{{ define "base" }}
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="/static/css/style.css">
|
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
|
||||||
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600,700' rel='stylesheet' type='text/css'>
|
<!-- Latest compiled and minified CSS -->
|
||||||
{{template "title" . }}
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
|
|
||||||
|
<!-- Optional theme -->
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
|
||||||
|
|
||||||
|
<!-- Latest compiled and minified JavaScript -->
|
||||||
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
padding-top: 50px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<title>Gidbig</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||||
<h1>Example</h1>
|
<div class="container">
|
||||||
</header>
|
<div class="navbar-header">
|
||||||
<div id="page">
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
||||||
{{ template "content" . }}
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<a class="navbar-brand" href="#">Gidbig</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="navbar" class="collapse navbar-collapse">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li class="active"><a href="#">Home</a></li>
|
||||||
|
<li><a href="#about">About</a></li>
|
||||||
|
<li><a href="#contact">Contact</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!--/.nav-collapse -->
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<div class="starter-template">
|
||||||
|
<h1>Gidbig</h1>
|
||||||
|
<p class="lead">{{ template "content" . }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /.container -->
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
+2
-1
@@ -40,6 +40,7 @@ var (
|
|||||||
// startWebServer
|
// startWebServer
|
||||||
func startWebServer(port string, ci string, cs string, redirectURL string) {
|
func startWebServer(port string, ci string, cs string, redirectURL string) {
|
||||||
tmpls["home.html"] = template.Must(template.ParseFiles(templateDir+"home.html", defaultLayout))
|
tmpls["home.html"] = template.Must(template.ParseFiles(templateDir+"home.html", defaultLayout))
|
||||||
|
tmpls["internal.html"] = template.Must(template.ParseFiles(templateDir+"internal.html", defaultLayout))
|
||||||
store = sessions.NewCookieStore([]byte(cs))
|
store = sessions.NewCookieStore([]byte(cs))
|
||||||
discordOauthConfig.ClientID = ci
|
discordOauthConfig.ClientID = ci
|
||||||
discordOauthConfig.ClientSecret = cs
|
discordOauthConfig.ClientSecret = cs
|
||||||
@@ -59,7 +60,7 @@ func startWebServer(port string, ci string, cs string, redirectURL string) {
|
|||||||
func handleMain(w http.ResponseWriter, r *http.Request) {
|
func handleMain(w http.ResponseWriter, r *http.Request) {
|
||||||
session, _ := store.Get(r, "session-name")
|
session, _ := store.Get(r, "session-name")
|
||||||
if session.Values["discordUsername"] != nil {
|
if session.Values["discordUsername"] != nil {
|
||||||
fmt.Fprintf(w, "<html><body>you are logged in as %s. <a href=\"/logout\">logout</a></body></html>", session.Values["discordUsername"])
|
tmpls["internal.html"].ExecuteTemplate(w, "base", map[string]interface{}{})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tmpls["home.html"].ExecuteTemplate(w, "base", map[string]interface{}{})
|
tmpls["home.html"].ExecuteTemplate(w, "base", map[string]interface{}{})
|
||||||
|
|||||||
Reference in New Issue
Block a user