whitelabel error log
This commit is contained in:
parent
b2f4968c64
commit
799ef8719b
@ -35,10 +35,21 @@ func WhitelabelGet(ctx *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get errors
|
||||||
|
errors, err := database.Client.WhitelabelErrors.GetRecent(bot.BotId, 10)
|
||||||
|
if err != nil {
|
||||||
|
ctx.JSON(500, gin.H{
|
||||||
|
"success": false,
|
||||||
|
"error": err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ctx.JSON(200, gin.H{
|
ctx.JSON(200, gin.H{
|
||||||
"success": true,
|
"success": true,
|
||||||
"id": strconv.FormatUint(bot.BotId, 10),
|
"id": strconv.FormatUint(bot.BotId, 10),
|
||||||
"status": status,
|
"status": status,
|
||||||
|
"errors": errors,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
go.mod
2
go.mod
@ -6,7 +6,7 @@ require (
|
|||||||
github.com/BurntSushi/toml v0.3.1
|
github.com/BurntSushi/toml v0.3.1
|
||||||
github.com/TicketsBot/archiverclient v0.0.0-20200425115930-0ca198cc8306
|
github.com/TicketsBot/archiverclient v0.0.0-20200425115930-0ca198cc8306
|
||||||
github.com/TicketsBot/common v0.0.0-20200529141045-7426ad13f1a4
|
github.com/TicketsBot/common v0.0.0-20200529141045-7426ad13f1a4
|
||||||
github.com/TicketsBot/database v0.0.0-20200606205929-6851b2444a67
|
github.com/TicketsBot/database v0.0.0-20200612170437-4f91fa8bf2f1
|
||||||
github.com/apex/log v1.1.2
|
github.com/apex/log v1.1.2
|
||||||
github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff // indirect
|
github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff // indirect
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||||
|
@ -15,6 +15,10 @@ body {
|
|||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
overflow-x: hidden !important;
|
overflow-x: hidden !important;
|
||||||
|
@ -46,8 +46,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-6">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h4 class="card-title">Custom Status</h4>
|
<h4 class="card-title">Custom Status</h4>
|
||||||
@ -58,7 +59,8 @@
|
|||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Status</label>
|
<label>Status</label>
|
||||||
<input name="status" type="text" class="form-control" placeholder="DM for help | t!help" id="status">
|
<input name="status" type="text" class="form-control" placeholder="DM for help | t!help"
|
||||||
|
id="status">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -77,70 +79,96 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h4 class="card-title">Error Logs</h4>
|
||||||
|
</div>
|
||||||
|
<div class="card-body" id="card">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Error</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="error_body">
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div aria-live="polite" aria-atomic="true" style="position: relative">
|
|
||||||
<div style="position: absolute; right: 10px" id="toast-container">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// invite button
|
|
||||||
document.getElementById('invite').addEventListener('click', async () => {
|
|
||||||
// get bot ID
|
|
||||||
const res = await axios.get('/user/whitelabel');
|
|
||||||
if (res.status !== 200 || !res.data.success) {
|
|
||||||
showToast('Error', res.data.error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const inviteUrl = 'https://discord.com/oauth2/authorize?client_id=' + res.data.id + '&scope=bot&permissions=805825648';
|
|
||||||
|
|
||||||
window.open(inviteUrl, '_blank');
|
|
||||||
}, false);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
async function updateSettings() {
|
|
||||||
const data = {
|
|
||||||
token: document.getElementById('token').value
|
|
||||||
};
|
|
||||||
|
|
||||||
const res = await axios.post('/user/whitelabel', data);
|
|
||||||
if (res.status !== 200 || !res.data.success) {
|
|
||||||
showToast('Error', res.data.error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
showToast('Success', `Started tickets whitelabel on ${res.data.bot.username}#${res.data.bot.discriminator}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function updateStatus() {
|
|
||||||
const data = {
|
|
||||||
status: document.getElementById('status').value
|
|
||||||
};
|
|
||||||
|
|
||||||
const res = await axios.post('/user/whitelabel/status', data);
|
|
||||||
if (res.status !== 200 || !res.data.success) {
|
|
||||||
showToast('Error', res.data.error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
showToast('Success', 'Updated status successfully')
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadStatus() {
|
|
||||||
const res = await axios.get('/user/whitelabel');
|
|
||||||
if (res.status !== 200 || !res.data.success) {
|
|
||||||
showToast('Error', res.data.error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById('status').value = res.data.status;
|
|
||||||
}
|
|
||||||
|
|
||||||
loadStatus();
|
|
||||||
</script>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div aria-live="polite" aria-atomic="true" style="position: relative">
|
||||||
|
<div style="position: absolute; right: 10px" id="toast-container">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// invite button
|
||||||
|
document.getElementById('invite').addEventListener('click', async () => {
|
||||||
|
// get bot ID
|
||||||
|
const res = await axios.get('/user/whitelabel');
|
||||||
|
if (res.status !== 200 || !res.data.success) {
|
||||||
|
showToast('Error', res.data.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const inviteUrl = 'https://discord.com/oauth2/authorize?client_id=' + res.data.id + '&scope=bot&permissions=805825648';
|
||||||
|
|
||||||
|
window.open(inviteUrl, '_blank');
|
||||||
|
}, false);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
async function updateSettings() {
|
||||||
|
const data = {
|
||||||
|
token: document.getElementById('token').value
|
||||||
|
};
|
||||||
|
|
||||||
|
const res = await axios.post('/user/whitelabel', data);
|
||||||
|
if (res.status !== 200 || !res.data.success) {
|
||||||
|
showToast('Error', res.data.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
showToast('Success', `Started tickets whitelabel on ${res.data.bot.username}#${res.data.bot.discriminator}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updateStatus() {
|
||||||
|
const data = {
|
||||||
|
status: document.getElementById('status').value
|
||||||
|
};
|
||||||
|
|
||||||
|
const res = await axios.post('/user/whitelabel/status', data);
|
||||||
|
if (res.status !== 200 || !res.data.success) {
|
||||||
|
showToast('Error', res.data.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
showToast('Success', 'Updated status successfully')
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadDetails() {
|
||||||
|
const res = await axios.get('/user/whitelabel');
|
||||||
|
if (res.status !== 200 || !res.data.success) {
|
||||||
|
showToast('Error', res.data.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set status
|
||||||
|
document.getElementById('status').value = res.data.status;
|
||||||
|
|
||||||
|
// append errors
|
||||||
|
for (error of res.data.errors) {
|
||||||
|
const tr = document.createElement('tr');
|
||||||
|
appendTd(tr, error);
|
||||||
|
document.getElementById('error_body').appendChild(tr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loadDetails();
|
||||||
|
</script>
|
||||||
{{end}}
|
{{end}}
|
Loading…
x
Reference in New Issue
Block a user