1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

Add copy button to crash page

This commit is contained in:
Harvey Tindall 2021-06-13 15:36:36 +01:00
parent 1dc0b2234a
commit 21125033ff
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
3 changed files with 16 additions and 2 deletions

View File

@ -21,6 +21,7 @@
</section>
<section class="section ~neutral !low">
<span class="subheading">Full Log</span>
<span class="button ~urge ml-half" id="copy-log">Copy</span>
<div class="row mb-1">
<label class="col mr-1">
<span class="button ~neutral !high supra full-width center" id="button-log-normal">Normal</span>

View File

@ -390,10 +390,10 @@ func start(asDaemon, firstCall bool) {
server := app.config.Section("jellyfin").Key("server").String()
cacheTimeout := int(app.config.Section("jellyfin").Key("cache_timeout").MustUint(30))
stringServerType := app.config.Section("jellyfin").Key("type").String()
timeoutHandler := mediabrowser.NewNamedTimeoutHandler("Jellyfin", server, true)
timeoutHandler := mediabrowser.NewNamedTimeoutHandler("Jellyfin", "\""+server+"\"", true)
if stringServerType == "emby" {
serverType = mediabrowser.EmbyServer
timeoutHandler = mediabrowser.NewNamedTimeoutHandler("Emby", server, true)
timeoutHandler = mediabrowser.NewNamedTimeoutHandler("Emby", "\""+server+"\"", true)
app.info.Println("Using Emby server type")
fmt.Println(warning("WARNING: Emby compatibility is experimental, and support is limited.\nPassword resets are not available."))
} else {

View File

@ -1,3 +1,5 @@
import { toClipboard } from "./modules/common.js";
const buttonNormal = document.getElementById("button-log-normal") as HTMLInputElement;
const buttonSanitized = document.getElementById("button-log-sanitized") as HTMLInputElement;
@ -24,3 +26,14 @@ const buttonChange = (type: string) => {
}
buttonNormal.onclick = () => buttonChange("normal");
buttonSanitized.onclick = () => buttonChange("sanitized");
const copyButton = document.getElementById("copy-log") as HTMLSpanElement;
copyButton.onclick = () => {
if (logSanitized.classList.contains("unfocused")) {
toClipboard("```\n" + logNormal.textContent + "```");
} else {
toClipboard("```\n" + logSanitized.textContent + "```");
}
copyButton.textContent = "Copied.";
setTimeout(() => { copyButton.textContent = "Copy"; }, 1500);
};