diff --git a/docker/Dockerfile b/docker/Dockerfile
index 9d8dd4f..85118d7 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -38,6 +38,12 @@ COPY elemento-gui-new/ /usr/share/nginx/html/
COPY elemento-gui-new/electros/configs/atomosFlags.json /usr/share/nginx/html/electros/configs/flags.json
COPY elemento-gui-new/electros/electrosOnAtomos.html /usr/share/nginx/html/electros/electros.html
COPY docker/startup.sh /opt/app/startup.sh
+COPY ./docker/follow_log.sh /opt/app/follow_log.sh
+COPY ./docker/logger_stream.sh /opt/app/logger_stream.sh
+
+RUN apt update
+RUN apt install -y socat
+RUN rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
RUN chmod +x /opt/daemons/*
RUN chmod +x /opt/app/startup.sh
diff --git a/docker/arm_Dockerfile b/docker/arm_Dockerfile
index b58cb98..fe66938 100644
--- a/docker/arm_Dockerfile
+++ b/docker/arm_Dockerfile
@@ -37,7 +37,14 @@ COPY ./docker/nginx.conf /etc/nginx/nginx.conf
COPY electros-daemons/linux/arm64/* /opt/daemons/
COPY elemento-gui-new/ /usr/share/nginx/html/
COPY elemento-gui-new/electros/configs/atomosFlags.json /usr/share/nginx/html/electros/configs/flags.json
+COPY elemento-gui-new/electros/electrosOnAtomos.html /usr/share/nginx/html/electros/electros.html
COPY ./docker/arm_startup.sh /opt/app/startup.sh
+COPY ./docker/follow_log.sh /opt/app/follow_log.sh
+COPY ./docker/logger_stream.sh /opt/app/logger_stream.sh
+
+RUN apt update
+RUN apt install -y socat
+RUN rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
RUN chmod +x /opt/daemons/*
RUN chmod +x /opt/app/startup.sh
diff --git a/docker/arm_startup.sh b/docker/arm_startup.sh
index 03570a2..a127df4 100644
--- a/docker/arm_startup.sh
+++ b/docker/arm_startup.sh
@@ -30,7 +30,8 @@
# start background daemons
#/opt/daemons/Elemento_Daemons_linux_x86 > /var/log/elemento/elemento_daemons.log 2>&1 &
-/opt/daemons/Elemento_Daemons_linux_arm >/var/log/elemento/elemento_daemons.log 2>&1 &
+/opt/daemons/elemento_daemons_linux_arm >/var/log/elemento/elemento_daemons.log 2>&1 &
+/opt/app/logger_stream.sh >/dev/null &
# run the project
diff --git a/docker/follow_log.sh b/docker/follow_log.sh
new file mode 100755
index 0000000..2072706
--- /dev/null
+++ b/docker/follow_log.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+LOG_FILE=/var/log/elemento/elemento_daemons.log
+
+trap '' PIPE
+
+# Read and discard HTTP request headers
+while IFS= read -r line; do
+ [ "$line" = $'\r' ] && break
+done
+
+# Send HTTP headers
+printf "HTTP/1.1 200 OK\r\n"
+printf "Content-Type: text/plain\r\n"
+printf "Transfer-Encoding: chunked\r\n"
+printf "Cache-Control: no-cache\r\n"
+printf "Connection: keep-alive\r\n"
+printf "\r\n"
+
+# Send last 1000 lines
+tail -n 1000 "$LOG_FILE" | while IFS= read line; do
+ chunk="${line}\n"
+ len=$(printf "%s" "$chunk" | wc -c)
+ printf "%x\r\n%s\r\n" "$len" "$chunk" || break
+done
+
+# Follow file
+# shellcheck disable=SC2162
+tail -n 0 -F "$LOG_FILE" | while IFS= read line; do
+ chunk="${line}\n"
+ len=$(printf "%s" "$chunk" | wc -c)
+ printf "%x\r\n%s\r\n" "$len" "$chunk" || break
+done
+
+
diff --git a/docker/logger_stream.sh b/docker/logger_stream.sh
new file mode 100755
index 0000000..2ff3e4f
--- /dev/null
+++ b/docker/logger_stream.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+PORT=5142
+
+socat TCP-LISTEN:"$PORT",reuseaddr,fork SYSTEM:'bash -c /opt/app/follow_log.sh'
diff --git a/docker/nginx.conf b/docker/nginx.conf
index 6b8e5e5..dde8139 100644
--- a/docker/nginx.conf
+++ b/docker/nginx.conf
@@ -99,60 +99,118 @@ http {
# Daemon statuses handlers
location /authStatus {
proxy_pass $authenticate/;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
}
location /computeStatus {
proxy_pass $compute/;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
}
location /storageStatus {
proxy_pass $storage/;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
}
location /networksStatus {
proxy_pass $network/;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
}
location /servicesStatus {
proxy_pass $services/;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
}
location /targetsStatus {
proxy_pass $targets/;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
}
# Daemon handlers
location /api/v1/authenticate/ {
proxy_pass $authenticate;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
}
location /api/v1.0/client/backups/ {
proxy_pass $compute;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
}
location /api/v1.0/client/vm/ {
proxy_pass $compute;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
}
# special case for network attach/detach for a VM
location ~ ^/api/v1.0/client/network/(attach|detach) {
proxy_pass $compute;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
}
location /api/v1.0/client/volume/ {
proxy_pass $storage;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
}
location /api/v1.0/client/network/ {
proxy_pass $network;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
}
location /api/v1.0/service/ {
proxy_pass $services;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
}
location /api/v1.0/client/target/ {
proxy_pass $targets;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
+ }
+
+ # WebSocket passthrough
+ location ~ ^/api/v1.0/client/vnc/(.*)$ {
+ proxy_pass http://127.0.0.1:$1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Port $server_port;
+ }
+
+ location /api/logs {
+ proxy_pass http://localhost:5142;
+ proxy_buffering off;
+ proxy_cache off;
}
}
}
diff --git a/docker/startup.sh b/docker/startup.sh
index 02581b5..9a4ec08 100644
--- a/docker/startup.sh
+++ b/docker/startup.sh
@@ -28,6 +28,7 @@
# start background daemons
/opt/daemons/elemento_daemons_linux_x86 >/var/log/elemento/elemento_daemons.log 2>&1 &
+/opt/app/logger_stream.sh >/dev/null &
# run the project
diff --git a/electros-eel/.gitignore b/electros-eel/.gitignore
deleted file mode 100644
index 8fa5b33..0000000
--- a/electros-eel/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-env
\ No newline at end of file
diff --git a/electros-eel/electros.py b/electros-eel/electros.py
deleted file mode 100644
index a308806..0000000
--- a/electros-eel/electros.py
+++ /dev/null
@@ -1,95 +0,0 @@
-import eel
-import requests
-import os
-import json
-
-# Set web files folder
-eel.init('electros')
-
-def read_configurations():
- config_path = os.path.join(os.path.expanduser('~'), '.elemento', 'settings')
- hosts_path = os.path.join(os.path.expanduser('~'), '.elemento', 'hosts')
-
- config = {}
- hosts = []
-
- # Read settings
- if os.path.exists(config_path):
- try:
- with open(config_path, 'r') as f:
- config = json.load(f)
- except json.JSONDecodeError:
- print(f"Error: Invalid JSON in {config_path}")
- except IOError:
- print(f"Error: Unable to read {config_path}")
-
- # Read hosts
- if os.path.exists(hosts_path):
- try:
- with open(hosts_path, 'r') as f:
- hosts = f.read().splitlines()
- except IOError:
- print(f"Error: Unable to read {hosts_path}")
-
- return config, hosts
-
-@eel.expose
-def get_configurations():
- config, hosts = read_configurations()
- return {'config': config, 'hosts': hosts}
-
-@eel.expose
-def modify_configurations(new_config, new_hosts):
-
- print('New Config:', new_config)
- print('New Hosts:', new_hosts)
-
- config_path = os.path.join(os.path.expanduser('~'), '.elemento', 'settings')
- hosts_path = os.path.join(os.path.expanduser('~'), '.elemento', 'hosts')
-
- # Update and save settings
- try:
- with open(config_path, 'w') as f:
- json.dump(new_config, f, indent=4)
- except IOError:
- print(f"Error: Unable to write to {config_path}")
- return False
-
- # Update and save hosts
- try:
- with open(hosts_path, 'w') as f:
- f.write('\n'.join(new_hosts))
- except IOError:
- print(f"Error: Unable to write to {hosts_path}")
- return False
-
- return True
-
-@eel.expose
-def update_configurations(config_updates, hosts_updates):
- current_config, current_hosts = read_configurations()
-
- # Update config
- current_config.update(config_updates)
-
- # Update hosts
- current_hosts = list(set(current_hosts + hosts_updates))
-
- print('Current Config:', current_config)
- print('Current Hosts:', current_hosts)
-
- # Save the updated configurations
- return modify_configurations(current_config, current_hosts)
-
-# Start the app with custom mode and flags
-eel.start(
- 'electros.html',
- size=(800, 600),
- mode='kiosk', # or 'chrome-app' if you prefer
- port=8888, # Use any available port
- cmdline_args=[
- '--disable-gpu',
- '--disable-dev-shm-usage',
- '--disable-frame-rate-limit'
- ]
-)
\ No newline at end of file
diff --git a/electros-eel/index.html b/electros-eel/index.html
deleted file mode 100644
index a00daaa..0000000
--- a/electros-eel/index.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
- Redirecting...
-
-
- If you are not redirected automatically, click here.
-
-
diff --git a/electros-eel/requirements.txt b/electros-eel/requirements.txt
deleted file mode 100644
index 9a38173..0000000
--- a/electros-eel/requirements.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-eel
-requests
diff --git a/electros-eel/setup.sh b/electros-eel/setup.sh
deleted file mode 100755
index 11b3fba..0000000
--- a/electros-eel/setup.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#! /bin/bash
-
-# Create and activate virtual environment
-python3 -m venv env
-source env/bin/activate
-
-# Install requirements
-pip install --upgrade pip
-pip install -r requirements.txt
-deactivate
diff --git a/electros-eel/start.sh b/electros-eel/start.sh
deleted file mode 100755
index c6b0450..0000000
--- a/electros-eel/start.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /bin/bash
-
-# Activate virtual environment
-source env/bin/activate
-
-# Run the project
-python3 electros.py
-
-deactivate
diff --git a/electros-electron/common/Daemons.js b/electros-electron/common/Daemons.js
index 75de9ae..92ec4b8 100644
--- a/electros-electron/common/Daemons.js
+++ b/electros-electron/common/Daemons.js
@@ -22,13 +22,13 @@ export class Daemons {
static Launch(platform, __dirname) {
if (app.commandLine.hasSwitch("no-daemons")) {
console.log("Daemons have been disabled by `--no-daemons`");
- Terminal.Write("Elemento Client Daemons have been disabled by `--no-daemons`.");
+ Terminal.Write("[INFO] Elemento Client Daemons have been disabled by `--no-daemons`.");
throw new DaemonsNotEnabledError();
}
if (!app.isPackaged) {
- Terminal.Write("Electros is not packaged. Daemons might have to be manually started.")
- console.log("Electros is not packaged. Daemons might have to be manually started.")
+ Terminal.Write("[WARNING] Electros is not packaged. Daemons might have to be manually started.")
+ console.warn("Electros is not packaged. Daemons might have to be manually started.")
}
const execPath = Daemons._GetCommand(platform, __dirname);
diff --git a/electros-electron/main.js b/electros-electron/main.js
index e1e531a..2978b9f 100644
--- a/electros-electron/main.js
+++ b/electros-electron/main.js
@@ -1,6 +1,6 @@
const {app, BrowserWindow, ipcMain, Menu, nativeTheme, shell, safeStorage} = require('electron');
-app.commandLine.appendSwitch('disable-zoom-level-persistence');
+app.commandLine.appendSwitch('force-device-scale-factor', '1');
const path = require('path');
const {spawn} = require('child_process');
const net = require('net');
@@ -447,3 +447,10 @@ ipcMain.handle("safestorage-decrypt", async (event, { value }) => {
return safeStorage.decryptString(value)
});
+
+ipcMain.handle("app-version", () => {
+ return {
+ version: app.getVersion(),
+ node: process.versions
+ };
+});
diff --git a/electros-electron/package.json b/electros-electron/package.json
index c4c7a61..233017e 100644
--- a/electros-electron/package.json
+++ b/electros-electron/package.json
@@ -133,7 +133,8 @@
},
"dependencies": {
"@xterm/addon-fit": "latest",
- "@xterm/xterm": "^5.5.0",
+ "@xterm/addon-webgl": "^0.19.0",
+ "@xterm/xterm": "^6.0.0",
"cors": "^2.8.5",
"express": "^4.21.2",
"socket.io": "^4.8.1",
diff --git a/electros-electron/preload.js b/electros-electron/preload.js
index 658beab..a4cc989 100644
--- a/electros-electron/preload.js
+++ b/electros-electron/preload.js
@@ -19,7 +19,10 @@ contextBridge.exposeInMainWorld('electron', {
'os-prefers-dark-theme',
'os-prefers-reduced-transparency',
'open-browser',
- 'open-dot-config'
+ 'open-dot-config',
+ 'app-version',
+ 'safestorage-encrypt',
+ 'safestorage-decrypt'
];
if (validChannels.includes(channel)) {
return ipcRenderer.invoke(channel, ...args);
diff --git a/electros-electron/terminal/terminal.html b/electros-electron/terminal/terminal.html
index cc6d71d..91d7998 100644
--- a/electros-electron/terminal/terminal.html
+++ b/electros-electron/terminal/terminal.html
@@ -2,21 +2,37 @@
-
-
-
-
-
-
-
Ultralight v1.3.0 Release Notes
-
-
Changelog
-
Major Improvements
-
- - Rewrite CPU renderer to be faster and more accurate (parallel engine built on Skia internals).
- - Add support for Xbox, PS4, and PS5 platforms.
- - Improve text rendering accuracy with more intelligent snapping and hinting.
- - Improve font scaling accuracy at various device scales.
- - Improve box-shadow rendering accuracy and performance.
- - Improve performance of layout and JavaScript execution using mimalloc.
- - Improve performance of JavaScript garbage-collector, reduce per-frame stalls.
- - Improve consistency of CPU and GPU renderers (both now blend in sRGB).
- - Add memory profiler and memory statistics tracking.
- - Add support for gamepad input devices.
- - Add support for remote web inspector.
- - Add support for multiple windows to AppCore.
- - Add support for rendering only a subset of Views.
- - Add support for dashed strokes to CPU renderer.
- - Add support for SVG onclick and other events that require path picking.
- - Add support for HTML5 Video / Audio (experimental) via GStreamer/FFmpeg (disabled by default).
- - Update user-agent string to reflect proper Safari / WebKit version.
- - Update to latest CA certificate chain.
- - Unify build scripts and toolchain.
-
-
Major API Changes
-
- - Unify API to use RefPtr<> everywhere (instead of Ref<> class)
- - Unify API to use String everywhere (instead of String16, String8, etc.).
- - Make String class use String8 natively (utf-8 is now native representation instead of utf-16).
- - Make all enums use 'enum class'
- - Resources now load via FileSystem API instead of fopen().
- - FileSystem now required to be defined in Platform API before creating Renderer.
- - Buffer class now accomodates memory-mapped files and destruction callbacks.
- - FileSystem interface has been reorganized to use new Buffer API.
- - Portions of Config have been moved to ViewConfig (now certain options can be set per-View).
- - App::Quit() must now be called manually when using AppCore API.
- - Add Bitmap::LockPixelsSafe() and LockedPixels<> utility class to manage lifetimes.
- - Add WebKitVersionString() to query corresponding WebKit version.
- - Extend AppCore API to enable multi-window support.
- - Re-organize C API into logical header files.
- - Add Renderer::StartRemoteInspectorServer
- - Add Renderer::SetGamepadDetails
- - Add Renderer::FireGamepadEvent
- - Add Renderer::FireGamepadAxisEvent
- - Add Renderer::FireGamepadButtonEvent
- - Add Renderer::RenderOnly
- - Modify Renderer::CreateView signature (options moved to ViewConfig param)
- - Add View::device_scale
- - Add View::set_device_scale
- - Add View::is_accelerated
- - Add View::is_transparent
- - Add View::JavaScriptVM
- - Rename View::inspector to View::CreateLocalInspectorView
- - Modify View::LockJSContext return value (now returns RefPtr<> to manage lifetime)
- - Add ViewListener::OnCreateInspectorView
- - Add ViewListener::OnRequestClose
- - Add WindowListener::OnKeyEvent
- - Add WindowListener::OnMouseEvent
- - Add WindowListener::OnScrollEvent
-
-
Major Bugfixes
-
- - Fix issue managing clip in CPU and GPU renderers.
- - Fix issue blending alpha in CPU renderer.
- - Fix issue stroking paths in CPU renderer.
- - Fix issue drawing glyphs with complex transformations.
- - Fix issue drawing radial gradients with CPU renderer.
- - Fix issue drawing gradients with more than 12 stops.
- - Fix issue running library off the main thread on macOS.
- - Fix issue rendering paths that begin with an ArcTo command.
- - Fix issue where BGRA byte order was not used on all platforms.
- - Fix issue painting dropdown menus.
- - Fix issue calculating CSS button height.
- - Fix issue displaying box-shadows on native inputs.
- - Fix issue displaying context-menu in web inspector.
- - Fix issue writing LocalStorage database on Windows.
- - Fix issue with KeyboardEvent.key in JavaScript always returning null.
- - Fix issue with LoadListener::OnBeginLoading not passing correct URL.
- - Fix issue with LoadListener::OnFailLoading not being fired on non-200 HTTP status codes.
- - Fix issue resizing windows with GPU acceleration enabled (AppCore).
- - Fix issue calling Window::SetTitle with Unicode strings (AppCore).
- - Fix issue with anti-aliasing when GPU acceleration is enabled on Linux (AppCore).
- - Fix issue with automatic DPI switching on Windows (AppCore).
- - Fix security issue allocating very large render layers.
- - Fix major performance bug in cURL network code.
- - Fix memory leak loading certain File URLs.
- - Fix memory leak when constructing JSString from JSStringRef (AppCore).
- - Fix various crashes and buffer overruns in Bitmap class.
- - Fix crash loading certain Data URLs.
- - Fix crash when Config::bitmap_alignment is 0.
- - Fix crash when encountering certain text-encodings.
- - Fix crash when encountering certain JavaScript code.
- - Fix crash in SQLite database code.
- - Fix crash at process shutdown.
-
-
-
-
-
-
Useful Links
-
- - Website
- - ultralig.ht
- - Support Docs
- - docs.ultralig.ht
- - C++ API
- - github.com/ultralight-ux/Ultralight-API
-
-
-
-
-
- Ultralight Team
-
-
-
-
\ No newline at end of file
diff --git a/electros-ultralight/archive/browser/assets/requirements.txt b/electros-ultralight/archive/browser/assets/requirements.txt
deleted file mode 100644
index 9a38173..0000000
--- a/electros-ultralight/archive/browser/assets/requirements.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-eel
-requests
diff --git a/electros-ultralight/archive/browser/assets/spinner.svg b/electros-ultralight/archive/browser/assets/spinner.svg
deleted file mode 100644
index 466ff9c..0000000
--- a/electros-ultralight/archive/browser/assets/spinner.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-
diff --git a/electros-ultralight/archive/browser/assets/ui.css b/electros-ultralight/archive/browser/assets/ui.css
deleted file mode 100644
index cb85cff..0000000
--- a/electros-ultralight/archive/browser/assets/ui.css
+++ /dev/null
@@ -1,73 +0,0 @@
-* {
- overflow: hidden;
- user-select: none;
- -webkit-user-select: none;
-}
-
-body {
- margin: 0;
- padding: 0;
- font-family: "Segoe UI", -apple-system, Ubuntu, Arial, sans-serif;
- font-size: 14px;
- background: #16151d;
- color: #c4c2d0;
-}
-
-#bar {
- background: #232330;
- background: linear-gradient(0deg, #232330, #282836);
- height: 32px;
- padding: 4px 9px;
- border-bottom: 0.8px solid #252532;
- cursor: default;
- display: flex;
-}
-
-#address {
- border-radius: 24px;
- border: none;
- height: 32px;
- flex: 1;
- font-size: 14px;
- color: #c4c2d0;
- background-color: #16151d;
- display: inline-block;
- padding: 2px 16px 2px 16px;
- margin-top: 0px;
- margin-left: 9px;
- margin-right: 9px;
- user-select: auto !important;
- -webkit-user-select: text !important;
-}
-
-#address:focus {
- background-color: #16151d;
- color: #FFF;
-}
-
-.icon {
- cursor: default;
- fill: rgba(200, 200, 200, 1.0);
- vertical-align: top;
- margin-top: -1px;
- padding: 5px;
- height: 22px;
-}
-
-#back {
- margin-left: 0px;
-}
-
-.icon.disabled {
-
- fill: rgb(99 96 116);
-}
-
-svg#icon_defs path {
- fill: inherit;
-}
-
-.icon:not(.disabled):hover {
- background-color: #343446;
- border-radius: 100%;
-}
\ No newline at end of file
diff --git a/electros-ultralight/archive/browser/assets/ui.html b/electros-ultralight/archive/browser/assets/ui.html
deleted file mode 100644
index 6cf0f60..0000000
--- a/electros-ultralight/archive/browser/assets/ui.html
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/electros-ultralight/archive/browser/assets/ui.js b/electros-ultralight/archive/browser/assets/ui.js
deleted file mode 100644
index fa77f8e..0000000
--- a/electros-ultralight/archive/browser/assets/ui.js
+++ /dev/null
@@ -1,27 +0,0 @@
-function updateBack(enable) {
- if (enable)
- document.getElementById("back").classList.remove("disabled");
- else
- document.getElementById("back").classList.add("disabled");
-}
-
-function updateForward(enable) {
- if (enable)
- document.getElementById("forward").classList.remove("disabled");
- else
- document.getElementById("forward").classList.add("disabled");
-}
-
-function updateLoading(is_loading) {
- if (is_loading) {
- document.getElementById("refresh").style.display = "none";
- document.getElementById("stop").style.display = "inline-block";
- } else {
- document.getElementById("refresh").style.display = "inline-block";
- document.getElementById("stop").style.display = "none";
- }
-}
-
-function updateURL(url) {
- document.getElementById('address').value = url;
-}
\ No newline at end of file
diff --git a/electros-ultralight/archive/browser/cmake/Electros.cmake b/electros-ultralight/archive/browser/cmake/Electros.cmake
deleted file mode 100644
index 2bf6dbb..0000000
--- a/electros-ultralight/archive/browser/cmake/Electros.cmake
+++ /dev/null
@@ -1,122 +0,0 @@
-set(CMAKE_CXX_STANDARD 11)
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
-include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
-
-set(SDK_ROOT "${CMAKE_BINARY_DIR}/SDK/")
-set(ULTRALIGHT_INCLUDE_DIR "${SDK_ROOT}/include")
-set(ULTRALIGHT_BINARY_DIR "${SDK_ROOT}/bin")
-set(ULTRALIGHT_RESOURCES_DIR "${SDK_ROOT}/resources")
-set(ULTRALIGHT_INSPECTOR_DIR "${SDK_ROOT}/inspector")
-
-if (NOT PLATFORM)
- if (UNIX)
- if (APPLE)
- set(PORT UltralightMac)
- set(PLATFORM "mac")
- set(ULTRALIGHT_LIBRARY_DIR "${SDK_ROOT}/bin")
- else ()
- set(PORT UltralightLinux)
- set(PLATFORM "linux")
- set(ULTRALIGHT_LIBRARY_DIR "${SDK_ROOT}/bin")
- endif ()
- elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
- set(PORT UltralightWin)
- set(PLATFORM "win")
- set(ULTRALIGHT_LIBRARY_DIR "${SDK_ROOT}/lib")
- else ()
- message(FATAL_ERROR "Unknown OS '${CMAKE_SYSTEM_NAME}'")
- endif ()
-else ()
- if (PLATFORM MATCHES "mac")
- set(PORT UltralightMac)
- set(ULTRALIGHT_LIBRARY_DIR "${SDK_ROOT}/bin")
- elseif (PLATFORM MATCHES "linux")
- set(PORT UltralightLinux)
- set(ULTRALIGHT_LIBRARY_DIR "${SDK_ROOT}/bin")
- elseif (PLATFORM MATCHES "win")
- set(PORT UltralightWin)
- set(ULTRALIGHT_LIBRARY_DIR "${SDK_ROOT}/lib")
- else ()
- message(FATAL_ERROR "Unknown platform '${PLATFORM}'")
- endif ()
-endif ()
-
-if (NOT ARCHITECTURE)
- set(ARCHITECTURE "arm64")
-endif()
-
-if(NOT VERSION)
- set(VERSION "1.4.0b")
-endif()
-
-if(NOT BASE_URL)
- set(BASE_URL "ultralight-files.sfo3.cdn.digitaloceanspaces.com")
-endif()
-
-ExternalProject_Add(UltralightSDK
- URL https://${BASE_URL}/ultralight-sdk-${VERSION}-${PLATFORM}-${ARCHITECTURE}.7z
- SOURCE_DIR "${SDK_ROOT}"
- BUILD_IN_SOURCE 1
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ""
-)
-
-MACRO(ADD_APP source_list)
- set(APP_NAME ${CMAKE_PROJECT_NAME})
-
- include_directories("${ULTRALIGHT_INCLUDE_DIR}")
- link_directories("${ULTRALIGHT_LIBRARY_DIR}")
- link_libraries(UltralightCore AppCore Ultralight WebCore)
-
- if (PORT MATCHES "UltralightLinux")
- SET(CMAKE_SKIP_BUILD_RPATH FALSE)
- SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
- SET(CMAKE_INSTALL_RPATH "$\{ORIGIN\}")
- endif ()
-
- if (PORT MATCHES "UltralightMac")
- SET(CMAKE_SKIP_BUILD_RPATH FALSE)
- SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
- SET(CMAKE_INSTALL_RPATH "@executable_path/")
- endif ()
-
- add_executable(${APP_NAME} WIN32 MACOSX_BUNDLE ${source_list})
-
- if (APPLE)
- # Enable High-DPI on macOS through our custom Info.plist template
- set_target_properties(${APP_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Info.plist.in)
- endif()
-
- if (MSVC)
- # Tell MSVC to use main instead of WinMain for Windows subsystem executables
- set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup")
- endif()
-
- # Copy all binaries to target directory
- add_custom_command(TARGET ${APP_NAME} POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_directory "${ULTRALIGHT_BINARY_DIR}" $)
-
- # Set the assets path to "/assets" or "/../Resources/assets" on macOS
- if (APPLE)
- set(ASSETS_PATH "$/../Resources/assets")
- else ()
- set(ASSETS_PATH "$/assets")
- endif ()
-
- # Copy assets to assets path
- add_custom_command(TARGET ${APP_NAME} POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/assets/" "${ASSETS_PATH}")
-
- if(${ENABLE_INSPECTOR})
- # Copy inspector to assets directory
- add_custom_command(TARGET ${APP_NAME} POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_directory "${ULTRALIGHT_INSPECTOR_DIR}" "${ASSETS_PATH}/inspector")
- endif ()
-
- # Copy resources to assets directory
- add_custom_command(TARGET ${APP_NAME} POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy_directory "${ULTRALIGHT_RESOURCES_DIR}" "${ASSETS_PATH}/resources")
-
- add_dependencies(${APP_NAME} UltralightSDK)
-ENDMACRO()
\ No newline at end of file
diff --git a/electros-ultralight/archive/browser/cmake/Info.plist.in b/electros-ultralight/archive/browser/cmake/Info.plist.in
deleted file mode 100644
index b782d3b..0000000
--- a/electros-ultralight/archive/browser/cmake/Info.plist.in
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- English
- CFBundleExecutable
- ${MACOSX_BUNDLE_EXECUTABLE_NAME}
- CFBundleGetInfoString
- ${MACOSX_BUNDLE_INFO_STRING}
- CFBundleIconFile
- ${MACOSX_BUNDLE_ICON_FILE}
- CFBundleIdentifier
- ${MACOSX_BUNDLE_GUI_IDENTIFIER}
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleLongVersionString
- ${MACOSX_BUNDLE_LONG_VERSION_STRING}
- CFBundleName
- ${MACOSX_BUNDLE_BUNDLE_NAME}
- CFBundlePackageType
- APPL
- CFBundleShortVersionString
- ${MACOSX_BUNDLE_SHORT_VERSION_STRING}
- CFBundleSignature
- ????
- CFBundleVersion
- ${MACOSX_BUNDLE_BUNDLE_VERSION}
- CSResourcesFileMapped
-
- NSHumanReadableCopyright
- ${MACOSX_BUNDLE_COPYRIGHT}
- NSHighResolutionCapable
- true
-
-
diff --git a/electros-ultralight/archive/browser/src/Browser.cpp b/electros-ultralight/archive/browser/src/Browser.cpp
deleted file mode 100644
index bc7069c..0000000
--- a/electros-ultralight/archive/browser/src/Browser.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "Browser.h"
-#include
-#include
-#include
-
-Browser::Browser() {
- Settings settings;
- Config config;
- config.scroll_timer_delay = 1.0 / 90.0;
- app_ = App::Create(settings, config);
-
- window_ = Window::Create(app_->main_monitor(), 1800, 1200, false,
- kWindowFlags_Resizable | kWindowFlags_Titled | kWindowFlags_Maximizable);
- window_->SetTitle("Elemento Electros");
-
- // Create the UI
- ui_.reset(new UI(window_));
- window_->set_listener(ui_.get());
-}
-
-Browser::~Browser() {
- window_->set_listener(nullptr);
-
- ui_.reset();
-
- window_ = nullptr;
- app_ = nullptr;
-}
-
-void Browser::Run() {
- app_->Run();
-}
diff --git a/electros-ultralight/archive/browser/src/Browser.h b/electros-ultralight/archive/browser/src/Browser.h
deleted file mode 100644
index 8b23e14..0000000
--- a/electros-ultralight/archive/browser/src/Browser.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#include
-#include "UI.h"
-
-using namespace ultralight;
-
-class Browser {
-public:
- Browser();
- virtual ~Browser();
-
- virtual void Run();
-
-protected:
- RefPtr app_;
- RefPtr window_;
- std::unique_ptr ui_;
-};
diff --git a/electros-ultralight/archive/browser/src/Tab.cpp b/electros-ultralight/archive/browser/src/Tab.cpp
deleted file mode 100644
index 2a3c8f7..0000000
--- a/electros-ultralight/archive/browser/src/Tab.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-#include "Tab.h"
-#include "UI.h"
-#include
-#include
-
-#define INSPECTOR_DRAG_HANDLE_HEIGHT 10
-
-Tab::Tab(UI* ui, uint64_t id, uint32_t width, uint32_t height, int x, int y)
- : ui_(ui), id_(id), container_width_(width), container_height_(height) {
- overlay_ = Overlay::Create(ui->window_, width, height, x, y);
- view()->set_view_listener(this);
- view()->set_load_listener(this);
-}
-
-Tab::~Tab() {
- view()->set_view_listener(nullptr);
- view()->set_load_listener(nullptr);
-}
-
-void Tab::Show() {
- overlay_->Show();
- overlay_->Focus();
-
- if (inspector_overlay_)
- inspector_overlay_->Show();
-}
-
-void Tab::Hide() {
- overlay_->Hide();
- overlay_->Unfocus();
-
- if (inspector_overlay_)
- inspector_overlay_->Hide();
-}
-
-void Tab::ToggleInspector() {
- if (!inspector_overlay_) {
- view()->CreateLocalInspectorView();
- } else {
- if (inspector_overlay_->is_hidden()) {
- inspector_overlay_->Show();
- } else {
- inspector_overlay_->Hide();
- }
- }
-
- // Force resize to update layout
-}
-
-
-bool Tab::IsInspectorShowing() const {
- if (!inspector_overlay_)
- return false;
-
- return !inspector_overlay_->is_hidden();
-}
-
-IntRect Tab::GetInspectorResizeDragHandle() const {
- if (!IsInspectorShowing())
- return IntRect::MakeEmpty();
-
- int drag_handle_height_px = (uint32_t)std::round(INSPECTOR_DRAG_HANDLE_HEIGHT * ui_->window()->scale());
-
- // This drag handle should span the width of the UI and be centered vertically at the boundary between
- // the page overlay and inspector overlay.
-
- int drag_handle_x = (int)inspector_overlay_->x();
- int drag_handle_y = (int)inspector_overlay_->y() - drag_handle_height_px / 2;
-
- return { drag_handle_x, drag_handle_y, drag_handle_x + (int)inspector_overlay_->width(),
- drag_handle_y + drag_handle_height_px };
-}
-
-int Tab::GetInspectorHeight() const {
- if (inspector_overlay_)
- return inspector_overlay_->height();
-
- return 0;
-}
-
-void Tab::SetInspectorHeight(int height) {
- if (height > 2) {
- inspector_overlay_->Resize(inspector_overlay_->width(), height);
-
- // Trigger a resize to perform re-layout / re-size of content overlay
- Resize(container_width_, container_height_);
- }
-}
-
-void Tab::Resize(uint32_t width, uint32_t height) {
- container_width_ = width;
- container_height_ = height;
-
- uint32_t content_height = container_height_;
- if (inspector_overlay_ && !inspector_overlay_->is_hidden()) {
- content_height -= inspector_overlay_->height();
- }
-
- if (content_height < 1)
- content_height = 1;
-
- overlay_->Resize(container_width_, content_height);
-
- if (inspector_overlay_ && !inspector_overlay_->is_hidden()) {
- inspector_overlay_->MoveTo(0, overlay_->y() + overlay_->height());
- inspector_overlay_->Resize(container_width_, inspector_overlay_->height());
- }
-}
-
-void Tab::OnChangeTitle(View* caller, const String& title) {
- ui_->UpdateTabTitle(id_, title);
-}
-
-void Tab::OnChangeURL(View* caller, const String& url) {
- ui_->UpdateTabURL(id_, url);
-}
-
-void Tab::OnChangeTooltip(View* caller, const String& tooltip) {}
-
-void Tab::OnChangeCursor(View* caller, Cursor cursor) {
- if (id_ == ui_->active_tab_id_)
- ui_->SetCursor(cursor);
-}
-
-void Tab::OnAddConsoleMessage(View* caller, const ConsoleMessage& msg) {
-}
-
-RefPtr Tab::OnCreateChildView(ultralight::View* caller,
- const String& opener_url, const String& target_url,
- bool is_popup, const IntRect& popup_rect) {
- return ui_->CreateNewTabForChildView(target_url);
-}
-
-RefPtr Tab::OnCreateInspectorView(ultralight::View* caller, bool is_local,
- const String& inspected_url) {
- if (inspector_overlay_)
- return nullptr;
-
- inspector_overlay_ = Overlay::Create(ui_->window_, container_width_, container_height_ / 2, 0, 0);
-
- // Force resize to update layout
- Resize(container_width_, container_height_);
- inspector_overlay_->Show();
-
- return inspector_overlay_->view();
-}
-
-void Tab::OnBeginLoading(View* caller, uint64_t frame_id, bool is_main_frame, const String& url) {
- ui_->UpdateTabNavigation(id_, caller->is_loading(), caller->CanGoBack(), caller->CanGoForward());
-}
-
-void Tab::OnFinishLoading(View* caller, uint64_t frame_id, bool is_main_frame, const String& url) {
- ui_->UpdateTabNavigation(id_, caller->is_loading(), caller->CanGoBack(), caller->CanGoForward());
-}
-
-void Tab::OnFailLoading(View* caller, uint64_t frame_id, bool is_main_frame, const String& url,
- const String& description, const String& error_domain, int error_code) {
- if (is_main_frame) {
- char error_code_str[16];
- sprintf(error_code_str,"%d", error_code);
-
- String html_string = "";
- html_string += "A Network Error was Encountered
";
- html_string += "";
- html_string += "- URL
- " + url + "
";
- html_string += "- Description
- " + description + "
";
- html_string += "- Error Domain
- " + error_domain + "
";
- html_string += "- Error Code
- " + String(error_code_str) + "
";
- html_string += "
";
-
- view()->LoadHTML(html_string);
- }
-}
-
-void Tab::OnUpdateHistory(View* caller) {
- ui_->UpdateTabNavigation(id_, caller->is_loading(), caller->CanGoBack(), caller->CanGoForward());
-}
diff --git a/electros-ultralight/archive/browser/src/Tab.h b/electros-ultralight/archive/browser/src/Tab.h
deleted file mode 100644
index 9e4b66c..0000000
--- a/electros-ultralight/archive/browser/src/Tab.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#pragma once
-#include
-#include
-
-class UI;
-using namespace ultralight;
-
-/**
-* Browser Tab UI implementation. Renders the actual page content in bottom pane.
-*/
-class Tab : public ViewListener,
- public LoadListener {
-public:
- Tab(UI* ui, uint64_t id, uint32_t width, uint32_t height, int x, int y);
- ~Tab();
-
- void set_ready_to_close(bool ready) { ready_to_close_ = ready; }
- bool ready_to_close() { return ready_to_close_; }
-
- RefPtr view() { return overlay_->view(); }
-
- void Show();
-
- void Hide();
-
- void ToggleInspector();
-
- bool IsInspectorShowing() const;
-
- IntRect GetInspectorResizeDragHandle() const;
-
- int GetInspectorHeight() const;
-
- void SetInspectorHeight(int height);
-
- void Resize(uint32_t width, uint32_t height);
-
- // Inherited from Listener::View
- virtual void OnChangeTitle(View* caller, const String& title) override;
- virtual void OnChangeURL(View* caller, const String& url) override;
- virtual void OnChangeTooltip(View* caller, const String& tooltip) override;
- virtual void OnChangeCursor(View* caller, Cursor cursor) override;
- virtual void OnAddConsoleMessage(View* caller, const ConsoleMessage& msg) override;
- virtual RefPtr OnCreateChildView(ultralight::View* caller,
- const String& opener_url, const String& target_url,
- bool is_popup, const IntRect& popup_rect) override;
- virtual RefPtr OnCreateInspectorView(ultralight::View* caller, bool is_local,
- const String& inspected_url) override;
-
- // Inherited from Listener::Load
- virtual void OnBeginLoading(View* caller, uint64_t frame_id,
- bool is_main_frame, const String& url) override;
- virtual void OnFinishLoading(View* caller, uint64_t frame_id,
- bool is_main_frame, const String& url) override;
- virtual void OnFailLoading(View* caller, uint64_t frame_id,
- bool is_main_frame, const String& url, const String& description,
- const String& error_domain, int error_code) override;
- virtual void OnUpdateHistory(View* caller) override;
-
-protected:
- UI* ui_;
- RefPtr overlay_;
- RefPtr inspector_overlay_;
- uint64_t id_;
- bool ready_to_close_ = false;
- uint32_t container_width_, container_height_;
-};
diff --git a/electros-ultralight/archive/browser/src/UI.cpp b/electros-ultralight/archive/browser/src/UI.cpp
deleted file mode 100644
index 9da970e..0000000
--- a/electros-ultralight/archive/browser/src/UI.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-#include "UI.h"
-
-static UI* g_ui = 0;
-
-#define UI_HEIGHT 80
-
-UI::UI(RefPtr window) : window_(window), cur_cursor_(Cursor::kCursor_Pointer),
-is_resizing_inspector_(false), is_over_inspector_resize_drag_handle_(false) {
- uint32_t window_width = window_->width();
- ui_height_ = (uint32_t)std::round(UI_HEIGHT * window_->scale());
- overlay_ = Overlay::Create(window_, window_width, ui_height_, 0, 0);
- g_ui = this;
-
- view()->set_load_listener(this);
- view()->set_view_listener(this);
- view()->LoadURL("file:///ui.html");
-}
-
-UI::~UI() {
- view()->set_load_listener(nullptr);
- view()->set_view_listener(nullptr);
- g_ui = nullptr;
-}
-
-bool UI::OnKeyEvent(const ultralight::KeyEvent& evt) {
- return true;
-}
-
-bool UI::OnMouseEvent(const ultralight::MouseEvent& evt) {
- if (active_tab() && active_tab()->IsInspectorShowing()) {
- float x_px = std::round(evt.x * window()->scale());
- float y_px = std::round(evt.y * window()->scale());
-
- if (is_resizing_inspector_) {
- int resize_delta = inspector_resize_begin_mouse_y_ - y_px;
- int new_inspector_height = inspector_resize_begin_height_ + resize_delta;
- active_tab()->SetInspectorHeight(new_inspector_height);
-
- if (evt.type == MouseEvent::kType_MouseUp) {
- is_resizing_inspector_ = false;
- }
-
- return false;
- }
-
- IntRect drag_handle = active_tab()->GetInspectorResizeDragHandle();
-
- bool over_drag_handle = drag_handle.Contains(Point(x_px, y_px));
-
- if (over_drag_handle && !is_over_inspector_resize_drag_handle_) {
- // We entered the drag area
- window()->SetCursor(Cursor::kCursor_NorthSouthResize);
- is_over_inspector_resize_drag_handle_ = true;
- } else if (!over_drag_handle && is_over_inspector_resize_drag_handle_) {
- // We left the drag area, restore previous cursor
- window()->SetCursor(cur_cursor_);
- is_over_inspector_resize_drag_handle_ = false;
- }
-
- if (over_drag_handle && evt.type == MouseEvent::kType_MouseDown && !is_resizing_inspector_) {
- is_resizing_inspector_ = true;
- inspector_resize_begin_mouse_y_ = y_px;
- inspector_resize_begin_height_ = active_tab()->GetInspectorHeight();
- }
-
- return !over_drag_handle;
- }
-
- return true;
-}
-
-void UI::OnClose(ultralight::Window* window) {
- App::instance()->Quit();
-}
-
-void UI::OnResize(ultralight::Window* window, uint32_t width, uint32_t height) {
- int tab_height = window->height() - ui_height_;
-
- if (tab_height < 1)
- tab_height = 1;
-
- overlay_->Resize(window->width(), ui_height_);
-
- for (auto& tab : tabs_) {
- if (tab.second)
- tab.second->Resize(window->width(), (uint32_t)tab_height);
- }
-}
-
-void UI::OnDOMReady(View* caller, uint64_t frame_id, bool is_main_frame, const String& url) {
- // Set the context for all subsequent JS* calls
- RefPtr locked_context = view()->LockJSContext();
- SetJSContext(locked_context->ctx());
-
- JSObject global = JSGlobalObject();
- updateBack = global["updateBack"];
- updateForward = global["updateForward"];
- updateLoading = global["updateLoading"];
- updateURL = global["updateURL"];
- addTab = global["addTab"];
- updateTab = global["updateTab"];
- closeTab = global["closeTab"];
-
- global["OnBack"] = BindJSCallback(&UI::OnBack);
- global["OnForward"] = BindJSCallback(&UI::OnForward);
- global["OnRefresh"] = BindJSCallback(&UI::OnRefresh);
- global["OnStop"] = BindJSCallback(&UI::OnStop);
- global["OnToggleTools"] = BindJSCallback(&UI::OnToggleTools);
- global["OnRequestNewTab"] = BindJSCallback(&UI::OnRequestNewTab);
- global["OnRequestTabClose"] = BindJSCallback(&UI::OnRequestTabClose);
- global["OnActiveTabChange"] = BindJSCallback(&UI::OnActiveTabChange);
- global["OnRequestChangeURL"] = BindJSCallback(&UI::OnRequestChangeURL);
-
- CreateNewTab();
-}
-
-void UI::OnBack(const JSObject& obj, const JSArgs& args) {
- if (active_tab())
- active_tab()->view()->GoBack();
-}
-
-void UI::OnForward(const JSObject& obj, const JSArgs& args) {
- if (active_tab())
- active_tab()->view()->GoForward();
-}
-
-void UI::OnRefresh(const JSObject& obj, const JSArgs& args) {
- if (active_tab())
- active_tab()->view()->Reload();
-}
-
-void UI::OnStop(const JSObject& obj, const JSArgs& args) {
- if (active_tab())
- active_tab()->view()->Stop();
-}
-
-void UI::OnToggleTools(const JSObject& obj, const JSArgs& args) {
- if (active_tab())
- active_tab()->ToggleInspector();
-}
-
-void UI::OnRequestNewTab(const JSObject& obj, const JSArgs& args) {
- CreateNewTab();
-}
-
-void UI::OnRequestTabClose(const JSObject& obj, const JSArgs& args) {
- if (args.size() == 1) {
- uint64_t id = args[0];
-
- auto& tab = tabs_[id];
- if (!tab)
- return;
-
- if (tabs_.size() == 1 && App::instance())
- App::instance()->Quit();
-
- if (id != active_tab_id_) {
- tabs_[id].reset();
- tabs_.erase(id);
- }
- else {
- tab->set_ready_to_close(true);
- }
-
- RefPtr lock(view()->LockJSContext());
- closeTab({ id });
- }
-}
-
-void UI::OnActiveTabChange(const JSObject& obj, const JSArgs& args) {
- if (args.size() == 1) {
- uint64_t id = args[0];
-
- if (id == active_tab_id_)
- return;
-
- auto& tab = tabs_[id];
- if (!tab)
- return;
-
- tabs_[active_tab_id_]->Hide();
-
- if (tabs_[active_tab_id_]->ready_to_close()) {
- tabs_[active_tab_id_].reset();
- tabs_.erase(active_tab_id_);
- }
-
- active_tab_id_ = id;
- tabs_[active_tab_id_]->Show();
-
- auto tab_view = tabs_[active_tab_id_]->view();
- SetLoading(tab_view->is_loading());
- SetCanGoBack(tab_view->CanGoBack());
- SetCanGoForward(tab_view->CanGoBack());
- SetURL(tab_view->url());
- }
-}
-
-void UI::OnRequestChangeURL(const JSObject& obj, const JSArgs& args) {
- if (args.size() == 1) {
- ultralight::String url = args[0];
-
- if (!tabs_.empty()) {
- auto& tab = tabs_[active_tab_id_];
- tab->view()->LoadURL(url);
- }
- }
-}
-
-void UI::CreateNewTab() {
- uint64_t id = tab_id_counter_++;
- RefPtr window = window_;
- int tab_height = window->height() - ui_height_;
- if (tab_height < 1)
- tab_height = 1;
- tabs_[id].reset(new Tab(this, id, window->width(), (uint32_t)tab_height, 0, ui_height_));
- tabs_[id]->view()->LoadURL("file:///electros/electros.html");
-
- RefPtr lock(view()->LockJSContext());
- addTab({ id, "New Tab", "", tabs_[id]->view()->is_loading() });
-}
-
-RefPtr UI::CreateNewTabForChildView(const String& url) {
- uint64_t id = tab_id_counter_++;
- RefPtr window = window_;
- int tab_height = window->height() - ui_height_;
- if (tab_height < 1)
- tab_height = 1;
- tabs_[id].reset(new Tab(this, id, window->width(), (uint32_t)tab_height, 0, ui_height_));
-
- RefPtr lock(view()->LockJSContext());
- addTab({ id, "", url, tabs_[id]->view()->is_loading() });
-
- return tabs_[id]->view();
-}
-
-void UI::UpdateTabTitle(uint64_t id, const ultralight::String& title) {
- RefPtr lock(view()->LockJSContext());
- updateTab({ id, title, "", tabs_[id]->view()->is_loading() });
-}
-
-void UI::UpdateTabURL(uint64_t id, const ultralight::String& url) {
- if (id == active_tab_id_ && !tabs_.empty())
- SetURL(url);
-}
-
-void UI::UpdateTabNavigation(uint64_t id, bool is_loading, bool can_go_back, bool can_go_forward) {
- if (tabs_.empty())
- return;
-
- RefPtr lock(view()->LockJSContext());
- updateTab({ id, tabs_[id]->view()->title(), "", tabs_[id]->view()->is_loading() });
-
- if (id == active_tab_id_) {
- SetLoading(is_loading);
- SetCanGoBack(can_go_back);
- SetCanGoForward(can_go_forward);
- }
-}
-
-void UI::SetLoading(bool is_loading) {
- RefPtr lock(view()->LockJSContext());
- updateLoading({ is_loading });
-}
-
-void UI::SetCanGoBack(bool can_go_back) {
- RefPtr lock(view()->LockJSContext());
- updateBack({ can_go_back });
-}
-
-void UI::SetCanGoForward(bool can_go_forward) {
- RefPtr lock(view()->LockJSContext());
- updateForward({ can_go_forward });
-}
-
-void UI::SetURL(const ultralight::String& url) {
- RefPtr lock(view()->LockJSContext());
- updateURL({ url });
-}
-
-void UI::SetCursor(ultralight::Cursor cursor) {
- if (App::instance())
- window_->SetCursor(cursor);
-}
diff --git a/electros-ultralight/archive/browser/src/UI.h b/electros-ultralight/archive/browser/src/UI.h
deleted file mode 100644
index 3944903..0000000
--- a/electros-ultralight/archive/browser/src/UI.h
+++ /dev/null
@@ -1,91 +0,0 @@
-#pragma once
-#include
-#include "Tab.h"
-#include