5 Commits
1.0 ... v1

Author SHA1 Message Date
18c6a97ae7 Update parcel 2 2022-01-11 02:52:48 +00:00
617c44d40e Add sample users.json 2022-01-08 22:59:43 +13:00
17eaab6158 Update Readme 2021-10-30 23:58:31 +00:00
85c2a3142e Update 'README.md'
Add do not use
2021-10-30 12:44:19 +00:00
905cb9412c On start or server select open new websocket rather than reloading 2021-09-22 21:38:03 +12:00
8 changed files with 11917 additions and 4064 deletions

4
.gitignore vendored
View File

@@ -4,3 +4,7 @@ users.json
frontend/node_modules/
frontend/.cache/
__pychache__
.parcel-cache/
frontend/.parcel-cache/
frontend/dist/
package-lock.json

View File

@@ -1,3 +1,8 @@
# console
# Minecraft Web Console
Front end for starting, stopping, sending command and viewing logs
Not for public use.
This is currently be rewritten

View File

@@ -2,6 +2,7 @@ version: '3.7'
services:
console:
build: ./
container_name: console
image: magmise/console
volumes:

15910
frontend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,19 +2,19 @@
"name": "client",
"version": "1.0.0",
"dependencies": {
"console.js": "^2.0.1",
"parcel": "^1.12.4",
"xterm": "^4.9.0",
"xterm-addon-attach": "^0.6.0",
"xterm-addon-fit": "^0.4.0",
"xterm-addon-search": "^0.7.0"
"xterm": "latest",
"xterm-addon-attach": "latest",
"xterm-addon-fit": "latest",
"xterm-addon-search": "latest"
},
"devDependencies": {
"parcel-bundler": "latest"
"parcel": "^2.0.0"
},
"source": "src/index.html",
"scripts": {
"build": "parcel build src/index.html --out-dir ../public",
"watch": "parcel watch src/index.html --out-dir ../public"
"start": "parcel",
"build": "parcel build src/index.html --dist-dir ../public",
"watch": "parcel watch src/index.html --dist-dir ../public"
},
"browserslist": [
"last 3 and_chr versions",

View File

@@ -18,9 +18,6 @@
<input type="text" name="send" value="">
</form>
<console-component></console-component>
<script src="main.js"></script>
<script src="console.js"></script>
<script type="module" src="main.js"></script>
</body>
</html>

View File

@@ -2,7 +2,6 @@ import { Terminal } from 'xterm';
import { AttachAddon } from 'xterm-addon-attach';
import { FitAddon } from 'xterm-addon-fit';
import { SearchAddon } from 'xterm-addon-search';
import 'console.js';
function main() {
const urlParams = new URLSearchParams(window.location.search);
@@ -62,8 +61,17 @@ function main() {
serverselect.addEventListener("click", (event) => {
console.log(serverselect.value);
window.location.hash = serverselect.value;
server = serverselect.value;
socket.close();
location.reload();
try {
socket = new WebSocket(`wss://${host}/server/${server}/logs?token=${token}`);
const attachAddon = new AttachAddon(socket);
term.loadAddon(attachAddon);
} catch(err) {
alert("You are not allowed to use this server");
return;
}
//location.reload();
})
window.onbeforeunload = function() {
@@ -90,7 +98,15 @@ function main() {
return
}
socket.close();
location.reload();
try {
socket = new WebSocket(`wss://${host}/server/${server}/logs?token=${token}`);
const attachAddon = new AttachAddon(socket);
term.loadAddon(attachAddon);
} catch(err) {
alert("You are not allowed to use this server");
return;
}
//location.reload();
} catch(err) {
console.error(`Error: ${err}`);
}

8
users.json.sample Normal file
View File

@@ -0,0 +1,8 @@
{
"users": {
"test": {
"name": "test",
"servers": ["test"]
}
}
}