mirror of https://github.com/velour/catbase.git
web: bugfix pack
* menuize front page * fix url bug * fix cli
This commit is contained in:
parent
e6c4df8e20
commit
05fd032bea
12
bot/web.go
12
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>
|
||||||
|
|
|
@ -12,7 +12,7 @@ var indexHTML = `
|
||||||
<script src="//polyfill.io/v3/polyfill.min.js?features=es2015%2CMutationObserver"></script>
|
<script src="//polyfill.io/v3/polyfill.min.js?features=es2015%2CMutationObserver"></script>
|
||||||
|
|
||||||
<!-- Load Vue followed by BootstrapVue -->
|
<!-- Load Vue followed by BootstrapVue -->
|
||||||
<script src="//unpkg.com/vue@latest/dist/vue.min.js"></script>
|
<script src="//unpkg.com/vue@latest/dist/vue.js"></script>
|
||||||
<script src="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.min.js"></script>
|
<script src="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.min.js"></script>
|
||||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
|
@ -82,6 +82,7 @@ var indexHTML = `
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
Vue.config.devtools = true;
|
||||||
var app = new Vue({
|
var app = new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
data: {
|
data: {
|
||||||
|
@ -124,15 +125,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