Skip to content

Commit 02411ce

Browse files
authored
new example
1 parent 2aee806 commit 02411ce

10 files changed

Lines changed: 2542 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"Blacklist": [
3+
"electrician_simulator",
4+
"hitman_2_silent_assassin",
5+
"hitman_blood_money",
6+
"syberia_anniversary_collection",
7+
"hitman_contracts",
8+
"hitman_absolution",
9+
"fallout_4_game_of_the_year_edition",
10+
"summer_memories_deluxe_edition",
11+
"huniepop",
12+
"planescape_torment_enhanced_edition",
13+
"hitman_codename_47",
14+
"the_house_of_the_dead_remake",
15+
"cyberpunk_2077_phantom_liberty",
16+
"neverwinter_nights_enhanced_edition_digital_deluxe_edition",
17+
"god_of_war",
18+
"heroes_of_might_and_magic_4_complete",
19+
"horses",
20+
"cyberpunk_2077_ultimate_edition",
21+
"saints_row_2"
22+
],
23+
"Owned": [
24+
"stalker_call_of_prypiat_enhanced_edition",
25+
"lords_of_the_fallen_game_of_the_year_edition",
26+
"assassins_creed_directors_cut",
27+
"heroes_of_might_and_magic_3_complete_edition",
28+
"postal_2",
29+
"frostpunk_game_of_the_year_edition",
30+
"splinter_cell"
31+
],
32+
"Watchlist": [
33+
"tomb_raider_iv_vi_remastered",
34+
"styx_shards_of_darkness",
35+
"fallout_new_vegas_ultimate_edition"
36+
]
37+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/**
2+
* 00_Core.js - The Master Bridge Core for NetWebView2Lib
3+
* This script acts as the primary communication layer between the Browser and AutoIt.
4+
*/
5+
6+
// Ο διακόπτης ελέγχου. Η AutoIt μπορεί να τον αλλάξει δυναμικά με ExecuteScript.
7+
window.DEBUG_ENABLED = window.DEBUG_ENABLED || false;
8+
9+
/**
10+
* window.Log
11+
* Η κεντρική συνάρτηση αποστολής μηνυμάτων στην AutoIt.
12+
* @param {string|object} msg - Το μήνυμα ή το αντικείμενο προς καταγραφή.
13+
* @param {string} type - Το επίπεδο του log (DEBUG, INFO, ERROR, κλπ).
14+
*/
15+
window.Log = function(msg, type = "DEBUG") {
16+
if (!window.DEBUG_ENABLED) return;
17+
18+
// Αν το msg είναι αντικείμενο, το μετατρέπουμε σε string για την AutoIt
19+
let output = (typeof msg === 'object') ? JSON.stringify(msg) : msg;
20+
21+
const logData = {
22+
type: "CONSOLE_LOG",
23+
level: type,
24+
message: output,
25+
timestamp: new Date().toLocaleTimeString()
26+
};
27+
28+
try {
29+
window.chrome.webview.postMessage(JSON.stringify(logData));
30+
} catch (e) {
31+
// Fallback αν το WebView2 δεν είναι ακόμα έτοιμο
32+
console.warn("WebView2 Bridge not ready yet.");
33+
}
34+
};
35+
36+
/**
37+
* Console Hijacking
38+
* Μετατρέπουμε τα κλασικά console.log, console.error κλπ σε window.Log
39+
*/
40+
(function() {
41+
const originalConsole = {
42+
log: console.log,
43+
error: console.error,
44+
warn: console.warn,
45+
info: console.info
46+
};
47+
48+
console.log = function() {
49+
window.Log(arguments[0], "BROWSER-LOG");
50+
originalConsole.log.apply(console, arguments);
51+
};
52+
53+
console.error = function() {
54+
window.Log(arguments[0], "BROWSER-ERROR");
55+
originalConsole.error.apply(console, arguments);
56+
};
57+
58+
console.warn = function() {
59+
window.Log(arguments[0], "BROWSER-WARN");
60+
originalConsole.warn.apply(console, arguments);
61+
};
62+
})();
63+
64+
/**
65+
* Global Error Handler
66+
* Πιάνει όλα τα JavaScript σφάλματα (π.χ. ReferenceErrors) και τα στέλνει στην AutoIt.
67+
*/
68+
window.onerror = function(message, source, lineno, colno, error) {
69+
if (window.DEBUG_ENABLED) {
70+
let errorMsg = `${message} | Source: ${source} | Line: ${lineno}`;
71+
window.Log(errorMsg, "CRITICAL-JS-ERROR");
72+
}
73+
return false; // Επιτρέπει στο σφάλμα να εμφανιστεί και στα DevTools
74+
};
75+
76+
/**
77+
* Heartbeat (Προαιρετικό)
78+
* Ενημερώνει την AutoIt ότι το Bridge είναι ενεργό στη συγκεκριμένη σελίδα.
79+
*/
80+
window.Log("Core Bridge Initialized and Ready", "SYSTEM");

0 commit comments

Comments
 (0)