Compare commits

...

2 Commits

2 changed files with 33 additions and 3 deletions

View File

@@ -2,5 +2,10 @@
title = "RemoteTurtle",
description = "Web-based remote control for CC:Tweaked turtles with 3D visualization, D* Lite pathfinding, and state-machine AI. Includes turtle controller, GPS host, web bridge, and pocket computer programs.",
repository = "gitea://git.spatulaa.com/MayaTheShy/remoteturtle/master/",
exclude = { "^server/", "^client/", "%.md$", "%.yml$", "%.json$", "%.bat$", "%.sh$", "^Dockerfile", "^%.git", "^LICENSE$", "^node_modules/" },
exclude = {
"^server/", "^client/", "^__tests__/",
"^startup_", "^start%.",
"%.md$", "%.yml$", "%.json$", "%.bat$", "%.sh$",
"^Dockerfile", "^%.git", "^LICENSE$", "^node_modules/",
},
}

View File

@@ -3,13 +3,38 @@
-- Forwards turtle modem messages to server and server commands to turtles.
-- Falls back to HTTP polling if WebSocket is unavailable.
local SERVER_URL = "http://beta:4200"
local WS_URL = "ws://beta:4200/ws/bridge"
local _baseDir = fs.getDir(shell.getRunningProgram())
local function _path(rel) return fs.combine(_baseDir, rel) end
-- Default config (overridable via .webbridge_config)
local SERVER_URL = "http://localhost:4200"
local WS_URL = "ws://localhost:4200/ws/bridge"
local CHANNEL_RECEIVE = 101
local STATUS_CHANNEL = 102
local COMMAND_CHANNEL = 100
local POCKET_CHANNEL = 103
-- Load config from file if present
local CONFIG_FILE = _path(".webbridge_config")
if fs.exists(CONFIG_FILE) then
local f = fs.open(CONFIG_FILE, "r")
local data = f.readAll()
f.close()
local ok, cfg = pcall(textutils.unserialiseJSON, data)
if ok and cfg then
if cfg.serverUrl then
SERVER_URL = cfg.serverUrl
WS_URL = cfg.serverUrl:gsub("^http", "ws") .. "/ws/bridge"
end
if cfg.wsUrl then WS_URL = cfg.wsUrl end
if cfg.channelReceive then CHANNEL_RECEIVE = cfg.channelReceive end
if cfg.statusChannel then STATUS_CHANNEL = cfg.statusChannel end
if cfg.commandChannel then COMMAND_CHANNEL = cfg.commandChannel end
if cfg.pocketChannel then POCKET_CHANNEL = cfg.pocketChannel end
print("[CONFIG] Loaded from " .. CONFIG_FILE)
end
end
-- Find peripherals
local modem = peripheral.find("modem")
local monitor = peripheral.find("monitor")