Compare commits
9 Commits
v1.1.0
..
d81136fe5e
| Author | SHA1 | Date | |
|---|---|---|---|
| d81136fe5e | |||
| e43c4a7f2a | |||
| 07c9da8a80 | |||
| 4bdd4c1d8a | |||
| 336334c7f5 | |||
| a502ae2687 | |||
| 782d8446d9 | |||
| 5b79f5fb4b | |||
| a0f84ec78e |
@@ -2,3 +2,4 @@ __pycache__/
|
|||||||
.env
|
.env
|
||||||
frontend/node_modules/
|
frontend/node_modules/
|
||||||
static/dist/
|
static/dist/
|
||||||
|
venv/
|
||||||
@@ -1743,13 +1743,12 @@ def update_api_key(kid: int):
|
|||||||
|
|
||||||
@app.route("/api/api-keys/<int:kid>", methods=["DELETE"])
|
@app.route("/api/api-keys/<int:kid>", methods=["DELETE"])
|
||||||
@require_login
|
@require_login
|
||||||
def revoke_api_key(kid: int):
|
def delete_api_key(kid: int):
|
||||||
with db_cursor() as (_, cur):
|
with db_cursor() as (_, cur):
|
||||||
cur.execute(
|
cur.execute(
|
||||||
"""
|
"""
|
||||||
UPDATE api_keys
|
DELETE FROM api_keys
|
||||||
SET revoked_at = CURRENT_TIMESTAMP
|
WHERE id = %s
|
||||||
WHERE id = %s AND revoked_at IS NULL
|
|
||||||
""",
|
""",
|
||||||
(kid,),
|
(kid,),
|
||||||
)
|
)
|
||||||
|
|||||||
+26
-12
@@ -49,6 +49,10 @@ const showFolderForm = ref(false);
|
|||||||
const showEditHost = ref(false);
|
const showEditHost = ref(false);
|
||||||
const showAuditLog = ref(false);
|
const showAuditLog = ref(false);
|
||||||
const showApiKeys = ref(false);
|
const showApiKeys = ref(false);
|
||||||
|
const showSftpPanel = ref(false);
|
||||||
|
function toggleSftp() {
|
||||||
|
showSftpPanel.value = !showSftpPanel.value;
|
||||||
|
}
|
||||||
const auditLoading = ref(false);
|
const auditLoading = ref(false);
|
||||||
const auditErr = ref("");
|
const auditErr = ref("");
|
||||||
const auditRows = ref<ConnectionAuditRow[]>([]);
|
const auditRows = ref<ConnectionAuditRow[]>([]);
|
||||||
@@ -366,14 +370,14 @@ async function submitApiKey() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function revokeApiKey(id: number, label: string) {
|
async function deleteApiKey(id: number, label: string) {
|
||||||
if (!confirm(`Revoke API key "${label}"? This cannot be undone.`)) return;
|
if (!confirm(`Delete API key "${label}"? This cannot be undone.`)) return;
|
||||||
apiKeysErr.value = "";
|
apiKeysErr.value = "";
|
||||||
try {
|
try {
|
||||||
await api.revokeApiKey(id);
|
await api.deleteApiKey(id);
|
||||||
await refreshApiKeys();
|
await refreshApiKeys();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
apiKeysErr.value = e instanceof Error ? e.message : "Failed to revoke API key";
|
apiKeysErr.value = e instanceof Error ? e.message : "Failed to delete API key";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -692,27 +696,37 @@ async function deleteIdentityRow(id: number) {
|
|||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
|
<div class="flex items-center gap-2 truncate">
|
||||||
|
<span class="truncate text-sm font-semibold text-white">JDB-NET SSH</span>
|
||||||
<a
|
<a
|
||||||
href="https://git.jdbnet.co.uk/jamie/ssh"
|
href="https://git.jdbnet.co.uk/jamie/ssh"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
class="flex items-center gap-2 truncate"
|
class="truncate text-xs text-slate-400 hover:text-slate-300"
|
||||||
>
|
>
|
||||||
<span class="truncate text-sm font-semibold text-white">JDB-NET SSH</span>
|
{{ appVersion }}
|
||||||
<span class="truncate text-xs text-slate-400 hover:text-slate-300">{{ appVersion }}</span>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded-lg px-3 py-1.5 text-xs text-slate-400 hover:bg-slate-800 hover:text-white"
|
class="hidden rounded-lg px-3 py-1.5 text-xs md:inline-flex"
|
||||||
|
:class="showSftpPanel ? 'bg-slate-800 text-white' : 'text-slate-400 hover:bg-slate-800 hover:text-white'"
|
||||||
|
@click="toggleSftp"
|
||||||
|
>
|
||||||
|
SFTP
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="hidden rounded-lg px-3 py-1.5 text-xs text-slate-400 hover:bg-slate-800 hover:text-white md:inline-flex"
|
||||||
@click="openApiKeys"
|
@click="openApiKeys"
|
||||||
>
|
>
|
||||||
API keys
|
API keys
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded-lg px-3 py-1.5 text-xs text-slate-400 hover:bg-slate-800 hover:text-white"
|
class="hidden rounded-lg px-3 py-1.5 text-xs text-slate-400 hover:bg-slate-800 hover:text-white md:inline-flex"
|
||||||
@click="openAuditLog"
|
@click="openAuditLog"
|
||||||
>
|
>
|
||||||
Connection audit
|
Connection audit
|
||||||
@@ -1014,6 +1028,7 @@ async function deleteIdentityRow(id: number) {
|
|||||||
<TabContent
|
<TabContent
|
||||||
:host-id="t.hostId"
|
:host-id="t.hostId"
|
||||||
:visible="t.id === activeTabId"
|
:visible="t.id === activeTabId"
|
||||||
|
:show-sftp="showSftpPanel"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1139,12 +1154,11 @@ async function deleteIdentityRow(id: number) {
|
|||||||
<td class="px-2 py-2">{{ apiKeyStatus(row) }}</td>
|
<td class="px-2 py-2">{{ apiKeyStatus(row) }}</td>
|
||||||
<td class="px-2 py-2 text-right">
|
<td class="px-2 py-2 text-right">
|
||||||
<button
|
<button
|
||||||
v-if="row.active"
|
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded px-2 py-1 text-red-400 hover:bg-slate-800"
|
class="rounded px-2 py-1 text-red-400 hover:bg-slate-800"
|
||||||
@click="revokeApiKey(row.id, row.label)"
|
@click="deleteApiKey(row.id, row.label)"
|
||||||
>
|
>
|
||||||
Revoke
|
Delete
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
+1
-1
@@ -226,7 +226,7 @@ export const api = {
|
|||||||
return handle(res);
|
return handle(res);
|
||||||
},
|
},
|
||||||
|
|
||||||
async revokeApiKey(id: number): Promise<void> {
|
async deleteApiKey(id: number): Promise<void> {
|
||||||
const res = await fetch(`/api/api-keys/${id}`, {
|
const res = await fetch(`/api/api-keys/${id}`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import SftpPanel from "./SftpPanel.vue";
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
hostId: number;
|
hostId: number;
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
|
showSftp: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const termEl = ref<HTMLElement | null>(null);
|
const termEl = ref<HTMLElement | null>(null);
|
||||||
@@ -187,6 +188,7 @@ watch(
|
|||||||
class="h-full min-h-[320px] rounded-lg border border-slate-800 bg-[#0a0e12] p-1"
|
class="h-full min-h-[320px] rounded-lg border border-slate-800 bg-[#0a0e12] p-1"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<template v-if="showSftp">
|
||||||
<div
|
<div
|
||||||
v-if="connId"
|
v-if="connId"
|
||||||
class="hidden w-80 shrink-0 flex-col border-l border-slate-800 md:flex"
|
class="hidden w-80 shrink-0 flex-col border-l border-slate-800 md:flex"
|
||||||
@@ -199,5 +201,6 @@ watch(
|
|||||||
>
|
>
|
||||||
SFTP unlocks when the shell session is ready.
|
SFTP unlocks when the shell session is ready.
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Generated
-6
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "ssh",
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ ! -d "venv" ]; then
|
||||||
|
echo "Creating virtual environment in 'venv'..."
|
||||||
|
python3 -m venv venv
|
||||||
|
source venv/bin/activate
|
||||||
|
if [ -f "requirements.txt" ]; then
|
||||||
|
echo "Installing requirements..."
|
||||||
|
pip install -r requirements.txt
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
source venv/bin/activate
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building frontend..."
|
||||||
|
(
|
||||||
|
cd frontend
|
||||||
|
if [ ! -d "node_modules" ]; then
|
||||||
|
echo "Installing frontend dependencies..."
|
||||||
|
npm install
|
||||||
|
fi
|
||||||
|
npm run build
|
||||||
|
)
|
||||||
|
|
||||||
|
exec gunicorn --bind 0.0.0.0:5000 --workers 1 --worker-class geventwebsocket.gunicorn.workers.GeventWebSocketWorker app:app --log-level info
|
||||||
Reference in New Issue
Block a user