Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/resources/views/admin/api/index.blade.php
14044 views
1
@extends('layouts.admin')
2
3
@section('title')
4
Application API
5
@endsection
6
7
@section('content-header')
8
<h1>Application API<small>Control access credentials for managing this Panel via the API.</small></h1>
9
<ol class="breadcrumb">
10
<li><a href="{{ route('admin.index') }}">Admin</a></li>
11
<li class="active">Application API</li>
12
</ol>
13
@endsection
14
15
@section('content')
16
<div class="row">
17
<div class="col-xs-12">
18
<div class="box box-primary">
19
<div class="box-header with-border">
20
<h3 class="box-title">Credentials List</h3>
21
<div class="box-tools">
22
<a href="{{ route('admin.api.new') }}" class="btn btn-sm btn-primary">Create New</a>
23
</div>
24
</div>
25
<div class="box-body table-responsive no-padding">
26
<table class="table table-hover">
27
<tr>
28
<th>Key</th>
29
<th>Memo</th>
30
<th>Last Used</th>
31
<th>Created</th>
32
<th>Created by</th>
33
<th></th>
34
</tr>
35
@foreach($keys as $key)
36
<tr>
37
<td><code>
38
@if (Auth::user()->is($key->user))
39
{{ $key->identifier . decrypt($key->token) }}
40
@else
41
{{ $key->identifier . '****' }}
42
@endif
43
</code></td>
44
<td>{{ $key->memo }}</td>
45
<td>
46
@if(!is_null($key->last_used_at))
47
@datetimeHuman($key->last_used_at)
48
@else
49
&mdash;
50
@endif
51
</td>
52
<td>@datetimeHuman($key->created_at)</td>
53
<td>
54
<a href="{{ route('admin.users.view', $key->user->id) }}">{{ $key->user->username }}</a>
55
</td>
56
<td>
57
<a href="#" data-action="revoke-key" data-attr="{{ $key->identifier }}">
58
<i class="fa fa-trash-o text-danger"></i>
59
</a>
60
</td>
61
</tr>
62
@endforeach
63
</table>
64
</div>
65
</div>
66
</div>
67
</div>
68
@endsection
69
70
@section('footer-scripts')
71
@parent
72
<script>
73
$(document).ready(function() {
74
$('[data-action="revoke-key"]').click(function (event) {
75
var self = $(this);
76
event.preventDefault();
77
swal({
78
type: 'error',
79
title: 'Revoke API Key',
80
text: 'Once this API key is revoked any applications currently using it will stop working.',
81
showCancelButton: true,
82
allowOutsideClick: true,
83
closeOnConfirm: false,
84
confirmButtonText: 'Revoke',
85
confirmButtonColor: '#d9534f',
86
showLoaderOnConfirm: true
87
}, function () {
88
$.ajax({
89
method: 'DELETE',
90
url: '/admin/api/revoke/' + self.data('attr'),
91
headers: {
92
'X-CSRF-TOKEN': '{{ csrf_token() }}'
93
}
94
}).done(function () {
95
swal({
96
type: 'success',
97
title: '',
98
text: 'API Key has been revoked.'
99
});
100
self.parent().parent().slideUp();
101
}).fail(function (jqXHR) {
102
console.error(jqXHR);
103
swal({
104
type: 'error',
105
title: 'Whoops!',
106
text: 'An error occurred while attempting to revoke this key.'
107
});
108
});
109
});
110
});
111
});
112
</script>
113
@endsection
114
115