Unverified Kaydet (Commit) 5814d265 authored tarafından Mert ÇELEN's avatar Mert ÇELEN Kaydeden (comit) GitHub

Merge pull request #71 from mertcelen/1.1-dev

Personal Access Token interface added.
......@@ -128,6 +128,7 @@ class MainController extends Controller
return view('extension_pages.server', [
"viewName" => "",
"view" => $output,
"tokens" => user()->accessTokens()->get()->toArray(),
"last" => $this->getNavigationServers(),
]);
}
......
......@@ -532,7 +532,9 @@ input(type=\"imtcp\" port=\"514\")";
public function setDNSServers()
{
`sudo chattr -i /etc/resolv.conf`;
$str = "";
$str = "
options rotate timeout:3
";
foreach([request('dns1'),request('dns2'),request('dns3')] as $ip){
if($ip == null){
continue;
......
......@@ -462,7 +462,7 @@ class UserController extends Controller
"name" => request("name"),
"token" => $token,
]);
return respond("Anahtar Başarıyla Oluşturuldu<br>$token");
return respond("Anahtar Başarıyla Oluşturuldu.");
}
public function revokeAccessToken()
......
This diff is collapsed.
This diff is collapsed.
{
"/css/liman.css": "/css/liman.css?id=defedb66f8a8b13bdeb3",
"/js/liman.js": "/js/liman.js?id=1f325bfd05a2aa620517"
"/js/liman.js": "/js/liman.js?id=40fa9defbe4a3f88c393"
}
let csrf = document.getElementsByName("csrf-token")[0].getAttribute("content");
let customRequestData = [];
let limanRecordRequests = false;
let limanRequestList = [];
function showSwal(message, type, timer = false) {
let config = {
......@@ -42,6 +44,18 @@ function request(url, data, next, error) {
data.append(key, value);
}
if (limanRecordRequests) {
let parsed = {};
for (var pair of data.entries()) {
parsed[pair[0]] = pair[1];
}
limanRequestList.push({
target: url.substring(url.lastIndexOf("/") + 1),
url: url,
form: parsed,
});
}
let r = new XMLHttpRequest();
r.open("POST", url);
r.setRequestHeader("X-CSRF-TOKEN", csrf);
......@@ -93,6 +107,18 @@ function request(url, data, next, error) {
return false;
}
function limanRequestBuilder(index, token) {
let str = JSON.stringify(limanRequestList[index]["form"]);
return (
"curl -d '" +
str +
'\' -H "Content-Type: application/json" -H "Accept: application/json" -H "liman-token: ' +
token +
'" -X POST ' +
limanRequestList[index]["url"]
);
}
function reload() {
setTimeout(function () {
location.reload();
......
......@@ -13,6 +13,9 @@
<button data-toggle="tooltip" title="Sunucuya Git" class="btn btn-primary" onclick="location.href = '{{route('server_one',[
"server_id" => server()->id,
])}}'"><i class="fa fa-server"></i></button>
@if(count($tokens) > 0)
<button data-toggle="tooltip" title="Sorgu Oluştur" class="btn btn-primary" onclick="showRequestRecords()"><i class="fa fa-book"></i></button>
@endif
<button data-toggle="tooltip" title="Destek Al" class="btn btn-primary" onclick="location.href = 'mailto:{{env('APP_NOTIFICATION_EMAIL')}}?subject={{env('BRAND_NAME')}} {{extension()->display_name}} {{extension()->version}}'"><i class="fas fa-headset"></i></button>
</div>
@include('errors')
......@@ -62,7 +65,105 @@
</div>
</div>
</div>
@if(count($tokens) > 0)
<div class="float" onclick="toggleRequestRecord()" id="requestRecordButton">
<i class="fas fa-video my-float"></i>
</div>
@component('modal-component',[
"id" => "limanRequestsModal",
"title" => "İstek Kayıtları"
])
<div class="limanRequestsWrapper">
<div class="row">
<div class="col-md-4">
<ul class="list-group" id="limanRequestsList">
</ul>
</div>
<div class="col-md-8">
<p>{{__("Aşağıdaki komut ile Liman MYS'ye dışarıdan istek gönderebilirsiniz.")}}</p>
<div class="row">
<div class="col-md-4" style="line-height: 2.25rem;">{{__("Kullanılacak Kişisel Erişim Anahtarı")}}</div>
<div class="col-md-8">
<select id="limanRequestAccessToken" class="select2" onchange="clearCurlCommand()">
@foreach($tokens as $token)
<option value="{{$token['token']}}">{{$token['name']}}</option>
@endforeach
</select>
</div>
</div>
<pre id="limanRequestCurlOutput"></pre>
</div>
</div>
</div>
@endcomponent
<style>
.float{
position:fixed;
width:30px;
height:30px;
bottom:20px;
right:20px;
background-color:grey;
color:#FFF;
border-radius:50px;
text-align:center;
box-shadow: 2px 2px 3px #999;
}
.my-float{
line-height:30px;
font-size : 15px;
}
pre {
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;
}
</style>
<script>
function toggleRequestRecord(){
let element = $("#requestRecordButton");
limanRecordRequests = !limanRecordRequests;
if(limanRecordRequests == true){
element.css("backgroundColor","red");
}else{
element.css("backgroundColor","grey");
}
}
function showRequestRecords(){
if(limanRequestList.length == 0){
showSwal("Lütfen önce bir sorguyu kaydedin.","error",2000);
return;
}
let listElement = $("#limanRequestsList");
let modalElement = $("#limanRequestsModal");
listElement.html("");
$.each(limanRequestList, function(index, entries) {
listElement.append("<li onclick='showCurlCommand(this," + index + ")' class='list-group-item liman-request-item'>" + entries["target"] +"</li>")
});
modalElement.modal('show');
}
function clearCurlCommand(){
$("#limanRequestCurlOutput").text("");
$(".liman-request-item").removeClass("active");
}
function showCurlCommand(element,index){
$(".liman-request-item").removeClass("active");
$(element).addClass("active");
$("#limanRequestCurlOutput").text(limanRequestBuilder(index,$("#limanRequestAccessToken").val()));
}
</script>
@endif
<script>
$(function(){
let list = [];
......
......@@ -14,7 +14,7 @@
<div class="card card-primary card-outline">
<div class="card-body box-profile">
<h3 class="profile-username text-center">{{__("Kişisel Erişim Anahtarlarım")}}</h3>
<p class="text-muted text-center">{{__("Size ait Kişisel Erişim Anahtarları'nın listesini görüntüleyebilirsiniz. Gizlilik sebebiyle eski anahtarınıza erişemezsiniz. Mevcut anahtar üzerinde işlem yapmak için sağ tıklayabilirsiniz.")}}</p>
<p class="text-muted text-center">{{__("Size ait Kişisel Erişim Anahtarları'nın listesini görüntüleyebilirsiniz. Mevcut anahtar üzerinde işlem yapmak için sağ tıklayabilirsiniz.")}}</p>
</div>
</div>
</div>
......@@ -29,10 +29,10 @@
@include('table',[
"value" => user()->accessTokens()->get(),
"title" => [
"Adı", "Son Kullanılan Tarih", "Son Kullanan Ip Adresi", "*hidden*"
"Adı", "Token", "Son Kullanılan Tarih", "Son Kullanan Ip Adresi", "*hidden*"
],
"display" => [
"name" , "last_used_at", "last_used_ip", "id:token_id"
"name" , "token", "last_used_at", "last_used_ip", "id:token_id"
],
"menu" => [
"Sil" => [
......@@ -50,7 +50,7 @@
"id"=>"addAccessToken",
"title" => "Anahtar Oluştur",
"url" => route('create_access_token'),
"next" => "debug",
"next" => "reload",
"inputs" => [
"İsim" => "name:text"
],
......
1.1.0
1.1.1
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment