adb-sqlite-viewer 1.0.7 → 1.1.0
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/LICENSE +20 -20
- package/README.md +86 -86
- package/bridge/package.json +13 -13
- package/bridge/server.js +357 -301
- package/cli/bin.cjs +25 -25
- package/cli/ensure-adb.cjs +150 -150
- package/cli/server.cjs +122 -122
- package/dist/assets/index-B63KZ0IL.js +62 -0
- package/dist/assets/sql-wasm-UFUCzYNW.wasm +0 -0
- package/dist/index.html +239 -140
- package/electron/main.cjs +270 -114
- package/package.json +97 -85
- package/dist/assets/index-CIcR1CkF.js +0 -61
package/electron/main.cjs
CHANGED
|
@@ -1,114 +1,270 @@
|
|
|
1
|
-
const { app, BrowserWindow } = require("electron");
|
|
2
|
-
const {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
1
|
+
const { app, BrowserWindow, dialog, Menu } = require("electron");
|
|
2
|
+
const { autoUpdater } = require("electron-updater");
|
|
3
|
+
const { fork } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
let bridge = null;
|
|
7
|
+
let mainWindow = null;
|
|
8
|
+
|
|
9
|
+
// ── Auto-Updater Setup ─────────────────────────────
|
|
10
|
+
|
|
11
|
+
function setupAutoUpdater() {
|
|
12
|
+
autoUpdater.autoDownload = false;
|
|
13
|
+
autoUpdater.autoInstallOnAppQuit = true;
|
|
14
|
+
|
|
15
|
+
autoUpdater.on("checking-for-update", () => {
|
|
16
|
+
console.log("Checking for updates...");
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
autoUpdater.on("update-available", (info) => {
|
|
20
|
+
dialog
|
|
21
|
+
.showMessageBox(mainWindow, {
|
|
22
|
+
type: "info",
|
|
23
|
+
title: "Update Available",
|
|
24
|
+
message: `Version ${info.version} is available (you have ${app.getVersion()}).`,
|
|
25
|
+
detail: "Would you like to download it now?",
|
|
26
|
+
buttons: ["Download", "Later"],
|
|
27
|
+
defaultId: 0,
|
|
28
|
+
})
|
|
29
|
+
.then((result) => {
|
|
30
|
+
if (result.response === 0) {
|
|
31
|
+
autoUpdater.downloadUpdate();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
autoUpdater.on("update-not-available", () => {
|
|
37
|
+
console.log("No updates available.");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
autoUpdater.on("download-progress", (progress) => {
|
|
41
|
+
if (mainWindow) {
|
|
42
|
+
mainWindow.setProgressBar(progress.percent / 100);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
autoUpdater.on("update-downloaded", () => {
|
|
47
|
+
if (mainWindow) mainWindow.setProgressBar(-1);
|
|
48
|
+
dialog
|
|
49
|
+
.showMessageBox(mainWindow, {
|
|
50
|
+
type: "info",
|
|
51
|
+
title: "Update Ready",
|
|
52
|
+
message: "Update has been downloaded. Restart now to install?",
|
|
53
|
+
buttons: ["Restart Now", "Later"],
|
|
54
|
+
defaultId: 0,
|
|
55
|
+
})
|
|
56
|
+
.then((result) => {
|
|
57
|
+
if (result.response === 0) {
|
|
58
|
+
autoUpdater.quitAndInstall();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
autoUpdater.on("error", (err) => {
|
|
64
|
+
console.error("Auto-update error:", err.message);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Check for updates after a short delay
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
autoUpdater.checkForUpdates().catch((err) => {
|
|
70
|
+
console.error("Update check failed:", err.message);
|
|
71
|
+
});
|
|
72
|
+
}, 3000);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// ── Application Menu ────────────────────────────────
|
|
76
|
+
|
|
77
|
+
function buildMenu() {
|
|
78
|
+
const template = [
|
|
79
|
+
{
|
|
80
|
+
label: "File",
|
|
81
|
+
submenu: [
|
|
82
|
+
{ role: "quit" },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
label: "View",
|
|
87
|
+
submenu: [
|
|
88
|
+
{ role: "reload" },
|
|
89
|
+
{ role: "forceReload" },
|
|
90
|
+
{ role: "toggleDevTools" },
|
|
91
|
+
{ type: "separator" },
|
|
92
|
+
{ role: "resetZoom" },
|
|
93
|
+
{ role: "zoomIn" },
|
|
94
|
+
{ role: "zoomOut" },
|
|
95
|
+
{ type: "separator" },
|
|
96
|
+
{ role: "togglefullscreen" },
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: "Help",
|
|
101
|
+
submenu: [
|
|
102
|
+
{
|
|
103
|
+
label: "Check for Updates...",
|
|
104
|
+
click: () => {
|
|
105
|
+
autoUpdater
|
|
106
|
+
.checkForUpdates()
|
|
107
|
+
.then((result) => {
|
|
108
|
+
if (!result || !result.updateInfo) {
|
|
109
|
+
dialog.showMessageBox(mainWindow, {
|
|
110
|
+
type: "info",
|
|
111
|
+
title: "No Updates",
|
|
112
|
+
message: `You are running the latest version (${app.getVersion()}).`,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
.catch(() => {
|
|
117
|
+
dialog.showMessageBox(mainWindow, {
|
|
118
|
+
type: "info",
|
|
119
|
+
title: "No Updates",
|
|
120
|
+
message: `You are running the latest version (${app.getVersion()}).`,
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{ type: "separator" },
|
|
126
|
+
{
|
|
127
|
+
label: "About",
|
|
128
|
+
click: () => {
|
|
129
|
+
dialog.showMessageBox(mainWindow, {
|
|
130
|
+
type: "info",
|
|
131
|
+
title: "About ADB SQLite DevTools",
|
|
132
|
+
message: `ADB SQLite DevTools v${app.getVersion()}`,
|
|
133
|
+
detail: "View and query SQLite databases on Android devices.",
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
];
|
|
140
|
+
|
|
141
|
+
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// ── Bundled ADB ─────────────────────────────────────
|
|
145
|
+
|
|
146
|
+
function setupBundledAdb() {
|
|
147
|
+
if (app.isPackaged) {
|
|
148
|
+
const toolsDir = path.join(process.resourcesPath, "tools");
|
|
149
|
+
const sep = process.platform === "win32" ? ";" : ":";
|
|
150
|
+
process.env.PATH = toolsDir + sep + (process.env.PATH || "");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// ── Bridge Server ───────────────────────────────────
|
|
155
|
+
|
|
156
|
+
function getBridgePath() {
|
|
157
|
+
if (app.isPackaged) {
|
|
158
|
+
return path.join(process.resourcesPath, "bridge", "server.js");
|
|
159
|
+
}
|
|
160
|
+
return path.join(__dirname, "..", "bridge", "server.js");
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function startBridge() {
|
|
164
|
+
return new Promise((resolve, reject) => {
|
|
165
|
+
const serverPath = getBridgePath();
|
|
166
|
+
bridge = fork(serverPath, [], { silent: true });
|
|
167
|
+
|
|
168
|
+
const timeout = setTimeout(() => {
|
|
169
|
+
reject(new Error("Bridge server failed to start within 10 seconds"));
|
|
170
|
+
}, 10_000);
|
|
171
|
+
|
|
172
|
+
bridge.on("message", (msg) => {
|
|
173
|
+
if (msg.type === "ready") {
|
|
174
|
+
clearTimeout(timeout);
|
|
175
|
+
resolve();
|
|
176
|
+
} else if (msg.type === "error") {
|
|
177
|
+
clearTimeout(timeout);
|
|
178
|
+
reject(new Error(msg.message || "Bridge error"));
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
bridge.on("error", (err) => {
|
|
183
|
+
clearTimeout(timeout);
|
|
184
|
+
reject(err);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
bridge.on("exit", (code) => {
|
|
188
|
+
if (code !== 0 && code !== null) {
|
|
189
|
+
clearTimeout(timeout);
|
|
190
|
+
reject(new Error(`Bridge exited with code ${code}`));
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// Forward bridge logs to main process console
|
|
195
|
+
bridge.stdout.on("data", (data) => {
|
|
196
|
+
process.stdout.write(`[bridge] ${data}`);
|
|
197
|
+
});
|
|
198
|
+
bridge.stderr.on("data", (data) => {
|
|
199
|
+
process.stderr.write(`[bridge] ${data}`);
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ── Window ──────────────────────────────────────────
|
|
205
|
+
|
|
206
|
+
function createWindow() {
|
|
207
|
+
mainWindow = new BrowserWindow({
|
|
208
|
+
width: 1400,
|
|
209
|
+
height: 900,
|
|
210
|
+
webPreferences: {
|
|
211
|
+
nodeIntegration: false,
|
|
212
|
+
contextIsolation: true,
|
|
213
|
+
},
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// __dirname works in both dev and packaged (asar transparency)
|
|
217
|
+
const indexPath = path.join(__dirname, "..", "dist", "index.html");
|
|
218
|
+
|
|
219
|
+
mainWindow.loadFile(indexPath);
|
|
220
|
+
|
|
221
|
+
// Tell renderer that Electron handles updates (skip GitHub API check)
|
|
222
|
+
mainWindow.webContents.on("did-finish-load", () => {
|
|
223
|
+
mainWindow.webContents.executeJavaScript("window.__ELECTRON_UPDATE__ = true;");
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
mainWindow.on("closed", () => {
|
|
227
|
+
mainWindow = null;
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// ── App Lifecycle ───────────────────────────────────
|
|
232
|
+
|
|
233
|
+
app.whenReady().then(async () => {
|
|
234
|
+
setupBundledAdb();
|
|
235
|
+
buildMenu();
|
|
236
|
+
|
|
237
|
+
try {
|
|
238
|
+
console.log("Starting ADB bridge server...");
|
|
239
|
+
await startBridge();
|
|
240
|
+
console.log("Bridge server ready.");
|
|
241
|
+
} catch (err) {
|
|
242
|
+
console.error("Failed to start bridge:", err.message);
|
|
243
|
+
// Continue anyway — user can still use the app if they have standalone bridge
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
createWindow();
|
|
247
|
+
|
|
248
|
+
if (app.isPackaged) {
|
|
249
|
+
setupAutoUpdater();
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
app.on("activate", () => {
|
|
253
|
+
if (BrowserWindow.getAllWindows().length === 0) {
|
|
254
|
+
createWindow();
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
app.on("window-all-closed", () => {
|
|
260
|
+
if (process.platform !== "darwin") {
|
|
261
|
+
app.quit();
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
app.on("before-quit", () => {
|
|
266
|
+
if (bridge) {
|
|
267
|
+
bridge.kill();
|
|
268
|
+
bridge = null;
|
|
269
|
+
}
|
|
270
|
+
});
|
package/package.json
CHANGED
|
@@ -1,85 +1,97 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "adb-sqlite-viewer",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "ADB SQLite database viewer for Android — inspect tables, schemas, and run queries on-device",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "electron/main.cjs",
|
|
7
|
-
"bin": {
|
|
8
|
-
"sqlite-viewer": "./cli/bin.cjs"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"cli/",
|
|
12
|
-
"bridge/server.js",
|
|
13
|
-
"bridge/package.json",
|
|
14
|
-
"sqlite3-arm64",
|
|
15
|
-
"dist/"
|
|
16
|
-
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"dev": "vite",
|
|
19
|
-
"build": "vite build",
|
|
20
|
-
"preview": "vite preview",
|
|
21
|
-
"build:electron": "cross-env BUILD_TARGET=electron vite build",
|
|
22
|
-
"build:npm": "cross-env BUILD_TARGET=npm vite build",
|
|
23
|
-
"electron:dev": "cross-env BUILD_TARGET=electron vite build && electron .",
|
|
24
|
-
"electron:build": "cross-env BUILD_TARGET=electron vite build && electron-builder",
|
|
25
|
-
"start": "node cli/bin.cjs",
|
|
26
|
-
"prepublishOnly": "npm run build:npm"
|
|
27
|
-
},
|
|
28
|
-
"keywords": [
|
|
29
|
-
"adb",
|
|
30
|
-
"sqlite",
|
|
31
|
-
"android",
|
|
32
|
-
"devtools",
|
|
33
|
-
"react-native",
|
|
34
|
-
"database",
|
|
35
|
-
"viewer"
|
|
36
|
-
],
|
|
37
|
-
"license": "MIT",
|
|
38
|
-
"repository": {
|
|
39
|
-
"type": "git",
|
|
40
|
-
"url": "https://github.com/amitwinit/SQLite-DevTools-Mobile-ReactNative"
|
|
41
|
-
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"@yume-chan/
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
"electron
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "adb-sqlite-viewer",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "ADB SQLite database viewer for Android — inspect tables, schemas, and run queries on-device",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "electron/main.cjs",
|
|
7
|
+
"bin": {
|
|
8
|
+
"sqlite-viewer": "./cli/bin.cjs"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"cli/",
|
|
12
|
+
"bridge/server.js",
|
|
13
|
+
"bridge/package.json",
|
|
14
|
+
"sqlite3-arm64",
|
|
15
|
+
"dist/"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "vite",
|
|
19
|
+
"build": "vite build",
|
|
20
|
+
"preview": "vite preview",
|
|
21
|
+
"build:electron": "cross-env BUILD_TARGET=electron vite build",
|
|
22
|
+
"build:npm": "cross-env BUILD_TARGET=npm vite build",
|
|
23
|
+
"electron:dev": "cross-env BUILD_TARGET=electron vite build && electron .",
|
|
24
|
+
"electron:build": "cross-env BUILD_TARGET=electron vite build && electron-builder",
|
|
25
|
+
"start": "node cli/bin.cjs",
|
|
26
|
+
"prepublishOnly": "npm run build:npm"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"adb",
|
|
30
|
+
"sqlite",
|
|
31
|
+
"android",
|
|
32
|
+
"devtools",
|
|
33
|
+
"react-native",
|
|
34
|
+
"database",
|
|
35
|
+
"viewer"
|
|
36
|
+
],
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/amitwinit/SQLite-DevTools-Mobile-ReactNative"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"electron-updater": "^6.8.3",
|
|
44
|
+
"sql.js": "^1.14.1"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@yume-chan/adb": "^0.0.24",
|
|
48
|
+
"@yume-chan/adb-credential-web": "^0.0.24",
|
|
49
|
+
"@yume-chan/adb-daemon-webusb": "^0.0.24",
|
|
50
|
+
"@yume-chan/stream-extra": "^0.0.24",
|
|
51
|
+
"cross-env": "^7.0.3",
|
|
52
|
+
"electron": "^34.0.0",
|
|
53
|
+
"electron-builder": "^25.1.8",
|
|
54
|
+
"vite": "^6.1.0"
|
|
55
|
+
},
|
|
56
|
+
"build": {
|
|
57
|
+
"appId": "com.adb-sqlite-viewer.app",
|
|
58
|
+
"productName": "ADB SQLite DevTools",
|
|
59
|
+
"directories": {
|
|
60
|
+
"output": "electron-dist"
|
|
61
|
+
},
|
|
62
|
+
"files": [
|
|
63
|
+
"electron/**/*",
|
|
64
|
+
"dist/**/*"
|
|
65
|
+
],
|
|
66
|
+
"extraResources": [
|
|
67
|
+
{
|
|
68
|
+
"from": "bridge/server.js",
|
|
69
|
+
"to": "bridge/server.js"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"from": "bridge/package.json",
|
|
73
|
+
"to": "bridge/package.json"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"from": "tools/",
|
|
77
|
+
"to": "tools/"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"from": "sqlite3-arm64",
|
|
81
|
+
"to": "sqlite3-arm64"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"win": {
|
|
85
|
+
"target": "nsis"
|
|
86
|
+
},
|
|
87
|
+
"linux": {
|
|
88
|
+
"target": "AppImage",
|
|
89
|
+
"category": "Development"
|
|
90
|
+
},
|
|
91
|
+
"publish": {
|
|
92
|
+
"provider": "github",
|
|
93
|
+
"owner": "amitwinit",
|
|
94
|
+
"repo": "SQLite-DevTools-Mobile-ReactNative"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|