mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 07:32:54 +00:00
Merge main into terminal drag-drop zmodem
This commit is contained in:
commit
285fcd55a9
88 files changed
+2774
-638
No files matched your search
@@ -4,6 +4,16 @@ let bridgesRegistered = false;
|
||||
let cloudSyncSessionPassword = null;
|
||||
const { readClipboardFiles, readClipboardImage } = require("../bridges/clipboardFiles.cjs");
|
||||
|
||||
const excludedFigSpecPrefixes = ["aws", "gcloud", "az"];
|
||||
|
||||
function isExcludedFigSpec(commandName) {
|
||||
return excludedFigSpecPrefixes.some((prefix) => commandName === prefix || commandName.startsWith(`${prefix}/`));
|
||||
}
|
||||
|
||||
function filterExcludedFigSpecs(specNames) {
|
||||
return specNames.filter((name) => !isExcludedFigSpec(name));
|
||||
}
|
||||
|
||||
function createBridgeRegistrar(context) {
|
||||
const {
|
||||
electronModule,
|
||||
@@ -262,7 +272,7 @@ function createBridgeRegistrar(context) {
|
||||
.filter(f => f.endsWith(".js"))
|
||||
.map(f => f.slice(0, -3));
|
||||
} catch { /* no local specs dir */ }
|
||||
const merged = [...new Set([...figSpecs, ...localNames])];
|
||||
const merged = filterExcludedFigSpecs([...new Set([...figSpecs, ...localNames])]);
|
||||
return merged;
|
||||
} catch (err) {
|
||||
console.warn("[Main] Failed to load fig spec list:", err?.message || err);
|
||||
@@ -274,6 +284,7 @@ function createBridgeRegistrar(context) {
|
||||
// Sanitize: reject absolute paths, path traversal, and non-spec characters
|
||||
if (!commandName || commandName.startsWith("/") || commandName.startsWith("\\") ||
|
||||
commandName.includes("..") || !/^[@a-zA-Z0-9._/+-]+$/.test(commandName)) return null;
|
||||
if (isExcludedFigSpec(commandName)) return null;
|
||||
const { pathToFileURL } = require("url");
|
||||
const fs = require("fs");
|
||||
|
||||
@@ -858,4 +869,4 @@ function createBridgeRegistrar(context) {
|
||||
return registerBridges;
|
||||
}
|
||||
|
||||
module.exports = { createBridgeRegistrar };
|
||||
module.exports = { createBridgeRegistrar, filterExcludedFigSpecs, isExcludedFigSpec };
|
||||
Reference in new issue
Block a user