fix: mount openclaw routes at /openclaw prefix + fix docker.client wrapper + strip duplicate /apps/ paths across sub-routers

- openClawRoutes was mounted at root causing /status vs /openclaw/status mismatch
- ctx.docker is a typed wrapper {client,pull,...} — all calls now use docker.client.*
- templates/deploy/removal/restore sub-routers had /apps/ hardcoded in inner routes
  causing double-stacking when mounted under /apps (→ /apps/apps/templates etc)
- openclaw.js: GET /status, POST /deploy, GET/POST /proxy/*, DELETE /
This commit is contained in:
Hermes
2026-05-27 22:20:21 -07:00
parent 17edb3bc90
commit e07375f642
7 changed files with 300 additions and 16 deletions
+5 -5
View File
@@ -41,7 +41,7 @@ module.exports = function({
};
// Get available app templates
router.get('/apps/templates', asyncHandler(async (req, res) => {
router.get('/templates', asyncHandler(async (req, res) => {
res.json({
success: true,
templates: ctx.APP_TEMPLATES,
@@ -51,7 +51,7 @@ module.exports = function({
}, 'apps-templates'));
// Get specific app template
router.get('/apps/templates/:appId', asyncHandler(async (req, res) => {
router.get('/templates/:appId', asyncHandler(async (req, res) => {
const { appId } = req.params;
const template = ctx.APP_TEMPLATES[appId];
if (!template) {
@@ -62,7 +62,7 @@ module.exports = function({
}, 'apps-template-detail'));
// Check port availability
router.get('/apps/ports/:port/check', asyncHandler(async (req, res) => {
router.get('/ports/:port/check', asyncHandler(async (req, res) => {
const port = req.params.port;
const conflicts = await helpers.checkPortConflicts([port]);
if (conflicts.length > 0) {
@@ -74,7 +74,7 @@ module.exports = function({
}, 'check-port'));
// Get suggested available port
router.get('/apps/ports/:basePort/suggest', asyncHandler(async (req, res) => {
router.get('/ports/:basePort/suggest', asyncHandler(async (req, res) => {
const basePort = parseInt(req.params.basePort) || 8080;
const maxAttempts = 100;
const usedPorts = await docker.getUsedPorts();
@@ -88,7 +88,7 @@ module.exports = function({
}, 'suggest-port'));
// Update subdomain for deployed app
router.post('/apps/update-subdomain', asyncHandler(async (req, res) => {
router.post('/update-subdomain', asyncHandler(async (req, res) => {
const { serviceId, oldSubdomain, newSubdomain, containerId, ip } = req.body;
const { ValidationError } = require('../../errors');