Update logging
This commit is contained in:
parent
5408f1a1eb
commit
480cd8329c
|
@ -21,7 +21,7 @@ else {
|
|||
@if (Model.LogConditionsMet) {
|
||||
<br/>
|
||||
<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/>
|
||||
<a class="action-muted">[--]</a>
|
||||
|
@ -51,3 +51,11 @@ else {
|
|||
</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;
|
||||
|
||||
return res switch {
|
||||
HttpStatusCode.Created => $"Logged: {artist} - {album}",
|
||||
HttpStatusCode.Accepted => $"Skipped: {artist} - {album}",
|
||||
HttpStatusCode.Forbidden => "Invalid token.",
|
||||
_ => $"Error {Response.StatusCode} \"{res}\" occured."
|
||||
HttpStatusCode.Created => $"Logged",
|
||||
HttpStatusCode.Accepted => $"Skipped",
|
||||
HttpStatusCode.Forbidden => "Invalid token",
|
||||
_ => $"Error {Response.StatusCode} \"{res}\" occured"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue