mirror of https://github.com/velour/catbase.git
commit
f87b2eebc5
12
bot/web.go
12
bot/web.go
|
@ -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-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-nav>
|
||||
</b-container>
|
||||
</b-navbar-nav>
|
||||
</b-navbar>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue