diff --git a/f_install/install.php b/f_install/install.php
index 4db52539..e6cb122e 100644
--- a/f_install/install.php
+++ b/f_install/install.php
@@ -98,6 +98,38 @@ require(__dir__.'/../vendor/autoload.php');
+
diff --git a/f_install/j_setup_db.php b/f_install/j_setup_db.php
index afc1249f..2001f9b8 100644
--- a/f_install/j_setup_db.php
+++ b/f_install/j_setup_db.php
@@ -11,6 +11,7 @@ $dbName = Util::getReq('db_name');
$servHost = Util::getReq('serv_host');
$sharedIconPath = Util::getReq('shared_icon_path');
$gameImagePath = Util::getReq('game_image_path');
+$imageRequestKey = Util::getReq('image_request_key');
$kakaoRESTKey = Util::getReq('kakao_rest_key', 'string', '');
$kakaoAdminKey = Util::getReq('kakao_admin_key', 'string', '');
@@ -190,6 +191,8 @@ $globalSalt = bin2hex(random_bytes(16));
$sharedIconPath = WebUtil::resolveRelativePath($sharedIconPath, $servHost);
$gameImagePath = WebUtil::resolveRelativePath($gameImagePath, $servHost);
+$imageRequestPath = WebUtil::resolveRelativePath($gameImagePath.'/../hook/git_pull.php', $servHost);
+$imageKeyInstallPath = WebUtil::resolveRelativePath($gameImagePath.'/../hook/InstallKey.php', $servHost);
$result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/ServConfig.orig.php',
@@ -197,11 +200,17 @@ $result = Util::generateFileUsingSimpleTemplate(
[
'serverBasePath'=>$servHost,
'sharedIconPath'=>$sharedIconPath,
- 'gameImagePath'=>$gameImagePath
+ 'gameImagePath'=>$gameImagePath,
+ 'imageRequestPath'=>$imageRequestPath,
+ 'imageRequestKey'=>$imageRequestKey
],
true
);
+if($imageRequestKey){
+ @file_get_contents($imageKeyInstallPath.'?key='.$imageRequestKey);
+}
+
if ($result !== true) {
Json::die([
'result'=>false,
@@ -267,7 +276,7 @@ $result = Util::generateFileUsingSimpleTemplate(
]
);
-$kakaoRedirectURI = WebUtil::resolveRelativePath('oauth_kakao/oauth.php', $servHost);
+$kakaoRedirectURI = WebUtil::resolveRelativePath('oauth_kakao/oauth.php', $servHost.'/');
Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/KakaoKey.orig.php',
diff --git a/f_install/templates/ServConfig.orig.php b/f_install/templates/ServConfig.orig.php
index adb6b8be..ef6c7aa3 100644
--- a/f_install/templates/ServConfig.orig.php
+++ b/f_install/templates/ServConfig.orig.php
@@ -10,6 +10,8 @@ class ServConfig
public static $serverWebPath = '_tK_serverBasePath_';
public static $sharedIconPath = '_tK_sharedIconPath_';
public static $gameImagePath = "_tK_gameImagePath_";
+ public static $imageRequestPath = "_tK_imageRequestPath_";
+ public static $imageRequestKey = '_tK_imageRequestKey_';
public static function getSharedIconPath(string $filepath='') : string
{
@@ -32,6 +34,13 @@ class ServConfig
return static::$gameImagePath;
}
+ public static function getImagePullURI() : string
+ {
+ $now = time();
+ $req_hash = Util::hashPassword(sprintf("%016x",$now), static::$imageRequestKey);
+ return static::$imageRequestPath."?req={$req_hash}&time={$now}";
+ }
+
/**
* 서버 주소 반환. 서버의 경로가 하부 디렉토리인 경우에 하부 디렉토리까지 포함
diff --git a/j_updateServer.php b/j_updateServer.php
index 3f21fd48..b0c3d2a6 100644
--- a/j_updateServer.php
+++ b/j_updateServer.php
@@ -150,13 +150,44 @@ if($server == $baseServerName){
'verionGit'=>$version
], true
);
+
+ if(ServConfig::$imageRequestKey){
+ try {
+ $imagePullPath = ServConfig::getImagePullURI();
+ $pullResult = @file_get_contents($imagePullPath);
+ if($pullResult === false){
+ throw new \ErrorException('Invalid URI');
+ }
+ $pullResult = Json::decode($pullResult);
+ if($pullResult['result']){
+ $imgResult = true;
+ $imgDetail = $pullResult['version'];
+ }
+ else{
+ $imgResult = false;
+ $imgDetail = $pullResult['reason'];
+ }
+ }
+ catch(\Exception $e){
+ $imgResult = false;
+ $imgDetail = $e->getMessage();
+ }
+ }
+ else{
+ $imgResult = true;
+ $imgDetail = 'No key';
+ }
+
+
$storage->$server = [$target, $version];
Json::die([
'server'=>$server,
'result'=>true,
- 'version'=>$version
+ 'version'=>$version,
+ 'imgResult'=>$imgResult,
+ 'imgDetail'=>$imgDetail,
]);
}
diff --git a/js/admin_server.js b/js/admin_server.js
index 0e38c74d..52599cb5 100644
--- a/js/admin_server.js
+++ b/js/admin_server.js
@@ -64,7 +64,11 @@ function serverUpdate(caller){
}
}).then(function(response) {
if(response.result) {
- alert('{0} 서버가 {1} 버전으로 업데이트 되었습니다.'.format(response.server, response.version));
+ var aux = '';
+ if(isRoot){
+ aux = ' (이미지 서버 갱신:{0}, {1})'.format(response.imgResult, response.imgDetail);
+ }
+ alert('{0} 서버가 {1} 버전으로 업데이트 되었습니다.{2}'.format(response.server, response.version, aux));
location.reload();
} else {
alert(response.reason);
diff --git a/js/install.js b/js/install.js
index 489edd92..d31bff75 100644
--- a/js/install.js
+++ b/js/install.js
@@ -47,6 +47,16 @@ $(document).ready( function () {
$('#serv_host').val(
[location.protocol, '//', location.host, parentPathname].join('')
);
+
+ $('#btn_random_generate_key').click(function(){
+ var token = '';
+ while(token.length < 24){
+ token += (Math.random() + 1).toString(36).substring(7);
+ }
+ token = token.substr(0,24);
+ $('#image_request_key').val(token);
+ });
+
$('#db_form').validate({
rules:{
db_host:"required",
@@ -56,7 +66,11 @@ $(document).ready( function () {
db_name:"required",
serv_host:"required",
shared_icon_path:"required",
- game_image_path:"required"
+ game_image_path:"required",
+ image_request_key:{
+ required:false,
+ minlength:16
+ }
},
errorElement: "div",
errorPlacement: function ( error, element ) {
@@ -94,7 +108,10 @@ $(document).ready( function () {
db_name:$('#db_name').val(),
serv_host:$('#serv_host').val(),
shared_icon_path:$('#shared_icon_path').val(),
- game_image_path:$('#game_image_path').val()
+ game_image_path:$('#game_image_path').val(),
+ image_request_key:$('#image_request_key').val(),
+ kakao_rest_key:$('#kakao_rest_key').val(),
+ kakao_admin_key:$('#kakao_admin_key').val(),
}
}).then(function(result){
var deferred = $.Deferred();