Update logging
This commit is contained in:
parent
5408f1a1eb
commit
480cd8329c
|
@ -21,7 +21,7 @@ else {
|
||||||
@if (Model.LogConditionsMet) {
|
@if (Model.LogConditionsMet) {
|
||||||
<br/>
|
<br/>
|
||||||
<a class="action-muted">[--]</a>
|
<a class="action-muted">[--]</a>
|
||||||
<a href="/log?artist=@Model.LogArtist&album=@Model.LogAlbum&url=@Model.LogUrl" target="_blank" class="entry-muted cfont"> Log playback</a>
|
<span id="log" onclick="get('/log?artist=@Model.LogArtist&album=@Model.LogAlbum&url=@Model.LogUrl')" class="entry-muted cfont"> Log playback</span>
|
||||||
}
|
}
|
||||||
<br/>
|
<br/>
|
||||||
<a class="action-muted">[--]</a>
|
<a class="action-muted">[--]</a>
|
||||||
|
@ -51,3 +51,11 @@ else {
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function get(url) {
|
||||||
|
fetch(url).then(function(response) {
|
||||||
|
document.getElementById('log').innerText = ' Log playback (' + response + ')';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
|
@ -24,10 +24,10 @@ public class Log : Controller {
|
||||||
Response.StatusCode = (int)res;
|
Response.StatusCode = (int)res;
|
||||||
|
|
||||||
return res switch {
|
return res switch {
|
||||||
HttpStatusCode.Created => $"Logged: {artist} - {album}",
|
HttpStatusCode.Created => $"Logged",
|
||||||
HttpStatusCode.Accepted => $"Skipped: {artist} - {album}",
|
HttpStatusCode.Accepted => $"Skipped",
|
||||||
HttpStatusCode.Forbidden => "Invalid token.",
|
HttpStatusCode.Forbidden => "Invalid token",
|
||||||
_ => $"Error {Response.StatusCode} \"{res}\" occured."
|
_ => $"Error {Response.StatusCode} \"{res}\" occured"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue