antigravity-tc 1.1.2 → 1.1.3

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/README.id.md ADDED
@@ -0,0 +1,127 @@
1
+ <div align="center">
2
+
3
+ <img src="images/antigravity-tc.jpg" alt="Antigravity Token Collector" width="860" />
4
+
5
+ # Antigravity Token Collector
6
+
7
+ **Kumpulkan donasi token Antigravity dari siapa saja — langsung masuk ke database [9Router](https://github.com/decolua/9router) Anda.**
8
+
9
+ [English](README.md) | Bahasa Indonesia (Tersedia dalam 2 Bahasa / Available in 2 Languages)
10
+
11
+ [![npm version](https://img.shields.io/npm/v/antigravity-tc.svg)](https://www.npmjs.com/package/antigravity-tc)
12
+ [![License: MIT](https://img.shields.io/badge/License-MIT-22c55e.svg)](LICENSE)
13
+ [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-14b8a6.svg)](#-dukungan-platform)
14
+ [![Node](https://img.shields.io/badge/node-%3E%3D20-fdba74.svg)]()
15
+
16
+ Tray app + dashboard untuk mengelola donasi token: halaman donasi publik, portal yang bisa dikustom, multi bahasa, tunnel gratis tanpa expose IP, auto-start saat login, dan sync massal dua arah dengan 9Router.
17
+
18
+ </div>
19
+
20
+ ---
21
+
22
+ ## ⚡ Quick Start
23
+
24
+ ```bash
25
+ npm install -g antigravity-tc
26
+ antigravity-tc
27
+ ```
28
+
29
+ Dashboard terbuka di `http://localhost:3456/dashboard` — tray icon muncul di menubar.
30
+
31
+ > Password default: `1234567890`. Segera ganti di **Pengaturan → Keamanan**.
32
+ >
33
+ > Lupa password? Jalankan `antigravity-tc-reset-password`.
34
+
35
+ ## 🔄 Cara Kerja
36
+
37
+ 1. Jalankan `antigravity-tc`.
38
+ 2. Buat link donasi personal dari dashboard, atau aktifkan tunnel publik.
39
+ 3. Donatur login Google + tempel kode.
40
+ 4. Token dicek eligibility, di-refresh bila expired, lalu bisa disinkronkan ke 9Router.
41
+ 5. Halaman depan bisa disesuaikan dari **Pengaturan → Portal Settings**.
42
+
43
+ ## 🖼️ Tampilan
44
+
45
+ | Dashboard | Sync Massal | Pengaturan |
46
+ | :---: | :---: | :---: |
47
+ | ![Dashboard](images/Dashboard.jpg) | ![Sync](images/Sync.jpg) | ![Pengaturan](images/Pengaturan.jpg) |
48
+
49
+ ## 📋 Fitur
50
+
51
+ | Fitur | Keterangan |
52
+ | --- | --- |
53
+ | Halaman donasi publik | Login Google + tempel kode, token dicek eligibility lalu disimpan |
54
+ | Portal Settings | Atur layout dan kata-kata halaman depan; data disimpan di aplikasi, bukan DB 9Router |
55
+ | Multi bahasa | Default English, tersedia Bahasa Indonesia, mudah ditambah bahasa baru |
56
+ | Generate link personal | `?for=Nama` untuk sapaan otomatis |
57
+ | Dashboard admin | Statistik, tabel live, search, filter, export/import CSV |
58
+ | Sync ke 9Router | Upsert semua donation logs ke providerConnections 9Router |
59
+ | Sync dari 9Router | Ambil providerConnections 9Router ke donation logs lokal |
60
+ | Check ALL Eligibility | Cek semua row bertoken dengan jeda aman dan rekap status |
61
+ | Auto refresh token | Token expired dicoba refresh sebelum check eligibility |
62
+ | Tunnel publik gratis | Cloudflare Quick Tunnel untuk URL publik |
63
+ | Restart Services | Restart dari tray atau tombol Settings setelah perubahan config |
64
+ | Auto start | Berjalan otomatis mode tray saat OS login |
65
+ | Keamanan | Login JWT, secret unik per instalasi, tunnel terkunci selama password default |
66
+
67
+ ## 📁 Lokasi Data
68
+
69
+ ### Database 9Router
70
+
71
+ | OS | Lokasi Default |
72
+ | --- | --- |
73
+ | macOS / Linux | `~/.9router/db/data.sqlite` |
74
+ | Windows | `%APPDATA%/9router/db/data.sqlite` |
75
+ | Docker | `/app/data/db/data.sqlite` |
76
+
77
+ Path bisa diganti via **Dashboard → Pengaturan → Database 9Router** atau env `DB_PATH`. Perubahan path perlu restart aplikasi.
78
+
79
+ ### Data ATC
80
+
81
+ | OS | Lokasi |
82
+ | --- | --- |
83
+ | macOS / Linux | `~/.antigravity-tc/` |
84
+ | Windows | `%USERPROFILE%\.antigravity-tc\` |
85
+ | Docker | `/root/.antigravity-tc/` |
86
+
87
+ | Isi | Keterangan |
88
+ | --- | --- |
89
+ | `.env` | Konfigurasi lokal |
90
+ | `logs/donation-logs.sqlite` | Log donasi |
91
+ | `bin/cloudflared` | Binary tunnel |
92
+ | Config aplikasi | Password admin, portal settings, bahasa, auto-start, path DB |
93
+
94
+ ## 🖥️ Dukungan Platform
95
+
96
+ | Kemampuan | macOS | Linux | Windows | Docker |
97
+ | --- | :---: | :---: | :---: | :---: |
98
+ | Server + Dashboard + halaman donasi | ✅ | ✅ | ✅ | ✅ |
99
+ | Tray icon | ✅ | ✅ | ✅ | — |
100
+ | Auto-start saat login | ✅ | ✅ | ✅ | — |
101
+ | Cloudflare Tunnel | ✅ | ✅ | ✅ | ✅ |
102
+ | Path DB 9Router otomatis per OS | ✅ | ✅ | ✅ | ✅ |
103
+
104
+ ## 🔑 Password & `.env`
105
+
106
+ - Password default: `1234567890`.
107
+ - Prioritas password: dashboard > `APP_PASSWORD` > default.
108
+ - Kredensial OAuth publik Antigravity CLI sudah tertanam bawaan.
109
+ - Override `OAUTH_CLIENT_ID` / `OAUTH_CLIENT_SECRET` tersedia bila perlu.
110
+
111
+ ## ❓ Troubleshooting
112
+
113
+ | Masalah | Solusi |
114
+ | --- | --- |
115
+ | Lupa password admin | Jalankan `antigravity-tc-reset-password` |
116
+ | Tunnel tidak bisa diaktifkan | Ganti password default dulu |
117
+ | Tray icon tidak muncul | Pastikan binary `systray2/traybin/` executable |
118
+ | DB 9Router tidak ketemu | Cek path di Pengaturan → Database 9Router, lalu restart services |
119
+ | Refresh token gagal | Donatur perlu login ulang bila Google menolak refresh token |
120
+
121
+ ## 🛠️ Development
122
+
123
+ Lihat [dev.md](dev.md) dan [build.md](build.md).
124
+
125
+ ## 📄 License
126
+
127
+ [MIT](LICENSE) © decolua and contributors
package/README.md CHANGED
@@ -4,14 +4,16 @@
4
4
 
5
5
  # Antigravity Token Collector
6
6
 
7
- **Kumpulkan donasi token Antigravity dari siapa saja langsung masuk ke database [9Router](https://github.com/decolua/9router) Anda.**
7
+ **Collect donated Antigravity tokens from anyone and sync them into your [9Router](https://github.com/decolua/9router) database.**
8
+
9
+ English | [Bahasa Indonesia](README.id.md) (Tersedia dalam 2 Bahasa / Available in 2 Languages)
8
10
 
9
11
  [![npm version](https://img.shields.io/npm/v/antigravity-tc.svg)](https://www.npmjs.com/package/antigravity-tc)
10
12
  [![License: MIT](https://img.shields.io/badge/License-MIT-22c55e.svg)](LICENSE)
11
- [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-14b8a6.svg)](#-dukungan-platform)
13
+ [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux%20%7C%20Windows-14b8a6.svg)](#-platform-support)
12
14
  [![Node](https://img.shields.io/badge/node-%3E%3D20-fdba74.svg)]()
13
15
 
14
- Tray app + dashboard untuk mengelola donasi token: halaman donasi publik, tunnel gratis tanpa expose IP, auto-start saat login, dan sync massal ke 9Router.
16
+ A tray app and dashboard for managing donated Antigravity tokens: customizable public portal, multilingual copy, free public tunnel, login auto-start, eligibility checks, and two-way 9Router sync.
15
17
 
16
18
  </div>
17
19
 
@@ -24,112 +26,102 @@ npm install -g antigravity-tc
24
26
  antigravity-tc
25
27
  ```
26
28
 
27
- 🎉 Dashboard terbuka di `http://localhost:3456/dashboard` tray icon muncul di menubar.
28
-
29
- __That's it!__ 🚀
29
+ The dashboard opens at `http://localhost:3456/dashboard`, and the tray icon appears in your menu bar/system tray.
30
30
 
31
- > 💡 Password default: `1234567890` hint tampil di halaman login selama belum diganti. Segera ganti di **PengaturanKeamanan**.
31
+ > Default password: `1234567890`. Change it immediately in **SettingsSecurity**.
32
32
  >
33
- > 🔑 **Lupa password?** Jalankan `antigravity-tc-reset-password` di terminal untuk meresetnya kembali ke default.
34
-
35
- ## 🔄 Cara Kerja
33
+ > Forgot your password? Run `antigravity-tc-reset-password`.
36
34
 
37
- ```
38
- ┌──────────────────┐ ┌─────────────────────┐ ┌──────────────────┐
39
- │ Donatur │ │ ATC (Anda) │ │ 9Router │
40
- │ │ │ │ │ │
41
- │ Login Google ───┼──────▶ │ Cek eligibility ───┼──────▶ │ Token tersimpan │
42
- │ lewat link yang │ │ Refresh otomatis │ │ siap dipakai │
43
- │ Anda bagikan │ │ Anti-duplikat │ │ │
44
- └──────────────────┘ └─────────────────────┘ └──────────────────┘
45
- ```
35
+ ## 🔄 How It Works
46
36
 
47
- 1. Jalankan `antigravity-tc` — dashboard & tray aktif.
48
- 2. Buat **link donasi personal** dari dashboard (Generate Link), bagikan lewat chat mana pun — atau aktifkan **tunnel publik** gratis supaya bisa diakses dari luar tanpa expose IP.
49
- 3. Donatur login Google + tempel kode token otomatis dicek, di-refresh bila expired, lalu tersimpan ke 9Router.
37
+ 1. Run `antigravity-tc`.
38
+ 2. Generate a personal donation link from the dashboard, or enable the public tunnel.
39
+ 3. Donors sign in with Google and paste the Antigravity code.
40
+ 4. ATC checks eligibility, refreshes tokens when needed, and stores donation logs locally.
41
+ 5. Sync eligible tokens into 9Router when you are ready.
42
+ 6. Customize the public portal wording and layout from **Settings → Portal Settings**.
50
43
 
51
- ## 🖼️ Tampilan
44
+ ## 🖼️ Screenshots
52
45
 
53
- | Dashboard | Sync Massal | Pengaturan |
46
+ | Dashboard | Bulk Sync | Settings |
54
47
  | :---: | :---: | :---: |
55
- | ![Dashboard](images/Dashboard.jpg) | ![Sync](images/Sync.jpg) | ![Pengaturan](images/Pengaturan.jpg) |
48
+ | ![Dashboard](images/Dashboard.jpg) | ![Sync](images/Sync.jpg) | ![Settings](images/Pengaturan.jpg) |
56
49
 
57
- ## 📋 Fitur
50
+ ## 📋 Features
58
51
 
59
- | Fitur | Keterangan |
52
+ | Feature | Description |
60
53
  | --- | --- |
61
- | 🌐 Halaman donasi publik | Login Google + tempel kode, token dicek eligibility lalu disimpan |
62
- | 🔗 Generate link personal | `?for=Nama` sapaan otomatis untuk tiap calon donatur |
63
- | 📊 Dashboard admin | Statistik, tabel live, export & import CSV, generate link |
64
- | 🔄 Sync massal ke 9Router | Upsert semua data sekaligus dengan log terminal realtime |
65
- | Auto refresh token | Token expired otomatis di-refresh Google saat check eligibility |
66
- | 🌐 Tunnel publik gratis | Cloudflare Quick Tunnel URL `*.trycloudflare.com` siap dibagikan |
67
- | 🚀 Auto start | Berjalan otomatis (mode tray) saat OS login |
68
- | 🔒 Keamanan | Login JWT (secret unik per instalasi), tunnel terkunci selama password default |
69
-
70
- ## 📁 Data Location
71
-
72
- Lokasi default **mengikuti OS tempat package di-install** tanpa konfigurasi tambahan:
73
-
74
- ### Database 9Router (target penyimpanan token)
75
-
76
- | OS | Lokasi Default |
54
+ | Public donation portal | Google login + manual code paste flow for donors |
55
+ | Portal Settings | Customize layout and front-page wording; stored in ATC app config, not 9Router DB |
56
+ | Multilingual setup | English by default, Indonesian included, designed for adding more languages later |
57
+ | Personal donation links | `?for=Name` automatically customizes the greeting |
58
+ | Admin dashboard | Stats, live table, search, status/source filters, CSV import/export |
59
+ | Sync to 9Router | Upsert local donation logs into 9Router `providerConnections` |
60
+ | Sync from 9Router | Import 9Router `providerConnections` back into local donation logs |
61
+ | Check ALL Eligibility | Check all token rows with per-row delay and status recap |
62
+ | Token refresh | Expired access tokens are refreshed before eligibility checks when possible |
63
+ | Free public tunnel | Cloudflare Quick Tunnel gives you a public URL without exposing your IP |
64
+ | Restart Services | Restart from tray or Settings after config changes such as 9Router DB path |
65
+ | Auto-start | Launches in tray mode when the OS starts |
66
+ | Security | JWT admin login, per-install secret, tunnel blocked while default password is active |
67
+
68
+ ## 📁 Data Locations
69
+
70
+ ### 9Router database
71
+
72
+ | OS | Default path |
77
73
  | --- | --- |
78
74
  | macOS / Linux | `~/.9router/db/data.sqlite` |
79
75
  | Windows | `%APPDATA%/9router/db/data.sqlite` |
80
- | Docker | `/app/data/db/data.sqlite` (mount volume untuk persist) |
76
+ | Docker | `/app/data/db/data.sqlite` |
81
77
 
82
- > Path ini bisa dioverride kapan saja via **Dashboard → Pengaturan → Database 9Router** (untuk instalasi non-standar) atau env `DB_PATH`.
78
+ You can override this path from **Dashboard → Settings9Router Database** or by setting `DB_PATH`. Restart services after changing it.
83
79
 
84
- ### Data ATC (log donasi, binary tunnel, config)
80
+ ### ATC app data
85
81
 
86
- | OS | Lokasi |
82
+ | OS | Path |
87
83
  | --- | --- |
88
84
  | macOS / Linux | `~/.antigravity-tc/` |
89
85
  | Windows | `%USERPROFILE%\.antigravity-tc\` |
90
- | Docker | `/root/.antigravity-tc/` (mount `$HOME/.antigravity-tc` untuk persist) |
86
+ | Docker | `/root/.antigravity-tc/` |
91
87
 
92
- | Isi | Keterangan |
88
+ | Content | Description |
93
89
  | --- | --- |
94
- | `.env` | Konfigurasi dibuat otomatis dari `env.example` saat pertama kali jalan |
95
- | `logs/donation-logs.sqlite` | Log donasi (auto-migrasi dari instalasi lama) |
96
- | `bin/cloudflared` | Binary tunnel (auto-download per OS) |
97
- | `logs/launcher.log` | Log saat auto-start |
90
+ | `.env` | Local environment configuration |
91
+ | `logs/donation-logs.sqlite` | Donation log database |
92
+ | `bin/cloudflared` | Downloaded tunnel binary |
93
+ | App config | Admin password, portal settings, language, auto-start, 9Router DB path |
98
94
 
99
- ## 🖥️ Dukungan Platform
95
+ ## 🖥️ Platform Support
100
96
 
101
- | Kemampuan | macOS | Linux | Windows | Docker |
97
+ | Capability | macOS | Linux | Windows | Docker |
102
98
  | --- | :---: | :---: | :---: | :---: |
103
- | Server + Dashboard + halaman donasi | ✅ | ✅ | ✅ | ✅ |
99
+ | Server + dashboard + public portal | ✅ | ✅ | ✅ | ✅ |
104
100
  | Tray icon | ✅ | ✅ | ✅ | — |
105
- | Auto-start saat login | ✅ | ✅ | ✅ | — (pakai restart policy) |
101
+ | Login auto-start | ✅ | ✅ | ✅ | — |
106
102
  | Cloudflare Tunnel | ✅ | ✅ | ✅ | ✅ |
107
- | Path DB 9Router otomatis per OS | ✅ | ✅ | ✅ | ✅ |
108
-
109
- > Docker: jalankan dengan `antigravity-tc --hidden` sebagai entrypoint dan mount volume data (lihat tabel di atas). Deteksi Docker otomatis memakai path `/app/data/db/data.sqlite`.
103
+ | Automatic 9Router DB path detection | ✅ | ✅ | ✅ | ✅ |
110
104
 
111
105
  ## 🔑 Password & `.env`
112
106
 
113
- - Password: default `1234567890` → ganti via dashboard, atau set `APP_PASSWORD` di `.env`.
114
- - Prioritas: password dari dashboard > `APP_PASSWORD` > default.
115
- - Kredensial OAuth **sudah tertanam bawaan** (memakai kredensial publik Antigravity CLI) `.env` hanya perlu diisi `PORT`/`APP_PASSWORD` bila mau. Override `OAUTH_CLIENT_ID`/`OAUTH_CLIENT_SECRET` tersedia untuk OAuth client sendiri.
107
+ - Default password: `1234567890`.
108
+ - Password priority: dashboard setting > `APP_PASSWORD` > default.
109
+ - The public Antigravity CLI OAuth credentials are bundled by default.
110
+ - You can still override `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` if needed.
116
111
 
117
112
  ## ❓ Troubleshooting
118
113
 
119
- | Masalah | Solusi |
114
+ | Problem | Fix |
120
115
  | --- | --- |
121
- | Lupa password admin | Jalankan `antigravity-tc-reset-password` (tambah `--yes` untuk tanpa konfirmasi) |
122
- | Tunnel tidak bisa diaktifkan | Ganti password default dulu di Pengaturan → Keamanan |
123
- | Tray icon tidak muncul | Pastikan binary `systray2/traybin/` executable |
124
- | Sudah berjalan tapi tidak bisa dibuka lagi | App single-instance cukup klik tray icon |
125
- | Refresh token gagal | Cek koneksi; kredensial OAuth sudah bawaan atau isi `OAUTH_CLIENT_ID` & `OAUTH_CLIENT_SECRET` di `.env` untuk client sendiri |
126
- | DB 9Router tidak ketemu | Cek path di Pengaturan → Database 9Router |
127
-
128
- ---
116
+ | Forgot admin password | Run `antigravity-tc-reset-password` |
117
+ | Tunnel cannot be enabled | Change the default password first |
118
+ | Tray icon missing | Make sure the `systray2/traybin/` binary is executable |
119
+ | 9Router DB not found | Check Settings 9Router Database, then restart services |
120
+ | Refresh token fails | The donor may need to sign in again if Google rejects the refresh token |
129
121
 
130
122
  ## 🛠️ Development
131
123
 
132
- Untuk menjalankan dari source, development, dan build/publish mandiri — lihat **[dev.md](dev.md)** dan **[build.md](build.md)**.
124
+ See [dev.md](dev.md) and [build.md](build.md).
133
125
 
134
126
  ## 📄 License
135
127
 
package/index.js CHANGED
@@ -30,6 +30,7 @@ let releaseLock = null;
30
30
  let trayManager = null;
31
31
  let menuOpen = false;
32
32
  let isHandoffInProgress = false;
33
+ let isRestartInProgress = false;
33
34
 
34
35
  async function acquireSingleInstanceLock() {
35
36
  if (!fs.existsSync(LOCK_FILE_PATH)) {
@@ -47,7 +48,7 @@ async function acquireSingleInstanceLock() {
47
48
  }
48
49
  }
49
50
 
50
- async function cleanupAndExit(exitCode = 0) {
51
+ async function prepareShutdown() {
51
52
  try {
52
53
  const tunnelManager = getTunnelManager();
53
54
  if (tunnelManager) {
@@ -65,7 +66,13 @@ async function cleanupAndExit(exitCode = 0) {
65
66
 
66
67
  try {
67
68
  if (server.listening) {
68
- await new Promise((resolve) => server.close(() => resolve()));
69
+ await new Promise((resolve) => {
70
+ const timer = setTimeout(() => resolve(), 300);
71
+ server.close(() => {
72
+ clearTimeout(timer);
73
+ resolve();
74
+ });
75
+ });
69
76
  }
70
77
  } catch (error) {}
71
78
 
@@ -75,10 +82,40 @@ async function cleanupAndExit(exitCode = 0) {
75
82
  releaseLock = null;
76
83
  }
77
84
  } catch (error) {}
85
+ }
78
86
 
87
+ async function cleanupAndExit(exitCode = 0) {
88
+ await prepareShutdown();
79
89
  process.exit(exitCode);
80
90
  }
81
91
 
92
+ async function restartServices(port = configuredPort) {
93
+ if (isRestartInProgress) return;
94
+ isRestartInProgress = true;
95
+ await prepareShutdown();
96
+
97
+ // Beri jeda kecil agar OS melepaskan lock file sepenuhnya
98
+ await new Promise((resolve) => setTimeout(resolve, 500));
99
+
100
+ const logFile = '/tmp/antigravity-tc-restart.log';
101
+ const out = fs.openSync(logFile, 'a');
102
+ const err = fs.openSync(logFile, 'a');
103
+
104
+ fs.writeSync(out, `\n--- RESTART SPARKED AT ${new Date().toISOString()} ---\n`);
105
+
106
+ const child = spawn(process.execPath, [path.join(__dirname, 'index.js'), '--hidden'], {
107
+ cwd: process.cwd(),
108
+ detached: true,
109
+ stdio: ['ignore', out, err],
110
+ env: {
111
+ ...process.env,
112
+ PORT: String(port),
113
+ },
114
+ });
115
+ child.unref();
116
+ process.exit(0);
117
+ }
118
+
82
119
  async function releaseInstanceLock() {
83
120
  if (!releaseLock) return;
84
121
  try {
@@ -144,6 +181,7 @@ async function main() {
144
181
  trayManager = new TrayManager({ config, port });
145
182
  await trayManager.start();
146
183
  trayManager.on('exit', () => cleanupAndExit(0));
184
+ trayManager.on('restart', () => restartServices(port));
147
185
 
148
186
  const menuContext = {
149
187
  trayManager,
@@ -158,6 +196,10 @@ async function main() {
158
196
  }
159
197
  }
160
198
 
199
+ process.on('antigravity-restart', () => {
200
+ restartServices(configuredPort);
201
+ });
202
+
161
203
  process.on('SIGINT', () => {
162
204
  cleanupAndExit(0);
163
205
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antigravity-tc",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Antigravity Token Collector — tray app untuk mengumpulkan & mengelola donasi token Antigravity ke 9Router",
5
5
  "main": "index.js",
6
6
  "bin": {