mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +00:00
[editor] Display disconnected status instead of error
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
192dcb7f46
commit
9150ec6311
2 changed files with 31 additions and 12 deletions
|
@ -18,7 +18,7 @@ import (
|
|||
type (
|
||||
configEditorGeneralConfig struct {
|
||||
BotEditors []string `json:"bot_editors"`
|
||||
BotName string `json:"bot_name"`
|
||||
BotName *string `json:"bot_name,omitempty"`
|
||||
Channels []string `json:"channels"`
|
||||
ChannelHasScopes map[string]bool `json:"channel_has_scopes"`
|
||||
}
|
||||
|
@ -189,10 +189,9 @@ func configEditorHandleGeneralGet(w http.ResponseWriter, r *http.Request) {
|
|||
elevated[ch] = store.UserHasGrantedScopes(ch, channelDefaultScopes...)
|
||||
}
|
||||
|
||||
uName, err := twitchClient.GetAuthorizedUsername()
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
var uName *string
|
||||
if n, err := twitchClient.GetAuthorizedUsername(); err == nil {
|
||||
uName = &n
|
||||
}
|
||||
|
||||
if err := json.NewEncoder(w).Encode(configEditorGeneralConfig{
|
||||
|
|
|
@ -222,13 +222,33 @@
|
|||
/>
|
||||
Bot Connection
|
||||
</span>
|
||||
<code id="botUserName">{{ generalConfig.bot_name }}</code>
|
||||
<b-tooltip
|
||||
target="botUserName"
|
||||
triggers="hover"
|
||||
>
|
||||
Twitch Login-Name of the bot user currently authorized
|
||||
</b-tooltip>
|
||||
<template v-if="generalConfig.bot_name">
|
||||
<code
|
||||
id="botUserName"
|
||||
>
|
||||
{{ generalConfig.bot_name }}
|
||||
<b-tooltip
|
||||
target="botUserName"
|
||||
triggers="hover"
|
||||
>
|
||||
Twitch Login-Name of the bot user currently authorized
|
||||
</b-tooltip>
|
||||
</code>
|
||||
</template>
|
||||
<template v-else>
|
||||
<font-awesome-icon
|
||||
id="botUserNameDC"
|
||||
fixed-width
|
||||
class="mr-1 text-danger"
|
||||
:icon="['fas', 'unlink']"
|
||||
/>
|
||||
<b-tooltip
|
||||
target="botUserNameDC"
|
||||
triggers="hover"
|
||||
>
|
||||
Bot is not currently authorized!
|
||||
</b-tooltip>
|
||||
</template>
|
||||
</b-card-header>
|
||||
|
||||
<b-card-body>
|
||||
|
|
Loading…
Reference in a new issue