mirror of
https://github.com/kxgx/2.13-Ink-screen-clock.git
synced 2026-03-21 07:59:45 +08:00
59 lines
1.9 KiB
HTML
59 lines
1.9 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title>编辑 main.py</title>
|
||
<!-- 引用本地的highlight.js CSS -->
|
||
<link rel="stylesheet" href="{{ url_for('static', filename='default.min.css') }}">
|
||
</head>
|
||
<body>
|
||
<h1>编辑 main.py</h1>
|
||
<!-- 添加一个表单来提交编辑后的代码 -->
|
||
<form method="post" action="{{ url_for('save_main_py') }}">
|
||
<pre style="background-color: black !important;"><code class="python" id="code">{{ content }}</code></pre>
|
||
<input type="hidden" name="content" id="hidden-content">
|
||
<input type="submit" value="保存">
|
||
</form>
|
||
|
||
<!-- 引用本地的highlight.js JavaScript -->
|
||
<script src="{{ url_for('static', filename='highlight.min.js') }}"></script>
|
||
<script>
|
||
// 初始化highlight.js
|
||
document.addEventListener('DOMContentLoaded', (event) => {
|
||
hljs.highlightAll();
|
||
});
|
||
</script>
|
||
|
||
<script>
|
||
document.addEventListener('DOMContentLoaded', function() {
|
||
var preElements = document.querySelectorAll('pre.code-editor');
|
||
preElements.forEach(function(pre) {
|
||
pre.style.backgroundColor = 'black';
|
||
});
|
||
});
|
||
</script>
|
||
|
||
<h2>重启</h2>
|
||
</head>
|
||
<body>
|
||
<button id="executeShellBtn">重启</button>
|
||
|
||
<script>
|
||
document.getElementById('executeShellBtn').addEventListener('click', function() {
|
||
fetch('/execute-shell')
|
||
.then(response => response.json())
|
||
.then(data => {
|
||
if (data.status === 'success') {
|
||
alert('Command executed successfully:\n' + data.output);
|
||
} else {
|
||
alert('Error executing command:\n' + data.output);
|
||
}
|
||
})
|
||
.catch(error => {
|
||
alert('Error: ' + error);
|
||
});
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|
||
|