实现可运行的xterm.js方案
This commit is contained in:
2563
web/public/asciinema-player.css
Normal file
2563
web/public/asciinema-player.css
Normal file
File diff suppressed because it is too large
Load Diff
1213
web/public/asciinema-player.js
Normal file
1213
web/public/asciinema-player.js
Normal file
File diff suppressed because one or more lines are too long
38
web/public/asciinema.html
Normal file
38
web/public/asciinema.html
Normal file
@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
<link rel="stylesheet" type="text/css" href="asciinema-player.css"/>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<asciinema-player id='asciinema-player' src=""></asciinema-player>
|
||||
<script src="asciinema-player.js"></script>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
|
||||
const server = 'http://localhost:8088';
|
||||
|
||||
function getQueryVariable(variable) {
|
||||
const query = window.location.search.substring(1);
|
||||
const vars = query.split("&");
|
||||
for (let i = 0; i < vars.length; i++) {
|
||||
const pair = vars[i].split("=");
|
||||
if (pair[0] === variable) {
|
||||
return pair[1];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
let sessionId = getQueryVariable('sessionId');
|
||||
document.getElementById('asciinema-player').setAttribute('src', `${server}/sessions/${sessionId}/recording`);
|
||||
</script>
|
||||
</html>
|
Reference in New Issue
Block a user