mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-30 15:30:22 +08:00
fix: 已登记的 IP 或主机名不再被地区拦截。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
271839b418
commit
faf7e10405
4 files changed
+231
-5
No files matched your search
+29
-1
@@ -16,7 +16,7 @@ import { installSubagentRoleCapture } from "./redteam/role-section.js";
|
||||
import * as rewind from "./rewind.js";
|
||||
import * as continueRetry from "./continue-retry.js";
|
||||
import * as uninstaller from "./uninstall.js";
|
||||
import { installRegionGate } from "./net-scope.js";
|
||||
import { installRegionGate, readAllowText, writeAllowText } from "./net-scope.js";
|
||||
|
||||
export const name = "dsh-purge";
|
||||
|
||||
@@ -1425,6 +1425,34 @@ function installWebServer(ctx, cfg) {
|
||||
response.end();
|
||||
},
|
||||
}, "dsh-purge: override");
|
||||
registerPluginRoute({
|
||||
kind: "exact",
|
||||
path: "/dsh-purge/own-servers",
|
||||
handler: async (request, response) => {
|
||||
const home = core.findDshHome();
|
||||
if (request.method === "GET") {
|
||||
sendJson(response, 200, { ok: true, content: readAllowText(home) });
|
||||
return;
|
||||
}
|
||||
if (request.method === "POST") {
|
||||
try {
|
||||
const body = await readJsonBody(request);
|
||||
const content = typeof body?.content === "string" ? body.content : null;
|
||||
if (content === null) {
|
||||
sendJson(response, 400, { ok: false, error: "content must be a string" });
|
||||
return;
|
||||
}
|
||||
const saved = await writeAllowText(home, content);
|
||||
sendJson(response, 200, { ok: true, content: saved.text, dropped: saved.dropped });
|
||||
} catch (e) {
|
||||
sendJson(response, 500, { ok: false, error: String(e && e.message ? e.message : e) });
|
||||
}
|
||||
return;
|
||||
}
|
||||
response.writeHead(405, { allow: "GET, POST" });
|
||||
response.end();
|
||||
},
|
||||
}, "dsh-purge: own-servers");
|
||||
installRulesHttp(host.webServer);
|
||||
installSkillsHttp(host.webServer);
|
||||
registerPluginRoute({
|
||||
|
||||
Reference in new issue
Block a user