Initial commit: plugin repository structure
Some checks failed
Sign Plugins / sign (push) Failing after 32s

- GitHub Actions workflows for signing and validation
- Example file-manager plugin
- Scripts for batch signing
This commit is contained in:
Flik
2025-12-29 18:53:30 +08:00
commit 6b38f133f4
9 changed files with 257 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
{
"name": "file-manager",
"version": "1.0.0",
"description": "文件管理器插件,提供远程文件浏览和管理功能",
"author": "GoTunnel Official",
"run_at": "client",
"type": "app"
}

View File

@@ -0,0 +1,64 @@
// GoTunnel File Manager Plugin
function metadata() {
return {
name: "file-manager",
version: "1.0.0",
description: "文件管理器插件",
author: "GoTunnel Official",
type: "app",
run_at: "client"
};
}
function start() {
log("File Manager plugin started");
}
function stop() {
log("File Manager plugin stopped");
}
function handleConn(conn) {
http.serve(conn, handleRequest);
}
function handleRequest(req) {
var path = req.path;
var method = req.method;
if (path === "/api/list") {
return handleList(req);
}
if (path === "/api/read" && method === "POST") {
return handleRead(req);
}
return { status: 404, body: '{"error":"not found"}' };
}
function handleList(req) {
var dir = config("root_path") || ".";
var result = fs.readDir(dir);
if (result.error) {
return { status: 500, body: http.json({ error: result.error }) };
}
return { status: 200, body: http.json({ entries: result.entries }) };
}
function handleRead(req) {
var body = JSON.parse(req.body || "{}");
var path = body.path;
if (!path) {
return { status: 400, body: '{"error":"path required"}' };
}
var result = fs.readFile(path);
if (result.error) {
return { status: 500, body: http.json({ error: result.error }) };
}
return { status: 200, body: http.json({ content: result.data }) };
}