vg-coder-cli 2.0.32 → 2.0.34
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.
- package/package.json +2 -2
- package/.vgignore +0 -10
- package/ARCHITECTURE.md +0 -255
- package/change.sh +0 -0
- package/gulpfile.js +0 -111
- package/vetgo-auto/README.md +0 -3
- package/vetgo-auto/chrome/CSP_IMPROVEMENTS.md +0 -147
- package/vetgo-auto/chrome/MANIFEST_V3_MIGRATION.md +0 -123
- package/vetgo-auto/chrome/assets/icon128.png +0 -0
- package/vetgo-auto/chrome/assets/icon16.png +0 -0
- package/vetgo-auto/chrome/assets/icon48.png +0 -0
- package/vetgo-auto/chrome/environments/environment.ts +0 -13
- package/vetgo-auto/chrome/manifest.json +0 -66
- package/vetgo-auto/chrome/rules.json +0 -23
- package/vetgo-auto/chrome/src/background.ts +0 -200
- package/vetgo-auto/chrome/src/controller.ts +0 -172
- package/vetgo-auto/chrome/src/controllers/common.firebase.ts +0 -31
- package/vetgo-auto/chrome/src/controllers/firebase-crud.ts +0 -147
- package/vetgo-auto/chrome/src/controllers/load-common-fuc.controller.ts +0 -24
- package/vetgo-auto/chrome/src/controllers/load-script.controller.ts +0 -23
- package/vetgo-auto/chrome/src/script-injector.ts +0 -305
- package/vetgo-auto/chrome/src/sidepanel.css +0 -166
- package/vetgo-auto/chrome/src/sidepanel.html +0 -48
- package/vetgo-auto/chrome/src/sidepanel.ts +0 -127
- package/vetgo-auto/chrome/src/utils/ai-domains.ts +0 -33
- package/vetgo-auto/chrome/src/utils/db-utils.ts +0 -2
- package/vetgo-auto/chrome/src/utils/environment-storage.service.ts +0 -85
- package/vetgo-auto/chrome/src/utils/injector-script.ts +0 -47
- package/vetgo-auto/chrome/webpack.config.js +0 -53
- package/vetgo-auto/chrome/webpack.config.prod.js +0 -54
- package/vetgo-auto/package.json +0 -30
- package/vetgo-auto/tsconfig.json +0 -27
- package/vetgo-auto/vg-coder.zip +0 -0
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { environment } from "../../environments/environment";
|
|
2
|
-
|
|
3
|
-
const STORAGE_KEY = 'environmentName';
|
|
4
|
-
const FIREBASE_CONFIG_KEY = 'firebaseConfig';
|
|
5
|
-
const DEFAULT_ENVIRONMENT = environment.environmentName;
|
|
6
|
-
|
|
7
|
-
export class EnvironmentStorageService {
|
|
8
|
-
/**
|
|
9
|
-
* Lấy environment name từ chrome.storage
|
|
10
|
-
*/
|
|
11
|
-
static async getEnvironmentName(): Promise<string> {
|
|
12
|
-
return new Promise((resolve) => {
|
|
13
|
-
chrome.storage.sync.get([STORAGE_KEY], (result) => {
|
|
14
|
-
const envName = result[STORAGE_KEY] || DEFAULT_ENVIRONMENT;
|
|
15
|
-
resolve(envName);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Lưu environment name vào chrome.storage
|
|
22
|
-
*/
|
|
23
|
-
static async setEnvironmentName(name: string): Promise<void> {
|
|
24
|
-
return new Promise((resolve, reject) => {
|
|
25
|
-
if (!name || name.trim() === '') {
|
|
26
|
-
reject(new Error('Environment name cannot be empty'));
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
chrome.storage.sync.set({ [STORAGE_KEY]: name.trim() }, () => {
|
|
31
|
-
if (chrome.runtime.lastError) {
|
|
32
|
-
reject(chrome.runtime.lastError);
|
|
33
|
-
} else {
|
|
34
|
-
resolve();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Lấy cấu hình Firebase. Ưu tiên storage, fallback về environment mặc định
|
|
42
|
-
*/
|
|
43
|
-
static async getFirebaseConfig(): Promise<any> {
|
|
44
|
-
return new Promise((resolve) => {
|
|
45
|
-
chrome.storage.sync.get([FIREBASE_CONFIG_KEY], (result) => {
|
|
46
|
-
const customConfig = result[FIREBASE_CONFIG_KEY];
|
|
47
|
-
if (customConfig && Object.keys(customConfig).length > 0) {
|
|
48
|
-
resolve(customConfig);
|
|
49
|
-
} else {
|
|
50
|
-
resolve(environment.firebaseConfig);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Lưu cấu hình Firebase tùy chỉnh
|
|
58
|
-
*/
|
|
59
|
-
static async setFirebaseConfig(config: any): Promise<void> {
|
|
60
|
-
return new Promise((resolve, reject) => {
|
|
61
|
-
chrome.storage.sync.set({ [FIREBASE_CONFIG_KEY]: config }, () => {
|
|
62
|
-
if (chrome.runtime.lastError) {
|
|
63
|
-
reject(chrome.runtime.lastError);
|
|
64
|
-
} else {
|
|
65
|
-
resolve();
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Reset về giá trị mặc định
|
|
73
|
-
*/
|
|
74
|
-
static async resetToDefault(): Promise<void> {
|
|
75
|
-
try {
|
|
76
|
-
await this.setEnvironmentName(DEFAULT_ENVIRONMENT);
|
|
77
|
-
// Xóa config firebase custom để dùng mặc định
|
|
78
|
-
await new Promise<void>((resolve) => {
|
|
79
|
-
chrome.storage.sync.remove(FIREBASE_CONFIG_KEY, () => resolve());
|
|
80
|
-
});
|
|
81
|
-
} catch (e) {
|
|
82
|
-
throw e;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// VG Coder Shadow DOM Bundle Loader
|
|
2
|
-
// This script fetches the compiled bundle from the local server and executes it.
|
|
3
|
-
|
|
4
|
-
export const VG_CODER_INJECTOR_SCRIPT = `
|
|
5
|
-
(function() {
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
const CONFIG = {
|
|
9
|
-
// Trỏ tới file bundle vừa build
|
|
10
|
-
BUNDLE_URL: 'http://localhost:6868/dist/vg-coder-bundle.js',
|
|
11
|
-
CONTAINER_ID: 'vg-coder-shadow-host'
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// 1. Kiểm tra nếu đã inject rồi
|
|
15
|
-
if (document.getElementById(CONFIG.CONTAINER_ID)) {
|
|
16
|
-
console.log('⚡ VG Coder already injected');
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
console.log('🚀 Loading VG Coder Bundle from:', CONFIG.BUNDLE_URL);
|
|
21
|
-
|
|
22
|
-
// 2. Tạo Script Tag để load bundle
|
|
23
|
-
// Cách này tốt hơn fetch+eval vì tận dụng cache và debug dễ hơn
|
|
24
|
-
const script = document.createElement('script');
|
|
25
|
-
script.src = CONFIG.BUNDLE_URL;
|
|
26
|
-
script.type = 'text/javascript';
|
|
27
|
-
script.async = true;
|
|
28
|
-
|
|
29
|
-
script.onload = () => {
|
|
30
|
-
console.log('✅ VG Coder Bundle Loaded Successfully');
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
script.onerror = () => {
|
|
34
|
-
console.error('❌ Failed to load VG Coder Bundle. Is the server running at port 6868?');
|
|
35
|
-
// Optional: Show a visual error toast on the page
|
|
36
|
-
const toast = document.createElement('div');
|
|
37
|
-
toast.style.cssText = 'position:fixed; top:20px; right:20px; background:#ff3b30; color:white; padding:10px 20px; border-radius:8px; z-index:999999; font-family:sans-serif; box-shadow:0 4px 12px rgba(0,0,0,0.2);';
|
|
38
|
-
toast.textContent = '⚠️ VG Coder Connection Failed (Is Server Running?)';
|
|
39
|
-
document.body.appendChild(toast);
|
|
40
|
-
setTimeout(() => toast.remove(), 5000);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// 3. Inject vào Head hoặc Body
|
|
44
|
-
(document.head || document.body).appendChild(script);
|
|
45
|
-
|
|
46
|
-
})();
|
|
47
|
-
`;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const { join } = require('path');
|
|
2
|
-
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
mode: 'development',
|
|
6
|
-
devtool: 'inline-source-map',
|
|
7
|
-
entry: {
|
|
8
|
-
background: join(__dirname, 'src/background.ts'),
|
|
9
|
-
controller: join(__dirname, 'src/controller.ts'),
|
|
10
|
-
sidepanel: join(__dirname, 'src/sidepanel.ts'),
|
|
11
|
-
},
|
|
12
|
-
module: {
|
|
13
|
-
rules: [
|
|
14
|
-
{
|
|
15
|
-
test: /\.ts?$/,
|
|
16
|
-
use: 'ts-loader',
|
|
17
|
-
exclude: /node_modules/,
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
output: {
|
|
22
|
-
path: join(__dirname, 'dist'),
|
|
23
|
-
filename: '[name].js'
|
|
24
|
-
},
|
|
25
|
-
plugins: [
|
|
26
|
-
new CopyWebpackPlugin({
|
|
27
|
-
patterns: [
|
|
28
|
-
{
|
|
29
|
-
from: join(__dirname, 'manifest.json'),
|
|
30
|
-
to: join(__dirname, 'dist')
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
from: join(__dirname, 'rules.json'),
|
|
34
|
-
to: join(__dirname, 'dist')
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
from: join(__dirname, 'src/sidepanel.html'),
|
|
38
|
-
to: join(__dirname, 'dist')
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
from: join(__dirname, 'src/sidepanel.css'),
|
|
42
|
-
to: join(__dirname, 'dist')
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
from: join(__dirname, 'assets'),
|
|
46
|
-
to: join(__dirname, 'dist/assets')
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
})],
|
|
50
|
-
resolve: {
|
|
51
|
-
extensions: ['.ts', '.js']
|
|
52
|
-
}
|
|
53
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
const { join } = require('path');
|
|
2
|
-
const { optimize } = require('webpack');
|
|
3
|
-
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
mode: 'production',
|
|
7
|
-
entry: {
|
|
8
|
-
background: join(__dirname, 'src/background.ts'),
|
|
9
|
-
controller: join(__dirname, 'src/controller.ts'),
|
|
10
|
-
sidepanel: join(__dirname, 'src/sidepanel.ts'),
|
|
11
|
-
},
|
|
12
|
-
module: {
|
|
13
|
-
rules: [
|
|
14
|
-
{
|
|
15
|
-
test: /\.ts?$/,
|
|
16
|
-
use: 'ts-loader',
|
|
17
|
-
exclude: /node_modules/,
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
output: {
|
|
22
|
-
path: join(__dirname, 'dist'),
|
|
23
|
-
filename: '[name].js'
|
|
24
|
-
},
|
|
25
|
-
plugins: [
|
|
26
|
-
new optimize.AggressiveMergingPlugin(),
|
|
27
|
-
new CopyWebpackPlugin({
|
|
28
|
-
patterns: [
|
|
29
|
-
{
|
|
30
|
-
from: join(__dirname, 'manifest.json'),
|
|
31
|
-
to: join(__dirname, 'dist')
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
from: join(__dirname, 'rules.json'),
|
|
35
|
-
to: join(__dirname, 'dist')
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
from: join(__dirname, 'src/sidepanel.html'),
|
|
39
|
-
to: join(__dirname, 'dist')
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
from: join(__dirname, 'src/sidepanel.css'),
|
|
43
|
-
to: join(__dirname, 'dist')
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
from: join(__dirname, 'assets'),
|
|
47
|
-
to: join(__dirname, 'dist/assets')
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
})],
|
|
51
|
-
resolve: {
|
|
52
|
-
extensions: ['.ts', '.js']
|
|
53
|
-
}
|
|
54
|
-
};
|
package/vetgo-auto/package.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vg-coder",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"author": "VetGo",
|
|
5
|
-
"description": "Vg Coder",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"clean": "rimraf chrome/dist",
|
|
8
|
-
"build": "npm run clean && webpack --config chrome/webpack.config.js",
|
|
9
|
-
"build:prod": "npm run clean && webpack --config chrome/webpack.config.prod.js && npm run pack",
|
|
10
|
-
"pack": "cd chrome/dist && bestzip ../../vg-coder.zip *"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"firebase": "^9.17.2",
|
|
14
|
-
"js-sha256": "^0.9.0",
|
|
15
|
-
"lodash": "^4.17.21",
|
|
16
|
-
"rxjs": "~7.8.0",
|
|
17
|
-
"tslib": "^2.4.1",
|
|
18
|
-
"uuid": "^9.0.0"
|
|
19
|
-
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@types/chrome": "^0.0.209",
|
|
22
|
-
"bestzip": "^2.2.1",
|
|
23
|
-
"copy-webpack-plugin": "^11.0.0",
|
|
24
|
-
"rimraf": "^4.1.1",
|
|
25
|
-
"ts-loader": "^9.4.2",
|
|
26
|
-
"typescript": "~4.9.5",
|
|
27
|
-
"webpack": "^5.75.0",
|
|
28
|
-
"webpack-cli": "^5.0.1"
|
|
29
|
-
}
|
|
30
|
-
}
|
package/vetgo-auto/tsconfig.json
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": "./",
|
|
4
|
-
"outDir": "./dist/out-tsc",
|
|
5
|
-
"sourceMap": true,
|
|
6
|
-
"declaration": false,
|
|
7
|
-
"moduleResolution": "node",
|
|
8
|
-
"emitDecoratorMetadata": true,
|
|
9
|
-
"experimentalDecorators": true,
|
|
10
|
-
"target": "es6",
|
|
11
|
-
"typeRoots": [
|
|
12
|
-
"node_modules/@types"
|
|
13
|
-
],
|
|
14
|
-
"lib": [
|
|
15
|
-
"es2018",
|
|
16
|
-
"dom"
|
|
17
|
-
]
|
|
18
|
-
},
|
|
19
|
-
"include": [
|
|
20
|
-
"chrome/src/**/*",
|
|
21
|
-
"chrome/environments/**/*"
|
|
22
|
-
],
|
|
23
|
-
"exclude": [
|
|
24
|
-
"node_modules",
|
|
25
|
-
"angular"
|
|
26
|
-
]
|
|
27
|
-
}
|
package/vetgo-auto/vg-coder.zip
DELETED
|
Binary file
|