mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-04-28 19:51:11 +00:00
add report malicious plugin link to installer detail view
Add a "Report malicious plugin" link to the plugin detail view that generates a GitHub report-content URL for plugins with a GitHub source. The link extracts the username from the GitHub URL and pre-fills GitHub's abuse report form. Style the link in error-text color to distinguish it from other developer links.
This commit is contained in:
parent
5dac78d311
commit
7ee5dac78e
2 changed files with 32 additions and 0 deletions
|
|
@ -705,6 +705,25 @@ const model = {
|
|||
});
|
||||
},
|
||||
|
||||
getReportUrl(plugin) {
|
||||
const githubUrl = plugin?.github;
|
||||
if (!githubUrl || typeof githubUrl !== "string") return "";
|
||||
try {
|
||||
const url = new URL(githubUrl.trim().replace(/\.git$/i, ""));
|
||||
if (!url.hostname.includes("github.com")) return "";
|
||||
const parts = url.pathname.split("/").filter(Boolean);
|
||||
if (parts.length >= 1) {
|
||||
const username = parts[0];
|
||||
const contentUrl = encodeURIComponent(githubUrl);
|
||||
const report = encodeURIComponent(`${username} (user)`);
|
||||
return `https://github.com/contact/report-content?content_url=${contentUrl}&report=${report}`;
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
return "";
|
||||
},
|
||||
|
||||
// ── Shared ───────────────────────────────────
|
||||
|
||||
resetZip() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue