CI / Docker image (push) Successful in 12s
CI / Server (push) Successful in 25s
CI / CLI (push) Successful in 13s
Development image / Development image (push) Successful in 21s
CI / CLI (windows) (push) Successful in 57s
CI / CLI (linux-arm64, static) (push) Successful in 1m37s
Release / Prepare release (push) Successful in 2s
Release / Server (linux-x64) (push) Successful in 53s
Release / CLI (linux-arm64, static) (push) Successful in 1m32s
Release / Docker image (push) Successful in 2m48s
Release / Server (windows-x64) (push) Successful in 6m20s
Release / CLI (windows-x64) (push) Successful in 6m48s
Release / CLI (linux-x64) (push) Successful in 7m8s
Release / Publish release (push) Successful in 1s
Squash the tree into one commit, drop docs/architecture.html, reset the version line to 0.3.0, consolidate the changelog, enable Renovate automerge for non-major updates and add AGENTS.md.
30 lines
1.3 KiB
JavaScript
30 lines
1.3 KiB
JavaScript
const { Router } = require("../utils/router");
|
|
const controller = require("../controllers/persistent");
|
|
|
|
const app = Router();
|
|
|
|
const reply = (res, result) => {
|
|
if (result.code) return res.status(result.code).json(result);
|
|
res.json(result);
|
|
};
|
|
|
|
app.get("/", async (req, res) => {
|
|
res.json({ tunnels: await controller.list(req), now: Date.now() });
|
|
});
|
|
|
|
app.post("/", async (req, res) => reply(res, await controller.create(req, req.body || {})));
|
|
|
|
app.get("/:name", async (req, res) => reply(res, await controller.get(req, req.params.name.toLowerCase())));
|
|
|
|
app.put("/:name/access", async (req, res) => reply(res, await controller.updateAccess(req, req.params.name.toLowerCase(), req.body || {})));
|
|
|
|
app.delete("/:name", async (req, res) => reply(res, await controller.remove(req, req.params.name.toLowerCase())));
|
|
|
|
app.post("/:name/domains", async (req, res) => reply(res, await controller.addDomain(req, req.params.name.toLowerCase(), req.body || {})));
|
|
|
|
app.post("/:name/domains/:hostname/check", async (req, res) => reply(res, await controller.checkDomain(req, req.params.name.toLowerCase(), req.params.hostname)));
|
|
|
|
app.delete("/:name/domains/:hostname", async (req, res) => reply(res, await controller.removeDomain(req, req.params.name.toLowerCase(), req.params.hostname)));
|
|
|
|
module.exports = app;
|