feat(core): FILIUS' web server and web browser after Java, measured against Java
The servers share ServerAnwendung's frame (server.ts); the web server serves /webserver with virtual hosts, the browser loads a page and its images over one connection to port 80 (web.ts); HTTP in Java's text form (http.ts). WebRun records eleven stories on the new web-lan network, with the server's files; webJava.test.ts plays them card by card. A program's close is a request, as Java's schliessen. Not taken from Java: /../ serving any file of the host; an unreadable request closing the connection without a word. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -74,7 +74,7 @@
|
||||
// Java FILIUS to the topology of the original up to those departures.
|
||||
|
||||
import {
|
||||
base64Encode,
|
||||
javaBase64,
|
||||
defaultSwitchConfiguration,
|
||||
dhcpServerConfiguration,
|
||||
forwardsIPv4ByDefault,
|
||||
@@ -534,20 +534,7 @@ function fileTrees(files: VirtualFileSystem, directory: string): FlsFileTree[] {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* FILIUS's Base64.encodeBytes (iHarder Base64 2.x): a line break after every
|
||||
* 76 characters — also after the last full line — then the padded rest.
|
||||
*/
|
||||
export function javaBase64(bytes: Uint8Array): string {
|
||||
const full = bytes.length - (bytes.length % 3);
|
||||
let text = '';
|
||||
for (let offset = 0; offset < full; offset += 57) {
|
||||
const end = Math.min(offset + 57, full);
|
||||
text += base64Encode(bytes.subarray(offset, end));
|
||||
if (end - offset === 57) text += '\n';
|
||||
}
|
||||
return text + base64Encode(bytes.subarray(full));
|
||||
}
|
||||
export { javaBase64 };
|
||||
|
||||
/** "image/png" → "png", "image/jpeg" → "jpg", as Java names them. */
|
||||
function subtype(mediaType: string): string {
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
// Only the cables count: a host's SSID connects nothing at run time, as in
|
||||
// Java (Swift joins a wireless host to the switch of its SSID; not taken).
|
||||
// A DNS server runs only when it is switched on (Java: DNSServer.aktiv); an
|
||||
// echo server is there either way, switched on or off (it can be switched at
|
||||
// run time).
|
||||
// echo or web server is there either way, switched on or off (it can be
|
||||
// switched at run time). The programs read the nodes' files (a web server its
|
||||
// pages).
|
||||
|
||||
import { portSnapshot, topologySnapshot, type DnsServerConfiguration, type EchoServerSnapshot, type Id, type TopologySnapshot } from '@mdg-filius/core';
|
||||
import { portSnapshot, topologySnapshot, type DnsServerConfiguration, type EchoServerSnapshot, type Id, type WebServerSnapshot, type TopologySnapshot } from '@mdg-filius/core';
|
||||
import type { ImportedProject } from './importProject.js';
|
||||
|
||||
export function projectSnapshot(project: ImportedProject): TopologySnapshot {
|
||||
@@ -20,6 +21,11 @@ export function projectSnapshot(project: ImportedProject): TopologySnapshot {
|
||||
for (const [nodeId, configuration] of project.echoServerConfigurations) {
|
||||
echoServers.set(nodeId, { ...configuration, isActive: project.activePrograms.get(nodeId)?.has('echoServer') === true });
|
||||
}
|
||||
const webServers = new Map<Id, WebServerSnapshot>();
|
||||
for (const [nodeId, configuration] of project.webServerConfigurations) {
|
||||
webServers.set(nodeId, { ...configuration, isActive: project.activePrograms.get(nodeId)?.has('webServer') === true });
|
||||
}
|
||||
const webBrowsers = new Set([...project.installedPrograms].filter(([, programs]) => programs.has('webBrowser')).map(([nodeId]) => nodeId));
|
||||
return topologySnapshot({
|
||||
nodes: project.graph.nodes.map((node) => ({
|
||||
id: node.id,
|
||||
@@ -40,5 +46,8 @@ export function projectSnapshot(project: ImportedProject): TopologySnapshot {
|
||||
ipForwardingByNodeId: project.ipForwardingByNodeId,
|
||||
echoServersByNodeId: echoServers,
|
||||
simpleClientsByNodeId: project.simpleClientConfigurations,
|
||||
webServersByNodeId: webServers,
|
||||
webBrowserNodeIds: webBrowsers,
|
||||
fileSystemsByNodeId: project.virtualFileSystems,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user