Kernel Control Panel đã được nâng cấp thành công từ Python Tkinter sang TypeScript/Web!
buonhayvui1404/kernel/
├── main.ts # ⭐ HTTP endpoint chính (giao diện web)
├── browser_manager.ts # TypeScript class quản lý proxy/browser
├── utils.ts # Helper functions & database operations
├── README.md # Tài liệu đầy đủ
├── QUICKSTART.md # Hướng dẫn nhanh
├── SETUP.md # File này
├── gui_app.py # (Cũ - có thể xóa)
└── browser_manager.py # (Cũ - có thể xóa)
Endpoint URL:
https://buonhayvui1404--7388d0b81f8b11f19f3b42dde27851f2.web.val.run
✅ CONTROL Tab
✅ PROFILES Tab
✅ Giao Diện Design
import { BrowserManager } from "./browser_manager.ts";
const apiKey = Deno.env.get("KERNEL_API_KEY");
const manager = new BrowserManager(apiKey);
// Tạo proxy
const proxyId = await manager.createProxy({
country: "US",
region: "California",
city: "Los Angeles"
});
// Tạo browser session
const session = await manager.createBrowserSession(proxyId);
console.log(session.liveViewUrl); // Live view URL
const response = await fetch("https://api.kernel.com/proxies", {
method: "POST",
headers: {
"Authorization": `Bearer ${Deno.env.get("KERNEL_API_KEY")}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
type: "residential",
name: `proxy_${Date.now()}`,
config: { country: "US", region, city }
})
});
Để lưu trữ profiles & logs bền vững, sử dụng SQLite:
import { initializeDatabase, saveProfile, getProfiles } from "./utils.ts";
// Gọi một lần khi app start
await initializeDatabase();
await saveProfile(proxyId, cdpUrl, liveViewUrl);
const profiles = await getProfiles(); // Mảng profiles
await deleteProfile(profileId);
Cấu hình trong Val Town settings:
| Key | Value | Mô Tả |
|---|---|---|
KERNEL_API_KEY | your-api-key | API key từ Kernel |
KERNEL_API_URL | https://api.kernel.com | (Tùy chọn) |
PROXY_TIMEOUT | 3600 | (Tùy chọn) Timeout proxy |
Trả về HTML giao diện chính
Tạo proxy mới
Request:
{ "country": "US", "region": "California", "city": "Los Angeles" }
Response:
{ "success": true, "proxyId": "proxy_1742123456789" }
Tạo browser session
Request:
{ "proxyId": "proxy_1742123456789" }
Response:
{ "success": true, "cdpUrl": "wss://cdp.kernel.com/...", "liveUrl": "https://live.kernel.com/..." }
Lấy danh sách profiles
Response:
{ "profiles": [ { "id": 1, "proxyId": "proxy_...", "time": "10:30:45", "liveUrl": "https://..." } ] }
Trong getHTML() function, tìm section <style> và sửa:
/* Neon Green (Primary) */
color: #00ff00;
/* Dark Background */
background: #0f0f23;
/* Secondary */
background: #1a1a2e;
/* Button Green */
background: #00aa00;
/* Error Red */
background: #aa0000;
<button class="tab-btn" onclick="switchTab('newtab')">🆕 NEW</button> <div id="newtab" class="tab-content"> <!-- Content here --> </div>
if (path === "/api/newfeature" && method === "POST") {
// Your logic
return Response.json({ success: true, data: {...} });
}
# Trong browser console (F12) console.log(logs);
import { getLogs } from "./utils.ts";
const logs = await getLogs(50);
console.log(logs);
main.ts - HTTP endpointbrowser_manager.ts - Browser manager classutils.ts - Database utilities| Python | TypeScript |
|---|---|
tkinter.Tk GUI | HTML/CSS/JS Web UI |
QueueHandler logging | Console + Database logs |
tkinter.Entry inputs | HTML inputs |
tkinter.Button buttons | HTML buttons |
tkinter.Listbox profiles | HTML list |
| File storage (profiles.json) | SQLite database |
→ Xóa cache (Ctrl+Shift+Del)
→ Kiểm tra URL endpoint
→ Xem browser console (F12)
→ Kiểm tra KERNEL_API_KEY
→ Kiểm tra API URL
→ Xem network errors (F12)
→ Gọi initializeDatabase()
→ Kiểm tra storage quota
→ Xem sqlite errors
Tích hợp API Kernel
KERNEL_API_KEYCustomize Giao Diện
Thêm Features
Production Deploy
Status: ✅ Production Ready
Updated: 2026-03-14
Version: 2.0
Made with 💚 for Val Town