Merge pull request #186 from velour/fixbugz

web: bugfix pack
This commit is contained in:
Chris Sexton 2019-06-09 01:00:28 -04:00 committed by GitHub
commit f87b2eebc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View File

@ -20,7 +20,7 @@ func (b *bot) GetWebNavigation() []EndPoint {
endpoints := b.httpEndPoints endpoints := b.httpEndPoints
moreEndpoints := b.config.GetArray("bot.links", []string{}) moreEndpoints := b.config.GetArray("bot.links", []string{})
for _, e := range moreEndpoints { for _, e := range moreEndpoints {
link := strings.Split(e, ":") link := strings.SplitN(e, ":", 2)
if len(link) != 2 { if len(link) != 2 {
continue continue
} }
@ -51,12 +51,12 @@ var rootIndex = `
<body> <body>
<div id="app"> <div id="app">
<b-container> <b-navbar>
<h1>catbase</h1> <b-navbar-brand>catbase</b-navbar-brand>
<b-nav vertical class="w-25"> <b-navbar-nav>
<b-nav-item v-for="item in nav" :href="item.URL">{{ "{{ item.Name }}" }}</b-nav-item> <b-nav-item v-for="item in nav" :href="item.URL">{{ "{{ item.Name }}" }}</b-nav-item>
</b-nav> </b-navbar-nav>
</b-container> </b-navbar>
</div> </div>
<script> <script>

View File

@ -124,15 +124,14 @@ var indexHTML = `
send(evt) { send(evt) {
evt.preventDefault(); evt.preventDefault();
evt.stopPropagation() evt.stopPropagation()
this.input = "";
if (!this.authenticated) { if (!this.authenticated) {
console.log("User is a bot."); console.log("User is a bot.");
this.err = "User appears to be a bot."; this.err = "User appears to be a bot.";
return; return;
} }
const payload = {user: this.user, payload: this.input}; const payload = {user: this.user, payload: this.input};
console.log("Would have posted to /cli/api:" + JSON.stringify(payload));
this.addText(this.user, this.input); this.addText(this.user, this.input);
this.input = "";
axios.post('/cli/api', payload) axios.post('/cli/api', payload)
.then(resp => { .then(resp => {
console.log(JSON.stringify(resp.data)); console.log(JSON.stringify(resp.data));