adb-sqlite-viewer 1.1.3 → 1.1.4
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.
|
@@ -60,4 +60,4 @@ var Lc=Object.defineProperty;var ka=n=>{throw TypeError(n)};var _c=(n,e,t)=>e in
|
|
|
60
60
|
</tbody>
|
|
61
61
|
</table>`}function oh(){const n=w("pagination");n.style.display="flex";const e=Math.floor(ne/J)+1,t=Math.ceil(ue/J);w("firstBtn").disabled=ne===0,w("prevBtn").disabled=ne===0,w("nextBtn").disabled=ne+J>=ue,w("lastBtn").disabled=ne+J>=ue,w("gotoPageInput").max=t,w("gotoPageInput").placeholder=`1-${t}`,w("pageInfo").textContent=`Page ${e} of ${t} (${ue.toLocaleString()} total rows)`}function ch(){ne>0&&ot(me,0)}function lh(){ne>0&&ot(me,ne-J)}function uh(){ne+J<ue&&ot(me,ne+J)}function hh(){if(ne+J<ue){const n=Math.floor((ue-1)/J)*J;ot(me,n)}}function Fa(){const n=parseInt(w("gotoPageInput").value),e=Math.ceil(ue/J);n>=1&&n<=e?(ot(me,(n-1)*J),w("gotoPageInput").value=""):alert(`Please enter a page number between 1 and ${e}`)}function dh(){const n=w("limitSelect").value;n==="all"?J=ue||1e5:J=parseInt(n),ne=0,me&&ot(me,0)}function fh(n){Lo=n,document.querySelectorAll(".tab").forEach(e=>{e.classList.toggle("active",e.dataset.tab===n)}),document.querySelectorAll(".tab-content").forEach(e=>e.classList.remove("active")),n==="query"?(w("queryTab").classList.add("active"),me&&ot(me)):n==="structure"&&(w("structureTab").classList.add("active"),me&&Do(me))}async function ph(){const n=w("statusBar");n.textContent="Refreshing tables...",D.dbPath="",await Ls(),await Io(),n.textContent="Tables refreshed",setTimeout(()=>n.textContent="Ready",3e3)}function wh(){w("queryInput").value="",w("resultsContainer").innerHTML="",w("welcomeMessage").style.display="block",w("statusBar").textContent="Ready",localStorage.removeItem("sqliteViewerQuery")}function gh(){const n=w("queryInput");let e=n.value;e=e.replace(/\s+/g," ").trim(),e=e.replace(/\b(SELECT|FROM|WHERE|AND|OR|ORDER BY|GROUP BY|LIMIT|JOIN|LEFT JOIN|RIGHT JOIN|INNER JOIN)\b/gi,`
|
|
62
62
|
$1`),e=e.replace(/,/g,`,
|
|
63
|
-
`),n.value=e}async function yh(){const n=w("statusBar");if(_r==="local"&&it.isOpen()){const e=it.db.export(),t=new Blob([e],{type:"application/octet-stream"});Va(t,it.fileName||"database.db"),n.textContent=`Downloaded ${it.fileName}`;return}if(D.mode!=="bridge"||!D.bridgeUrl){n.textContent="Download requires ADB Bridge connection";return}if(!X||!D.dbPath){n.textContent="Select a package and database first";return}n.textContent="Downloading database...";try{const e=await fetch(`${D.bridgeUrl}/api/pull-db`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serial:D.bridgeSerial||void 0,packageName:X,dbPath:D.dbPath})});if(!e.ok){const a=await e.json().catch(()=>({}));throw new Error(a.error||`HTTP ${e.status}`)}const t=await e.blob(),i=D.dbName||"database.db";Va(t,i),n.textContent=`Downloaded ${i}`}catch(e){n.textContent=`Download failed: ${e.message}`}}function Va(n,e){const t=URL.createObjectURL(n),i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)}async function mh(n){const e=n.target.files[0];if(!e)return;const t=w("statusBar");t.textContent=`Opening ${e.name}...`;try{const i=await e.arrayBuffer();await it.open(i,e.name),_r="local";const a=w("connectionStatus");a.textContent="Local File",a.className="connection-status bridge",w("localFileName").textContent=e.name,w("localFileBadge").classList.add("visible"),w("packageSearchInput").disabled=!0,w("packageSearchInput").placeholder="Local file mode",w("databaseSelect").disabled=!0,w("databaseSelect").innerHTML=`<option value="">${e.name}</option>`,await Ls(),t.textContent=`Opened ${e.name}`}catch(i){t.textContent=`Failed to open file: ${i.message}`,w("tablesList").innerHTML=`<div class="error" style="margin: 10px; font-size: 12px;">Failed to open file: ${i.message}</div>`}n.target.value=""}function bh(){if(it.close(),_r="device",w("localFileBadge").classList.remove("visible"),w("tablesList").innerHTML='<div class="info" style="margin: 10px; font-size: 12px;">Connect a USB device to get started.</div>',w("resultsContainer").innerHTML="",w("welcomeMessage").style.display="block",w("statusBar").textContent="Ready",w("pagination").style.display="none",D.mode==="bridge"?!!D.bridgeUrl:!!D.adb){const e=w("connectionStatus");e.textContent=D.mode==="bridge"?"ADB Bridge":"Connected",e.className=D.mode==="bridge"?"connection-status bridge":"connection-status connected",w("packageSearchInput").disabled=!1,w("packageSearchInput").placeholder=`Search ${Ye.length} debuggable apps...`,w("databaseSelect").disabled=!1}else w("connectionStatus").textContent="Disconnected",w("connectionStatus").className="connection-status disconnected",w("packageSearchInput").disabled=!0,w("packageSearchInput").placeholder="Connect device first...",w("databaseSelect").disabled=!0,w("databaseSelect").innerHTML='<option value="">Select a package first</option>'}const ji="1.1.
|
|
63
|
+
`),n.value=e}async function yh(){const n=w("statusBar");if(_r==="local"&&it.isOpen()){const e=it.db.export(),t=new Blob([e],{type:"application/octet-stream"});Va(t,it.fileName||"database.db"),n.textContent=`Downloaded ${it.fileName}`;return}if(D.mode!=="bridge"||!D.bridgeUrl){n.textContent="Download requires ADB Bridge connection";return}if(!X||!D.dbPath){n.textContent="Select a package and database first";return}n.textContent="Downloading database...";try{const e=await fetch(`${D.bridgeUrl}/api/pull-db`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serial:D.bridgeSerial||void 0,packageName:X,dbPath:D.dbPath})});if(!e.ok){const a=await e.json().catch(()=>({}));throw new Error(a.error||`HTTP ${e.status}`)}const t=await e.blob(),i=D.dbName||"database.db";Va(t,i),n.textContent=`Downloaded ${i}`}catch(e){n.textContent=`Download failed: ${e.message}`}}function Va(n,e){const t=URL.createObjectURL(n),i=document.createElement("a");i.href=t,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)}async function mh(n){const e=n.target.files[0];if(!e)return;const t=w("statusBar");t.textContent=`Opening ${e.name}...`;try{const i=await e.arrayBuffer();await it.open(i,e.name),_r="local";const a=w("connectionStatus");a.textContent="Local File",a.className="connection-status bridge",w("localFileName").textContent=e.name,w("localFileBadge").classList.add("visible"),w("packageSearchInput").disabled=!0,w("packageSearchInput").placeholder="Local file mode",w("databaseSelect").disabled=!0,w("databaseSelect").innerHTML=`<option value="">${e.name}</option>`,await Ls(),t.textContent=`Opened ${e.name}`}catch(i){t.textContent=`Failed to open file: ${i.message}`,w("tablesList").innerHTML=`<div class="error" style="margin: 10px; font-size: 12px;">Failed to open file: ${i.message}</div>`}n.target.value=""}function bh(){if(it.close(),_r="device",w("localFileBadge").classList.remove("visible"),w("tablesList").innerHTML='<div class="info" style="margin: 10px; font-size: 12px;">Connect a USB device to get started.</div>',w("resultsContainer").innerHTML="",w("welcomeMessage").style.display="block",w("statusBar").textContent="Ready",w("pagination").style.display="none",D.mode==="bridge"?!!D.bridgeUrl:!!D.adb){const e=w("connectionStatus");e.textContent=D.mode==="bridge"?"ADB Bridge":"Connected",e.className=D.mode==="bridge"?"connection-status bridge":"connection-status connected",w("packageSearchInput").disabled=!1,w("packageSearchInput").placeholder=`Search ${Ye.length} debuggable apps...`,w("databaseSelect").disabled=!1}else w("connectionStatus").textContent="Disconnected",w("connectionStatus").className="connection-status disconnected",w("packageSearchInput").disabled=!0,w("packageSearchInput").placeholder="Connect device first...",w("databaseSelect").disabled=!0,w("databaseSelect").innerHTML='<option value="">Select a package first</option>'}const ji="1.1.4",vh="amitwinit/SQLite-DevTools-Mobile-ReactNative";async function Eh(){if(!navigator.userAgent.includes("Electron"))try{const n=await fetch(`https://api.github.com/repos/${vh}/releases/latest`,{signal:AbortSignal.timeout(5e3)});if(!n.ok)return;const e=await n.json(),t=(e.tag_name||"").replace(/^v/,"");if(t&&t!==ji&&Sh(t,ji)){const i=w("updateBar");w("updateMessage").textContent=`Version ${t} is available (you have ${ji})`;const a=w("updateAction");a.textContent="Download",a.href=e.html_url,a.target="_blank",i.classList.add("visible")}}catch{}}function Sh(n,e){const t=n.split(".").map(Number),i=e.split(".").map(Number);for(let a=0;a<Math.max(t.length,i.length);a++){const l=t[a]||0,d=i[a]||0;if(l>d)return!0;if(l<d)return!1}return!1}
|
package/dist/index.html
CHANGED
package/electron/main.cjs
CHANGED
package/package.json
CHANGED