Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
L
Liman MYS - Çekirdek
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
liman
Liman MYS - Çekirdek
Commits
22cb55c7
Kaydet (Commit)
22cb55c7
authored
Haz 30, 2020
tarafından
mertcelen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Auto updates enabled.
üst
1c7be4be
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
153 additions
and
108 deletions
+153
-108
Kernel.php
app/Console/Kernel.php
+25
-12
MarketController.php
app/Http/Controllers/MarketController.php
+65
-41
composer.lock
composer.lock
+5
-5
notifications.blade.php
resources/views/l/notifications.blade.php
+2
-2
master.blade.php
resources/views/layouts/master.blade.php
+1
-1
system.blade.php
resources/views/notification/system.blade.php
+54
-46
index.blade.php
resources/views/settings/index.blade.php
+1
-1
No files found.
app/Console/Kernel.php
Dosyayı görüntüle @
22cb55c7
...
...
@@ -5,6 +5,7 @@ namespace App\Console;
use
App\AdminNotification
;
use
App\Notification
;
use
App\User
;
use
App\Http\Controllers\MarketController
;
use
Illuminate\Console\Scheduling\Schedule
;
use
Illuminate\Foundation\Console\Kernel
as
ConsoleKernel
;
use
Illuminate\Support\Facades\DB
;
...
...
@@ -60,21 +61,33 @@ class Kernel extends ConsoleKernel
//Check Package Update Every 30 Min
$schedule
->
call
(
function
()
{
shell_exec
(
"sudo apt update"
);
$output
=
shell_exec
(
"apt list --upgradable"
);
if
(
!
strpos
(
$output
,
"liman"
))
{
$controller
=
new
MarketController
();
if
(
!
env
(
'MARKET_ACCESS_TOKEN'
))
{
return
;
}
$client
=
$controller
->
getClient
();
try
{
$response
=
$client
->
post
(
env
(
"MARKET_URL"
)
.
'/api/users/me'
);
}
catch
(
\Exception
$e
)
{
return
;
}
AdminNotification
::
where
(
'type'
,
'liman_update'
)
->
delete
();
AdminNotification
::
create
([
"title"
=>
"Liman Güncellemesi Mevcut!"
,
"type"
=>
"liman_update"
,
"message"
=>
"Yeni bir liman sürümü mevcut ayrıntılı bilgi için tıklayınız."
,
"level"
=>
3
,
]);
$array
=
$controller
->
checkMarketUpdates
(
true
);
$collection
=
collect
(
$array
);
if
(
!
$collection
->
where
(
"updateAvailable"
,
1
)
->
count
())
{
AdminNotification
::
where
(
'type'
,
'liman_update'
)
->
delete
();
AdminNotification
::
create
([
"title"
=>
"Liman Güncellemesi Mevcut!"
,
"type"
=>
"liman_update"
,
"message"
=>
"Yeni bir sistem güncellemesi mevcut, ayrıntılı bilgi için tıklayınız."
,
"level"
=>
3
,
]);
}
})
->
every
ThirtyMinutes
()
->
every
Minute
()
->
name
(
'Update Check'
);
}
...
...
app/Http/Controllers/MarketController.php
Dosyayı görüntüle @
22cb55c7
...
...
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use
Illuminate\Http\Request
;
use
GuzzleHttp\Client
;
use
App\Extension
;
use
App\Jobs\ExtensionUpdaterJob
;
use
GuzzleHttp\Exception\BadResponseException
;
use
Illuminate\Contracts\Bus\Dispatcher
;
...
...
@@ -12,16 +13,16 @@ class MarketController extends Controller
{
public
function
verifyMarketConnection
()
{
if
(
!
env
(
'MARKET_ACCESS_TOKEN'
))
{
return
respond
(
"Market'e bağlanmak için bir anahtarınız yok!"
,
201
);
if
(
!
env
(
'MARKET_ACCESS_TOKEN'
))
{
return
respond
(
"Market'e bağlanmak için bir anahtarınız yok!"
,
201
);
}
$client
=
self
::
getClient
();
try
{
try
{
$response
=
$client
->
post
(
env
(
"MARKET_URL"
)
.
'/api/users/me'
);
}
catch
(
\Exception
$e
)
{
return
respond
(
"Anahtarınız ile Market'e bağlanılamadı!"
,
201
);
}
catch
(
\Exception
$e
)
{
return
respond
(
"Anahtarınız ile Market'e bağlanılamadı!"
,
201
);
}
return
respond
(
"Market Bağlantısı Başarıyla Sağlandı."
);
}
...
...
@@ -38,22 +39,22 @@ class MarketController extends Controller
);
}
public
function
checkMarketUpdates
()
public
function
checkMarketUpdates
(
$returnRaw
=
false
)
{
$client
=
self
::
getClient
();
$params
=
[];
$limanCode
=
trim
(
file_get_contents
(
storage_path
(
'VERSION_CODE'
)));
array_push
(
$params
,[
array_push
(
$params
,
[
"packageName"
=>
"Liman.Core"
,
"versionCode"
=>
intval
(
$limanCode
),
"currentVersion"
=>
getVersion
(),
"extension_id"
=>
null
"extension_id"
=>
null
,
]);
foreach
(
extensions
()
as
$extension
)
{
$extensions
=
Extension
::
all
();
foreach
(
$extensions
as
$extension
)
{
$obj
=
json_decode
(
file_get_contents
(
"/liman/extensions/"
.
...
...
@@ -63,75 +64,98 @@ class MarketController extends Controller
),
true
);
array_push
(
$params
,[
array_push
(
$params
,
[
"packageName"
=>
"Liman."
.
$obj
[
"name"
],
"versionCode"
=>
array_key_exists
(
"version_code"
,
$obj
)
?
$obj
[
"version_code"
]
:
0
,
"versionCode"
=>
array_key_exists
(
"version_code"
,
$obj
)
?
$obj
[
"version_code"
]
:
0
,
"currentVersion"
=>
$obj
[
"version"
],
"extension_id"
=>
$extension
->
id
"extension_id"
=>
$extension
->
id
,
]);
}
try
{
$response
=
$client
->
get
(
env
(
"MARKET_URL"
)
.
'/api/application/check_version'
,[
"json"
=>
$params
]);
}
catch
(
\Exception
$e
){
return
respond
(
$e
->
getMessage
(),
201
);
try
{
$response
=
$client
->
get
(
env
(
"MARKET_URL"
)
.
'/api/application/check_version'
,
[
"json"
=>
$params
,
]
);
}
catch
(
\Exception
$e
)
{
return
respond
(
$e
->
getMessage
(),
201
);
}
$json
=
json_decode
((
string
)
$response
->
getBody
());
$collection
=
collect
(
$json
);
$fileToWrite
=
[];
for
(
$i
=
0
;
$i
<
count
(
$params
);
$i
++
){
$obj
=
$collection
->
where
(
'packageName'
,
$params
[
$i
][
"packageName"
])
->
first
();
if
(
!
$obj
){
for
(
$i
=
0
;
$i
<
count
(
$params
);
$i
++
)
{
$obj
=
$collection
->
where
(
'packageName'
,
$params
[
$i
][
"packageName"
])
->
first
();
if
(
!
$obj
)
{
$params
[
$i
][
"status"
]
=
"Güncel"
;
}
else
{
$obj
=
json_decode
(
json_encode
(
$obj
),
true
);
$params
[
$i
][
"status"
]
=
$obj
[
"version"
][
"versionName"
]
.
" sürümü mevcut"
;
if
(
$params
[
$i
][
"extension_id"
]
!=
null
&&
count
(
$obj
[
"platforms"
])){
$params
[
$i
][
"updateAvailable"
]
=
0
;
}
else
{
$obj
=
json_decode
(
json_encode
(
$obj
),
true
);
$params
[
$i
][
"status"
]
=
$obj
[
"version"
][
"versionName"
]
.
" sürümü mevcut"
;
$params
[
$i
][
"updateAvailable"
]
=
1
;
if
(
$params
[
$i
][
"extension_id"
]
!=
null
&&
count
(
$obj
[
"platforms"
])
)
{
$job
=
(
new
ExtensionUpdaterJob
(
$params
[
$i
][
"extension_id"
],
$obj
[
"version"
][
"versionCode"
],
$obj
[
"platforms"
][
0
][
"downloadLink"
]
))
->
onQueue
(
'system_updater'
);
// Dispatch job right away.
$job_id
=
app
(
Dispatcher
::
class
)
->
dispatch
(
$job
);
array_push
(
$fileToWrite
,[
"name"
=>
substr
(
$params
[
$i
][
"packageName"
],
6
),
array_push
(
$fileToWrite
,
[
"name"
=>
substr
(
$params
[
$i
][
"packageName"
],
6
),
"currentVersion"
=>
$params
[
$i
][
"currentVersion"
],
"newVersion"
=>
$obj
[
"version"
][
"versionName"
],
"downloadLink"
=>
$obj
[
"platforms"
][
0
][
"downloadLink"
],
"versionCode"
=>
$obj
[
"version"
][
"versionCode"
],
"changeLog"
=>
$obj
[
"version"
][
"versionDescription"
],
"extension_id"
=>
$params
[
$i
][
"extension_id"
]
"extension_id"
=>
$params
[
$i
][
"extension_id"
]
,
]);
}
}
}
if
(
count
(
$fileToWrite
)){
file_put_contents
(
storage_path
(
"extension_updates"
),
json_encode
(
$fileToWrite
),
JSON_PRETTY_PRINT
);
if
(
count
(
$fileToWrite
))
{
file_put_contents
(
storage_path
(
"extension_updates"
),
json_encode
(
$fileToWrite
),
JSON_PRETTY_PRINT
);
}
if
(
$returnRaw
)
{
return
$params
;
}
return
respond
(
$params
);
}
private
function
getClient
()
public
function
getClient
()
{
if
(
!
self
::
checkAccess
(
parse_url
(
env
(
"MARKET_URL"
))[
"host"
]))
{
if
(
env
(
"MARKET_URL"
)
==
null
)
{
abort
(
504
,
"Market bağlantısı ayarlanmamış."
);
if
(
!
self
::
checkAccess
(
parse_url
(
env
(
"MARKET_URL"
))[
"host"
]))
{
if
(
env
(
"MARKET_URL"
)
==
null
)
{
abort
(
504
,
"Market bağlantısı ayarlanmamış."
);
}
abort
(
504
,
env
(
"MARKET_URL"
)
.
" adresindeki markete bağlanılamadı!"
);
abort
(
504
,
env
(
"MARKET_URL"
)
.
" adresindeki markete bağlanılamadı!"
);
}
return
new
Client
([
"headers"
=>
[
"Accept"
=>
"application/json"
,
"Authorization"
=>
"Bearer "
.
env
(
"MARKET_ACCESS_TOKEN"
)
"Authorization"
=>
"Bearer "
.
env
(
"MARKET_ACCESS_TOKEN"
)
,
],
"verify"
=>
false
"verify"
=>
false
,
]);
}
}
composer.lock
Dosyayı görüntüle @
22cb55c7
...
...
@@ -6266,16 +6266,16 @@
},
{
"name": "myclabs/deep-copy",
"version": "1.10.
0
",
"version": "1.10.
1
",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "
5796d127b0c4ff505b77455148ea9d5269d99758
"
"reference": "
969b211f9a51aa1f6c01d1d2aef56d3bd91598e5
"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/
5796d127b0c4ff505b77455148ea9d5269d99758
",
"reference": "
5796d127b0c4ff505b77455148ea9d5269d99758
",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/
969b211f9a51aa1f6c01d1d2aef56d3bd91598e5
",
"reference": "
969b211f9a51aa1f6c01d1d2aef56d3bd91598e5
",
"shasum": ""
},
"require": {
...
...
@@ -6316,7 +6316,7 @@
"type": "tidelift"
}
],
"time": "2020-06-2
8T07:02:41
+00:00"
"time": "2020-06-2
9T13:22:24
+00:00"
},
{
"name": "nikic/php-parser",
...
...
resources/views/l/notifications.blade.php
Dosyayı görüntüle @
22cb55c7
...
...
@@ -17,12 +17,12 @@
@case('error')
@case('health_problem')
@case('liman_update')
<a
href=
"/bildirim/{{$notification->id}}"
class=
"dropdown-item"
style=
"color: #f56954;width: 100%"
>
<a
onclick=
"partialPageRequest('/bildirim/{{$notification->id}}'); return false;"
href=
"/bildirim/{{$notification->id}}"
class=
"dropdown-item"
style=
"color: #f56954;width: 100%"
>
{{$notification->title}}
</a>
@break
@default
<a
href=
"/bildirim/{{$notification->id}}"
class=
"dropdown-item"
style=
"color: #00a65a;width: 100%"
>
<a
onclick=
"partialPageRequest('/bildirim/{{$notification->id}}'); return false;"
href=
"/bildirim/{{$notification->id}}"
class=
"dropdown-item"
style=
"color: #00a65a;width: 100%"
>
{{$notification->title}}
</a>
@break
...
...
resources/views/layouts/master.blade.php
Dosyayı görüntüle @
22cb55c7
...
...
@@ -44,7 +44,7 @@
localStorage
.
displayedNots
=
JSON
.
stringify
(
displayedNots
);
$
(
toastElement
).
click
(
function
(){
partialPageRequest
(
"/bildirim/"
+
data
.
id
)
;
window
.
location
.
href
=
"/bildirim/"
+
data
.
id
;
});
}
checkNotifications
(
data
?
data
.
id
:
null
);
...
...
resources/views/notification/system.blade.php
Dosyayı görüntüle @
22cb55c7
<?php
$notification
=
\App\AdminNotification
::
where
(
'id'
,(
request
(
'notification_id'
)))
->
first
();
if
(
!
$notification
){
header
(
"Location: /"
,
true
);
$notification
=
\App\AdminNotification
::
where
(
'id'
,
request
(
'notification_id'
)
)
->
first
();
if
(
!
$notification
)
{
header
(
"Location: /"
,
true
);
exit
();
}
switch
(
$notification
->
type
)
{
case
"cert_request"
:
list
(
$hostname
,
$port
,
$server_id
)
=
explode
(
":"
,
$notification
->
message
);
$url
=
route
(
'certificate_add_page'
)
.
"?notification_id=
$notification->id
&hostname=
$hostname
&port=
$port
&server_id=
$server_id
"
;
header
(
"Location:
$url
"
,
true
);
exit
();
}
switch
(
$notification
->
type
){
case
"cert_request"
:
list
(
$hostname
,
$port
,
$server_id
)
=
explode
(
":"
,
$notification
->
message
);
$url
=
route
(
'certificate_add_page'
)
.
"?notification_id=
$notification->id
&hostname=
$hostname
&port=
$port
&server_id=
$server_id
"
;
header
(
"Location:
$url
"
,
true
);
exit
();
break
;
case
"liman_update"
:
$url
=
route
(
'settings'
)
.
"#update"
;
$notification
->
update
([
"read"
=>
"true"
]);
header
(
"Location:
$url
"
,
true
);
exit
();
break
;
case
"health_problem"
:
$url
=
route
(
'settings'
)
.
"#health"
;
$notification
->
update
([
"read"
=>
"true"
]);
header
(
"Location:
$url
"
,
true
);
exit
();
break
;
case
"new_module"
:
$url
=
route
(
'modules_index'
);
$notification
->
update
([
"read"
=>
"true"
]);
header
(
"Location:
$url
"
,
true
);
exit
();
break
;
case
"extension_update"
:
$url
=
route
(
'settings'
)
.
"#extensions"
;
$notification
->
update
([
"read"
=>
"true"
]);
header
(
"Location:
$url
"
,
true
);
exit
();
break
;
default
:
break
;
}
break
;
case
"liman_update"
:
$url
=
route
(
'settings'
)
.
"#limanMarket"
;
$notification
->
update
([
"read"
=>
"true"
,
]);
header
(
"Location:
$url
"
,
true
);
exit
();
break
;
case
"health_problem"
:
$url
=
route
(
'settings'
)
.
"#health"
;
$notification
->
update
([
"read"
=>
"true"
,
]);
header
(
"Location:
$url
"
,
true
);
exit
();
break
;
case
"new_module"
:
$url
=
route
(
'modules_index'
);
$notification
->
update
([
"read"
=>
"true"
,
]);
header
(
"Location:
$url
"
,
true
);
exit
();
break
;
case
"extension_update"
:
$url
=
route
(
'settings'
)
.
"#extensions"
;
$notification
->
update
([
"read"
=>
"true"
,
]);
header
(
"Location:
$url
"
,
true
);
exit
();
break
;
default
:
break
;
}
?>
@extends('layouts.app')
...
...
resources/views/settings/index.blade.php
Dosyayı görüntüle @
22cb55c7
...
...
@@ -192,7 +192,7 @@
])
.
draw
()
.
node
();
});
table
.
draw
();
status
.
html
(
"Güncellemeler başarıyla kontrol edildi
...
"
);
status
.
html
(
"Güncellemeler başarıyla kontrol edildi"
);
status
.
attr
(
"class"
,
"alert alert-success"
);
$
(
"#marketLoading"
)
.
fadeOut
(
0
);
$
(
"#marketTableWrapper"
)
.
fadeIn
(
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment