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