forked from CODeRUS/klipper_logs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
144 lines (124 loc) · 4.57 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Klipper Log Parser</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
</head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
<script>
function copyCode(itemId) {
const copyText = document.getElementById(itemId);
navigator.clipboard.writeText(copyText.innerHTML);
}
function updateContent(langData) {
console.log('updatin lang labels');
document.querySelectorAll('[data-i18n]').forEach(element => {
const key = element.getAttribute('data-i18n');
element.textContent = langData[key];
});
}
async function fetchLanguageData(lang) {
const response = await fetch(`index_${lang}.json`);
return response.json();
}
async function onLoad() {
const lang = (navigator.language || navigator.userLanguage).split('-')[0].toLowerCase();
if (lang != 'en') {
console.log('loading language:', lang);
const langData = await fetchLanguageData(lang);
if (langData) {
updateContent(langData);
}
}
}
</script>
<body onload="onLoad()">
<div class="container-fluid">
<h1 data-i18n="header">Klipper Log Parser</h1>
<br>
<h3 data-i18n="title1">
Automatic logs uploading<br>Run code below on your klipper host to upload to parser
</h3>
<div class="card my-2">
<div class="card-header" data-i18n="heading1">
Upload latest logs from printer_data folder
</div>
<div class="card-body">
<pre id="getlogs1">
curl -L https://coderus.openrepos.net/klipper_logs/getlogs | bash -s
</pre>
<button class="btn btn-primary" data-i18n="copy-clipboard" onclick="copyCode('getlogs1');">Copy to clipboard</button>
</div>
</div>
<h3 data-i18n="title2">
Other uploading options
</h3>
<div class="card my-2">
<div class="card-header" data-i18n="heading2">
Upload latest logs from different printer data folder
</div>
<div class="card-body">
<pre id="getlogs2">
curl -L https://coderus.openrepos.net/klipper_logs/getlogs | bash -s -- printer_1_data
</pre>
<button class="btn btn-primary" data-i18n="copy-clipboard" onclick="copyCode('getlogs2');">Copy to clipboard</button>
</div>
</div>
<div class="card my-2">
<div class="card-header" data-i18n="heading3">
Upload exact logs files from printer_data folder
</div>
<div class="card-body">
<pre id="getlogs3">
curl -L https://coderus.openrepos.net/klipper_logs/getlogs | KLIPPY=klippy.log.2023-12-19 MOONRAKER=moonraker.log.2023-12-19 bash -s
</pre>
<button class="btn btn-primary" data-i18n="copy-clipboard" onclick="copyCode('getlogs3');">Copy to clipboard</button>
</div>
</div>
<div class="card my-2">
<div class="card-header" data-i18n="heading4">
Upload exact logs files from different printer data folder
</div>
<div class="card-body">
<pre id="getlogs4">
curl -L https://coderus.openrepos.net/klipper_logs/getlogs | KLIPPY=klippy.log.2023-12-18 MOONRAKER=moonraker.log.2023-12-18 bash -s -- printer_1_data
</pre>
<button class="btn btn-primary" data-i18n="copy-clipboard" onclick="copyCode('getlogs4');">Copy to clipboard</button>
</div>
</div>
<br>
<h3 data-i18n="title2">
Manual logs uploading
</h3>
<form method='POST' enctype='multipart/form-data'>
<div class="mb-3">
<label for="logfile" class="form-label">klippy.log file</label>
<input class="form-control" type="file" id="logfile" name="logfile" accept=".log" required>
</div>
<div class="mb-3">
<label for="moonraker" class="form-label">moonraker.log file</label>
<input class="form-control" type="file" id="moonraker" name="moonraker" accept=".log" required>
</div>
<div class="mb-3">
<label for="dmesg" class="form-label">dmesg.txt file</label>
<input class="form-control" type="file" id="dmesg" name="dmesg" accept=".txt" required>
</div>
<button type="submit" class="btn btn-primary" data-i18n="form-upload">Upload</button>
<br>
<div>
<br>
<div class="card my-2">
<div class="card-header" data-i18n="heading5">
Save dmesg log file to printer_data logs folder
</div>
<div class="card-body">
<pre id="getlogs5">
sudo dmesg -T > ~/printer_data/logs/dmesg.txt
</pre>
<button class="btn btn-primary" data-i18n="copy-clipboard" onclick="copyCode('getlogs5');">Copy to clipboard</button>
</div>
</div>
</div>
</form>