Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

private keys view

Andras Bacsaife51f8fbf7da
diff --git a/resources/js/components/MagicBar.vue b/resources/js/components/MagicBar.vue
index c7cc046867..b6727956c3 100644
--- a/resources/js/components/MagicBar.vue
+++ b/resources/js/components/MagicBar.vue
@@ -307,54 +307,60 @@ const magicActions = [{
},
{
id: 10,
- name: 'Goto: Projects',
+ name: 'Goto: Private Keys',
icon: 'goto',
sequence: ['main', 'redirect']
},
{
id: 11,
- name: 'Goto: Sources',
+ name: 'Goto: Projects',
icon: 'goto',
sequence: ['main', 'redirect']
},
{
id: 12,
- name: 'Goto: Destinations',
+ name: 'Goto: Sources',
icon: 'goto',
sequence: ['main', 'redirect']
},
{
id: 13,
- name: 'Goto: Settings',
+ name: 'Goto: Destinations',
icon: 'goto',
sequence: ['main', 'redirect']
},
{
id: 14,
- name: 'Goto: Command Center',
+ name: 'Goto: Settings',
icon: 'goto',
sequence: ['main', 'redirect']
},
{
id: 15,
- name: 'Goto: Notifications',
+ name: 'Goto: Command Center',
icon: 'goto',
sequence: ['main', 'redirect']
},
{
id: 16,
- name: 'Goto: Profile',
+ name: 'Goto: Notifications',
icon: 'goto',
sequence: ['main', 'redirect']
},
{
id: 17,
- name: 'Goto: Teams',
+ name: 'Goto: Profile',
icon: 'goto',
sequence: ['main', 'redirect']
},
{
id: 18,
+ name: 'Goto: Teams',
+ icon: 'goto',
+ sequence: ['main', 'redirect']
+},
+{
+ id: 19,
name: 'Goto: Switch Teams',
icon: 'goto',
sequence: ['main', 'redirect']
@@ -545,32 +551,35 @@ async function redirect() {
targetUrl.pathname = `/servers`
break;
case 10:
- targetUrl.pathname = `/projects`
+ targetUrl.pathname = `/private-keys`
break;
case 11:
- targetUrl.pathname = `/sources`
+ targetUrl.pathname = `/projects`
break;
case 12:
- targetUrl.pathname = `/destinations`
+ targetUrl.pathname = `/sources`
break;
case 13:
- targetUrl.pathname = `/settings`
+ targetUrl.pathname = `/destinations`
break;
case 14:
- targetUrl.pathname = `/command-center`
+ targetUrl.pathname = `/settings`
break;
case 15:
- targetUrl.pathname = `/profile/team/notifications`
+ targetUrl.pathname = `/command-center`
break;
case 16:
- targetUrl.pathname = `/profile`
+ targetUrl.pathname = `/profile/team/notifications`
break;
case 17:
- targetUrl.pathname = `/profile/team`
+ targetUrl.pathname = `/profile`
break;
case 18:
targetUrl.pathname = `/profile/team`
break;
+ case 19:
+ targetUrl.pathname = `/profile/team`
+ break;
}
window.location.href = targetUrl;
}
diff --git a/resources/views/components/forms/input.blade.php b/resources/views/components/forms/input.blade.php
index 4c15f47f0d..50daa43d55 100644
--- a/resources/views/components/forms/input.blade.php
+++ b/resources/views/components/forms/input.blade.php
@@ -7,6 +7,7 @@
'disabled' => null,
'helper' => $attributes->has('helper'),
'noDirty' => $attributes->has('noDirty'),
+ 'cannotPeak' => $attributes->has('cannotPeak'),
])
<div {{ $attributes->merge(['class' => 'w-full form-control']) }}>
@if ($label)
@@ -37,31 +38,52 @@
@endif
@if ($type === 'password')
<div class="join" x-data>
- <input class="w-full border-r-0 rounded-l join-item" type={{ $type }}
- @if ($id) id={{ $id }} name={{ $id }} wire:model.defer={{ $id }} @endisset
+ <input class="w-full join-item" type={{ $type }} @class([
+ 'border-r-0 rounded-l' => $cannotPeak,
+ ]) @if ($id) id={{ $id }} name={{ $id }}
+ wire:model.defer={{ $id }} @endisset
@if ($disabled !== null) disabled @endif
- @if ($required !== null) required @endif @if ($readonly !== null) readonly @endif
- @if (!$noDirty && $id) wire:dirty.class="input-warning" @endif {{ $attributes }} />
- <span x-on:click="changePasswordFieldType('{{ $id }}')" x-cloak
- class="border-l-0 border-none rounded-r hover:bg-coolgray-200 no-animation h-7 btn join-item btn-xs bg-coolgray-200 "><svg
- xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 icon" viewBox="0 0 24 24" stroke-width="1.5"
- stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
- <path stroke="none" d="M0 0h24v24H0z" fill="none" />
- <path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
- <path d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6" />
- </svg></span>
- </div>
- @else
- <input type={{ $type }}
- @if ($id) name={{ $id }} wire:model.defer={{ $id }} @endisset
+ @if ($required !== null) required @endif @if ($readonly !== null) readonly @endif
+ @if (!$noDirty && $id) wire:dirty.class="input-warning"
+ @endif {{ $attributes }} />
+ @if (!$cannotPeak)
+ @if (!$disabled)
+ <span x-on:click="changePasswordFieldType('{{ $id }}')" x-cloak
+ class="border-l-0 border-none rounded-r hover:bg-coolgray-200 no-animation h-7 btn join-item btn-xs bg-coolgray-200 "><svg
+ xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 icon" viewBox="0 0 24 24"
+ stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
+ stroke-linejoin="round">
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
+ <path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
+ <path
+ d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6" />
+ </svg></span>
+ @else
+ <span x-on:click="changePasswordFieldType('{{ $id }}')" x-cloak
+ class="text-opacity-25 border-l-0 rounded-r bg-coolgray-200/50 hover:bg-coolgray-200/50 no-animation h-7 btn join-item btn-xs"><svg
+ xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 icon" viewBox="0 0 24 24"
+ stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
+ stroke-linejoin="round">
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
+ <path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
+ <path
+ d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6" />
+ </svg>
+ </span>
+ @endif
+ @endif
+ </div>
+@else
+ <input type={{ $type }}
+ @if ($id) name={{ $id }} wire:model.defer={{ $id }} @endisset
@if ($disabled !== null) disabled @endif
- @if ($required !== null) required @endif @if ($readonly !== null) readonly @endif
- @if (!$noDirty && $id) wire:dirty.class="input-warning" @endif {{ $attributes }} />
- @endif
+ @if ($required !== null) required @endif @if ($readonly !== null) readonly @endif
+ @if (!$noDirty && $id) wire:dirty.class="input-warning" @endif {{ $attributes }} />
+@endif
- @error($id)
- <label class="label">
- <span class="text-red-500 label-text-alt">{{ $message }}</span>
- </label>
- @enderror
+@error($id)
+ <label class="label">
+ <span class="text-red-500 label-text-alt">{{ $message }}</span>
+ </label>
+@enderror
</div>
diff --git a/resources/views/livewire/private-key/change.blade.php b/resources/views/livewire/private-key/change.blade.php
index 178da8234c..1518922967 100644
--- a/resources/views/livewire/private-key/change.blade.php
+++ b/resources/views/livewire/private-key/change.blade.php
@@ -1,9 +1,28 @@
-<div x-data="{ deletePrivateKey: false }">
+<div x-data="{ deletePrivateKey: false, showPrivateKey: false }">
<x-naked-modal show="deletePrivateKey" message='Are you sure you would like to delete this private key?' />
<form class="flex flex-col gap-2" wire:submit.prevent='changePrivateKey'>
<x-forms.input id="private_key.name" label="Name" required />
<x-forms.input id="private_key.description" label="Description" />
- <x-forms.textarea rows="10" id="private_key.private_key" label="Private Key" required />
+ <div>
+ <div class="flex items-end gap-2 py-2 ">
+ <div class="pl-1 text-sm">Private Key <span class='text-helper'>*</span></div>
+ <div class="text-xs text-white underline cursor-pointer" x-cloak x-show="!showPrivateKey"
+ x-on:click="showPrivateKey = true">
+ Show
+ </div>
+ <div class="text-xs text-white underline cursor-pointer" x-cloak x-show="showPrivateKey"
+ x-on:click="showPrivateKey = false">
+ Hide
+ </div>
+ </div>
+ <div x-cloak x-show="!showPrivateKey">
+ <x-forms.input cannotPeak type="password" rows="10" id="private_key.private_key" required
+ disabled />
+ </div>
+ <div x-cloak x-show="showPrivateKey">
+ <x-forms.textarea rows="10" id="private_key.private_key" required />
+ </div>
+ </div>
<div>
<x-forms.button type="submit">
Save
diff --git a/resources/views/private-key/all.blade.php b/resources/views/private-key/all.blade.php
new file mode 100644
index 0000000000..5ac8e00f6f
--- /dev/null
+++ b/resources/views/private-key/all.blade.php
@@ -0,0 +1,19 @@
+<x-layout>
+ <h1>Private Keys</h1>
+ <div class="pt-2 pb-10 text-sm">All Private Keys</div>
+ <div class="grid gap-2 lg:grid-cols-2">
+ @forelse ($privateKeys as $key)
+ <a class="text-center hover:no-underline box group"
+ href="{{ route('private-key.show', ['private_key_uuid' => data_get($key, 'uuid')]) }}">
+ <div class="group-hover:text-white">
+ <div>{{ $key->name }}</div>
+ </div>
+ </a>
+ @empty
+ <div>
+ <div>No private keys found.</div>
+ <x-use-magic-bar />
+ </div>
+ @endforelse
+ </div>
+</x-layout>
diff --git a/resources/views/private-key/show.blade.php b/resources/views/private-key/show.blade.php
index 9d108ecf65..a10b25fb40 100644
--- a/resources/views/private-key/show.blade.php
+++ b/resources/views/private-key/show.blade.php
@@ -1,4 +1,5 @@
<x-layout>
<h1>Private Key</h1>
+ <div class="pt-2 pb-10 text-sm">Sssh, it is private</div>
<livewire:private-key.change :private_key_uuid="$private_key->uuid" />
</x-layout>
diff --git a/routes/web.php b/routes/web.php
index 462138669f..d7c97e8df8 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -92,6 +92,9 @@ Route::middleware(['auth'])->group(function () {
});
Route::middleware(['auth'])->group(function () {
+ Route::get('/private-keys', fn () => view('private-key.all', [
+ 'privateKeys' => PrivateKey::ownedByCurrentTeam()->get()
+ ]))->name('private-key.all');
Route::get('/private-key/new', fn () => view('private-key.new'))->name('private-key.new');
Route::get('/private-key/{private_key_uuid}', fn () => view('private-key.show', [
'private_key' => PrivateKey::ownedByCurrentTeam()->whereUuid(request()->private_key_uuid)->firstOrFail()