Comit inicial

This commit is contained in:
Marcos Elias Rios Nuñez 2024-12-15 11:53:42 -03:00
commit 5828109083
17 changed files with 352 additions and 0 deletions

8
Dockerfile Normal file
View File

@ -0,0 +1,8 @@
# Usa la imagen oficial de Nginx
FROM nginx:alpine
# Copia los archivos del proyecto al directorio que Nginx usa como raíz
COPY . /usr/share/nginx/html
# Expone el puerto 80
EXPOSE 80

9
cpux86-ta.js Normal file

File diff suppressed because one or more lines are too long

24
cpux86.js Normal file
View File

@ -0,0 +1,24 @@
/*
PC Emulator wrapper
Copyright (c) 2012 Fabrice Bellard
Redistribution or commercial use is prohibited without the author's
permission.
*/
"use strict";
function test_typed_arrays()
{
return (window.Uint8Array &&
window.Uint16Array &&
window.Int32Array &&
window.ArrayBuffer);
}
if (test_typed_arrays()) {
include("cpux86-ta.js");
} else {
include("cpux86-std.js");
document.write('<canvas id="dummy_canvas" width="1" height="1"></canvas>');
}

8
docker-compose.yml Normal file
View File

@ -0,0 +1,8 @@
version: '3.9'
services:
web:
build: .
ports:
- "8085:80"
volumes:
- .:/usr/share/nginx/html

34
estilo.css Normal file
View File

@ -0,0 +1,34 @@
body {
background-image: url("fondo2.jpeg");
background-size: cover;
background-color: transparent;
width: 95%!important;
}
footer {
background-image: url("fondo.png");
background-color: transparent;
background-size: cover;
background-position: right bottom;
width: 95%!important;
}
.term {
font-family: courier,fixed,swiss,monospace,sans-serif;
font-size: 15px;
color: #f0f0f0;
background: #000000;
padding-left: 23px;
}
.container {
width: 95%!important;
}
.termReverse {
color: #000000;
background: #00ff00;
}

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B

BIN
fondo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
fondo2.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
fondo2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

44
index.html Normal file
View File

@ -0,0 +1,44 @@
<!doctype html>
<html lang="es">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon">
<link href="estilo.css" rel="stylesheet">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
<title>Terminal GNU/Linux Virtual</title>
<script src="utils.js" type="text/javascript"></script>
<script src="term.js" type="text/javascript"></script>
<script src="cpux86.js" type="text/javascript"></script>
<script src="cpux86-ta.js" type="text/javascript"></script>
</head>
<body id="principal" onload="start()">
<div class="row">
<div class="col-sm">
<nav class="navbar top-navbar navbar-expand-lg navbar-light white-bg">
<a href="#" onclick="window.location.reload(true);" class="nav-link" style="background-color:rgb(126, 41, 59);color:white;">Terminal Web</a>
</nav>
</div>
</div>
<div class="container border border-3 rounded">
<div class="row"> <script type="text/javascript" src="jslinux.js"> </script> </div>
</div>
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.6.0.js" crossorigin="anonymous"></script>
<script src="./js/notify.min.js" crossorigin="anonymous"></script>
</body>
<footer class="center"></br></br></br></br></br></br></footer>
</html>
<script>
// A $( document ).ready() block.
$( document ).ready(function() {
});
</script>

1
js/notify.min.js vendored Normal file

File diff suppressed because one or more lines are too long

106
jslinux.js Normal file
View File

@ -0,0 +1,106 @@
/*
Linux launcher
Copyright (c) 2011-2012 Fabrice Bellard
Redistribution or commercial use is prohibited without the author's
permission.
*/
"use strict";
var term, pc, boot_start_time, init_state;
function term_start()
{
term = new Term(80, 30, term_handler);
term.open();
term.write("Te damos la bienvenida a a la consola virtual GUGLER...\r\n");
}
/* send chars to the serial port */
function term_handler(str)
{
pc.serial.send_chars(str);
}
/* just used to display the boot time in the VM */
function get_boot_time()
{
return (+new Date()) - boot_start_time;
}
function start()
{
var params;
init_state = new Object();
params = new Object();
/* serial output chars */
params.serial_write = term.write.bind(term);
/* memory size (in bytes) */
params.mem_size = 16 * 1024 * 1024;
/* clipboard I/O */
params.get_boot_time = get_boot_time;
pc = new PCEmulator(params);
init_state.params = params;
pc.load_binary("vmlinux-2.6.20.bin", 0x00100000, start2);
}
function start2(ret)
{
if (ret < 0)
return;
init_state.start_addr = 0x10000;
init_state.initrd_size = 0;
//pc.load_binary("linuxstart.bin", init_state.start_addr, start3);
pc.load_binary("linuxstart.bin", init_state.start_addr, start3_);
}
function start3(ret)
{
var block_list;
if (ret < 0)
return;
/* Preload blocks so that the boot time does not depend on the
* time to load the required disk data (optional) */
block_list = [ 0, 7, 3, 643, 720, 256, 336, 644, 781, 387, 464, 475, 131, 589, 468, 472, 474, 776, 777, 778, 779, 465, 466, 473, 467, 469, 470, 512, 592, 471, 691, 697, 708, 792, 775, 769 ];
pc.ide0.drives[0].bs.preload(block_list, start4);
}
function start3_(ret)
{
if (ret < 0)
return;
pc.load_binary("root.bin", 0x00400000, start4);
}
function start4(ret)
{
var cmdline_addr;
if (ret < 0)
return;
/* Assume booting from /dev/ram0 - result of previous load_binary("root.bin") call equals to the
* size of the ram image.
*/
init_state.initrd_size = ret;
/* set the Linux kernel command line */
cmdline_addr = 0xf800;
//pc.cpu.write_string(cmdline_addr, "console=ttyS0 root=/dev/hda ro init=/sbin/init notsc=1 hdb=none");
pc.cpu.write_string(cmdline_addr, "console=ttyS0 root=/dev/ram0 rw init=/sbin/init notsc=1 ");
pc.cpu.eip = init_state.start_addr;
pc.cpu.regs[0] = init_state.params.mem_size; /* eax */
pc.cpu.regs[3] = init_state.initrd_size; /* ebx = initrd_size (optional ram disk - old jslinux booting) */
pc.cpu.regs[1] = cmdline_addr; /* ecx */
boot_start_time = (+new Date());
pc.start();
}
term_start();

BIN
linuxstart.bin Normal file

Binary file not shown.

BIN
root.bin Normal file

Binary file not shown.

9
term.js Normal file

File diff suppressed because one or more lines are too long

109
utils.js Normal file
View File

@ -0,0 +1,109 @@
/*
Javascript Utilities
Copyright (c) 2011-2012 Fabrice Bellard
Redistribution or commercial use is prohibited without the author's
permission.
*/
"use strict";
/* add the bind function if not present */
if (!Function.prototype.bind) {
Function.prototype.bind = function(obj) {
var slice1 = [].slice,
args = slice1.call(arguments, 1),
self = this,
nop = function () {},
bound = function () {
return self.apply( this instanceof nop ? this : ( obj || {} ),
args.concat( slice1.call(arguments) ) );
};
nop.prototype = self.prototype;
bound.prototype = new nop();
return bound;
};
}
/* include script 'filename' */
function include(filename)
{
document.write('<script type="text/javascript" src="' + filename +
'"><' + '/script>');
}
/* Load a binary data. cb(data, len) is called with data = null and
* len = -1 in case of error. Otherwise len is the length in
* bytes. data can be a string, Array or Uint8Array depending on
* the implementation. */
function load_binary(url, cb)
{
var req, typed_array, is_ie;
// console.log("load_binary: url=" + url);
req = new XMLHttpRequest();
req.open('GET', url, true);
/* completion function */
req.onreadystatechange = function() {
var err, data, len, i, buf;
if (req.readyState == 4) {
// console.log("req status=" + req.status);
if (req.status != 200 && req.status != 0) {
cb(null, -1);
} else {
if (is_ie) {
data = new VBArray(req.responseBody).toArray();
len = data.length;
cb(data, len);
} else {
if (typed_array && 'mozResponse' in req) {
/* firefox 6 beta */
data = req.mozResponse;
} else if (typed_array && req.mozResponseArrayBuffer) {
/* Firefox 4 */
data = req.mozResponseArrayBuffer;
} else if ('responseType' in req) {
/* Note: in Android 3.0 there is no typed arrays so its
returns UTF8 text */
data = req.response;
} else {
data = req.responseText;
typed_array = false;
}
if (typed_array) {
len = data.byteLength;
buf = new Uint8Array(data, 0, len);
cb(buf, len);
} else {
len = data.length;
cb(data, len);
}
}
}
}
};
is_ie = (typeof ActiveXObject == "function");
if (!is_ie) {
typed_array = ('ArrayBuffer' in window && 'Uint8Array' in window);
if (typed_array && 'mozResponseType' in req) {
/* firefox 6 beta */
req.mozResponseType = 'arraybuffer';
} else if (typed_array && 'responseType' in req) {
/* Chrome */
req.responseType = 'arraybuffer';
} else {
req.overrideMimeType('text/plain; charset=x-user-defined');
typed_array = false;
}
}
req.send(null);
}

BIN
vmlinux-2.6.20.bin Normal file

Binary file not shown.