FIX: Removed temporary password

This commit is contained in:
Hayden Hargreaves 2025-02-20 19:43:44 -07:00
parent 97daa346bc
commit 84d0236c2c
2 changed files with 269 additions and 256 deletions

2
go.mod
View File

@ -8,6 +8,7 @@ require (
github.com/gin-gonic/gin v1.10.0
github.com/go-sql-driver/mysql v1.8.1
github.com/lib/pq v1.10.9
github.com/mattn/go-sqlite3 v1.14.22
)
require (
@ -30,7 +31,6 @@ require (
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect

View File

@ -1,16 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Database Query Tool</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
<script src="https://unpkg.com/htmx.org@2.0.1"></script>
<link rel="icon" type="image/png" href="/v1/web/assets/favicon.ico">
</head>
</head>
<body class="bg-gray-100">
<body class="bg-gray-100">
<div class="flex flex-col h-screen">
<!-- Top Bar -->
@ -20,9 +20,13 @@
<p class="text-sm text-gray-600">Connect and query your databases effortlessly.</p>
</div>
<div class="flex items-center justify-end space-x-4 flex-wrap">
<form hx-post="/v1/api/connections/connect" hx-trigger="change" hx-swap="outerHTML" hx-target="#connected-database" hx-indicator="#table-loading" hx-encoding="multipart/form-data" class="flex items-center justify-end space-x-2 flex-wrap">
<form hx-post="/v1/api/connections/connect" hx-trigger="change" hx-swap="outerHTML"
hx-target="#connected-database" hx-indicator="#table-loading" hx-encoding="multipart/form-data"
class="flex items-center justify-end space-x-2 flex-wrap">
<label for="connected-database" class="block text-sm font-medium text-gray-700">Connected Database:</label>
<select hx-get="/v1/web/connections" hx-trigger="load, change" hx-swap="outerHTML" id="connected-database" name="connected-database" hx-params="none" class="mt-1 block p-2 border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 text-sm md:text-base"></select>
<select hx-get="/v1/web/connections" hx-trigger="load, change" hx-swap="outerHTML" id="connected-database"
name="connected-database" hx-params="none"
class="mt-1 block p-2 border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 text-sm md:text-base"></select>
</form>
<button onclick="ShowModal();" class="bg-blue-500 text-white px-4 py-2 my-2 rounded-md text-sm md:text-base">
Add Connection
@ -41,7 +45,8 @@
<h2 class="text-lg font-bold">
<span id="database-name-tree">database</span>
</h2>
<button hx-get="/v1/web/connections/tree" hx-trigger="click" hx-swap="none" class="hover:bg-gray-100 p-2 rounded-md" hx-indicator="#table-loading">
<button hx-get="/v1/web/connections/tree" hx-trigger="click" hx-swap="none"
class="hover:bg-gray-100 p-2 rounded-md" hx-indicator="#table-loading">
<svg xmlns="http://www.w3.org/2000/svg" class="ionicon h-4 w-4" viewBox="0 0 512 512">
<path
d="M400 148l-21.12-24.57A191.43 191.43 0 00240 64C134 64 48 150 48 256s86 192 192 192a192.09 192.09 0 00181.07-128"
@ -51,7 +56,8 @@
</svg>
</button>
</div>
<div class="p-4 max-h-full" hx-get="/v1/web/connections/tree/table" hx-trigger="load" hx-params="none" hx-indicator="#table-loading" hx-target="#database-table-tree">
<div class="p-4 max-h-full" hx-get="/v1/web/connections/tree/table" hx-trigger="load" hx-params="none"
hx-indicator="#table-loading" hx-target="#database-table-tree">
<div class="w-full flex items-center justify-between border-b pb-4 pt-2">
<h2 class="text-lg text-gray-700">Tables</h2>
<p id="table-loading" class="text-xs font-light htmx-indicator">Loading...</p>
@ -59,7 +65,8 @@
<ul hx-swap-oob="outerHTML" id="database-table-tree" class="space-y-2"></ul>
</div>
<div class="p-4 max-h-full" hx-get="/v1/web/connections/tree/enum" hx-trigger="load" hx-params="none" hx-indicator="#enum-loading" hx-target="#database-enum-tree">
<div class="p-4 max-h-full" hx-get="/v1/web/connections/tree/enum" hx-trigger="load" hx-params="none"
hx-indicator="#enum-loading" hx-target="#database-enum-tree">
<div class="w-full flex items-center justify-between border-b pb-4 pt-2">
<h2 class="text-lg text-gray-700">Enums</h2>
<p id="enum-loading" class="text-xs font-light htmx-indicator">Loading...</p>
@ -76,13 +83,17 @@
<div class="flex items-center justify-between">
<label for="sql" class="block text-sm font-medium text-gray-700">SQL Query </label>
<div class="flex items-center space-x-6">
<form class="flex items-center space-x-2" hx-get="/v1/web/query/auto" hx-swap="outerHTML" hx-target="#query-main" hx-trigger="input">
<form class="flex items-center space-x-2" hx-get="/v1/web/query/auto" hx-swap="outerHTML"
hx-target="#query-main" hx-trigger="input">
<label for="auto-toggle" class="text-sm font-medium text-gray-700">Auto-Run</label>
<input type="checkbox" name="toggle" class="toggle-checkbox" title="Toggle auto-query functionality. Note: This will send whatever query is in the input and clear the box.">
<input type="checkbox" name="toggle" class="toggle-checkbox"
title="Toggle auto-query functionality. Note: This will send whatever query is in the input and clear the box.">
</form>
<!-- Manual Query Button -->
<button hx-post="/v1/api/query" hx-trigger="click" hx-swap="outerHTML" hx-target="#query-results" hx-indicator="#spinner" hx-include="#sql" class="bg-blue-500 text-white py-2 px-3 rounded-md text-xs md:text-sm">Run Query</button>
<button hx-post="/v1/api/query" hx-trigger="click" hx-swap="outerHTML" hx-target="#query-results"
hx-indicator="#spinner" hx-include="#sql"
class="bg-blue-500 text-white py-2 px-3 rounded-md text-xs md:text-sm">Run Query</button>
<!-- Auto Query Button -->
<!-- <button class="bg-blue-500 text-white py-2 px-3 rounded-md text-xs md:text-sm opacity-60 cursor-default" title="Disable Auto-Run to use manual queries." disabled>Run Query</button> -->
@ -90,7 +101,8 @@
</div>
<!-- Manual Query Input -->
<textarea id="sql" name="sql" rows="4" class="mt-1 block w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm"></textarea>
<textarea id="sql" name="sql" rows="4"
class="mt-1 block w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm"></textarea>
<!-- Auto Query Input -->
<!-- <textarea id="sql" name="sql" rows="4" class="mt-1 block w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm" hx-post="/v1/api/query" hx-trigger="input delay:500ms" hx-swap="outerHTML" hx-target="#query-results" hx-indicator="#spinner"></textarea> -->
@ -193,7 +205,8 @@
</div>
<div>
<label for="db-driver" class="block text-sm font-medium text-gray-700">Driver/Type of Database</label>
<select id="db-driver" name="db-driver" class="mt-1 block w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
<select id="db-driver" name="db-driver"
class="mt-1 block w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
<option value="postgres">PostgreSQL</option>
<option value="mysql">MySQL</option>
<option value="sqlite3">SQLite</option>
@ -235,7 +248,7 @@
</label>
<input id="db-url" name="db-url" type="password"
placeholder="postgresql://admin:password@127.0.0.1:5432/master_database"
value="postgresql://azpect:Panther4487!!!!@127.0.0.1:5432/azpect?sslmode=disable"
value="postgresql://user:password@127.0.0.1:5432/database?sslmode=disable"
class="mt-1 block w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
<span id="db-url-invalid" class="text-xs text-red-500 hidden">Connection URL is incomplete or
invalid.</span>
@ -267,6 +280,6 @@
<script src="/v1/web/static/scripts/password.js"></script>
<script src="/v1/web/static/scripts/modal.js"></script>
<script src="/v1/web/static/scripts/tree.js"></script>
</body>
</body>
</html>