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

View File

@ -124,15 +124,14 @@ var indexHTML = `
send(evt) {
evt.preventDefault();
evt.stopPropagation()
this.input = "";
if (!this.authenticated) {
console.log("User is a bot.");
this.err = "User appears to be a bot.";
return;
}
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.input = "";
axios.post('/cli/api', payload)
.then(resp => {
console.log(JSON.stringify(resp.data));