n8n-nodes-nvk-browser 1.0.77 → 1.0.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -95,8 +95,29 @@ class CreateProfile {
|
|
|
95
95
|
const extensionsInput = this.getNodeParameter('extensions', i) || '';
|
|
96
96
|
// Parse extensions
|
|
97
97
|
const extensions = ExtensionHandler_1.ExtensionHandler.parseExtensions(extensionsInput);
|
|
98
|
-
//
|
|
99
|
-
const
|
|
98
|
+
// Validate extensions và lấy resolved paths
|
|
99
|
+
const extensionPaths = [];
|
|
100
|
+
if (extensions.length > 0) {
|
|
101
|
+
console.log(`[CreateProfile] Validating ${extensions.length} extension(s)...`);
|
|
102
|
+
for (const ext of extensions) {
|
|
103
|
+
try {
|
|
104
|
+
const validation = await ExtensionHandler_1.ExtensionHandler.validateExtension(ext, resolvedProfilesDir);
|
|
105
|
+
if (validation.valid && validation.path) {
|
|
106
|
+
extensionPaths.push(validation.path);
|
|
107
|
+
console.log(`[CreateProfile] ✓ Extension validated: ${ext} -> ${validation.path}`);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
console.error(`[CreateProfile] ✗ Extension validation failed: ${ext} - ${validation.error || 'Unknown error'}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
console.error(`[CreateProfile] ✗ Error validating extension "${ext}":`, error);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
console.log(`[CreateProfile] Successfully validated ${extensionPaths.length}/${extensions.length} extension(s)`);
|
|
118
|
+
}
|
|
119
|
+
// Tạo profile với cả extensionPaths đã resolve
|
|
120
|
+
const profile = profileManager.createProfile(profileName, proxy, note, extensions, extensionPaths);
|
|
100
121
|
// Lưu proxy authentication vào profile nếu có
|
|
101
122
|
// QUAN TRỌNG: Phải gọi SAU khi createProfile và setProfileName để Preferences file đã được tạo
|
|
102
123
|
// Nhưng phải đảm bảo không bị ghi đè
|
|
@@ -180,6 +201,7 @@ class CreateProfile {
|
|
|
180
201
|
proxy: profile.proxy,
|
|
181
202
|
note: profile.note,
|
|
182
203
|
extensions: profile.extensions,
|
|
204
|
+
extensionPaths: profile.extensionPaths,
|
|
183
205
|
createdAt: profile.createdAt,
|
|
184
206
|
},
|
|
185
207
|
},
|
|
@@ -97,7 +97,30 @@ class BrowserManager {
|
|
|
97
97
|
args.push(...ProxyHandler_1.ProxyHandler.getChromeProxyArgs(proxyConfig));
|
|
98
98
|
}
|
|
99
99
|
// Extension configuration
|
|
100
|
-
|
|
100
|
+
// Sử dụng extensionPaths đã resolve thay vì validate lại
|
|
101
|
+
if (profile.extensionPaths && profile.extensionPaths.length > 0) {
|
|
102
|
+
// Kiểm tra paths còn tồn tại không
|
|
103
|
+
const validPaths = [];
|
|
104
|
+
for (const extPath of profile.extensionPaths) {
|
|
105
|
+
const manifestPath = path.join(extPath, 'manifest.json');
|
|
106
|
+
if (fs.existsSync(manifestPath)) {
|
|
107
|
+
validPaths.push(extPath);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
console.warn(`[BrowserManager] Extension path no longer valid (missing manifest.json): ${extPath}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (validPaths.length > 0) {
|
|
114
|
+
args.push(`--load-extension=${validPaths.join(',')}`);
|
|
115
|
+
console.log(`[BrowserManager] Loading ${validPaths.length} extension(s) from cached paths`);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
console.warn(`[BrowserManager] No valid extension paths found, skipping extensions`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else if (profile.extensions && profile.extensions.length > 0) {
|
|
122
|
+
// Fallback: Nếu không có extensionPaths, validate lại (cho backward compatibility)
|
|
123
|
+
console.log(`[BrowserManager] No extensionPaths found, validating extensions on-the-fly (legacy mode)`);
|
|
101
124
|
try {
|
|
102
125
|
const extensionArgs = await ExtensionHandler_1.ExtensionHandler.getExtensionArgs(profile.extensions, this.profilesDir);
|
|
103
126
|
args.push(...extensionArgs);
|
|
@@ -5,7 +5,7 @@ export declare class ProfileManager {
|
|
|
5
5
|
private ensureProfilesDir;
|
|
6
6
|
private getProfileMetadataPath;
|
|
7
7
|
private getProfileDir;
|
|
8
|
-
createProfile(name: string, proxy?: string, note?: string, extensions?: string[]): ProfileData;
|
|
8
|
+
createProfile(name: string, proxy?: string, note?: string, extensions?: string[], extensionPaths?: string[]): ProfileData;
|
|
9
9
|
private setProfileName;
|
|
10
10
|
getProfile(profileId: string): ProfileData | null;
|
|
11
11
|
getAllProfiles(): ProfileData[];
|
|
@@ -43,7 +43,7 @@ class ProfileManager {
|
|
|
43
43
|
getProfileDir(profileId) {
|
|
44
44
|
return path.join(this.profilesDir, profileId);
|
|
45
45
|
}
|
|
46
|
-
createProfile(name, proxy, note, extensions) {
|
|
46
|
+
createProfile(name, proxy, note, extensions, extensionPaths) {
|
|
47
47
|
const profileId = (0, uuid_1.v4)();
|
|
48
48
|
const profileDir = this.getProfileDir(profileId);
|
|
49
49
|
// Tạo thư mục profile
|
|
@@ -54,6 +54,7 @@ class ProfileManager {
|
|
|
54
54
|
proxy,
|
|
55
55
|
note,
|
|
56
56
|
extensions: extensions || [],
|
|
57
|
+
extensionPaths: extensionPaths || [],
|
|
57
58
|
createdAt: new Date().toISOString(),
|
|
58
59
|
updatedAt: new Date().toISOString(),
|
|
59
60
|
};
|
package/dist/utils/types.d.ts
CHANGED
package/package.json
CHANGED