diff --git a/app/Http/Controllers/UpdateController.php b/app/Http/Controllers/UpdateController.php index 0c81ef2d..2baf4103 100644 --- a/app/Http/Controllers/UpdateController.php +++ b/app/Http/Controllers/UpdateController.php @@ -59,7 +59,7 @@ class UpdateController extends Controller public function __construct(\GuzzleHttp\Client $guzzle) { - $this->updateSource = option('update_source'); + $this->updateSource = config('app.update_source'); $this->currentVersion = config('app.version'); $this->guzzle = $guzzle; @@ -110,18 +110,15 @@ class UpdateController extends Controller } } - $update = Option::form('update', OptionForm::AUTO_DETECT, function ($form) { - $form->checkbox('check_update')->label(); - $form->text('update_source')->description(); - })->handle()->always(function ($form) { - try { - $response = $this->guzzle->request('GET', option('update_source'), $this->guzzleConfig)->getBody(); - } catch (Exception $e) { - $form->addMessage(trans('admin.update.errors.connection').e($e->getMessage()), 'danger'); - } - }); + $connectivity = true; - return view('admin.update')->with('info', $info)->with('update', $update); + try { + $this->guzzle->request('GET', $this->updateSource, $this->guzzleConfig); + } catch (Exception $e) { + $connectivity = $e->getMessage(); + } + + return view('admin.update', compact('info', 'connectivity')); } public function checkUpdates() diff --git a/config/app.php b/config/app.php index 32d6690e..58a454fe 100644 --- a/config/app.php +++ b/config/app.php @@ -6,11 +6,24 @@ return [ | Application Version |-------------------------------------------------------------------------- | - | Version of Blessing Skin Server + | Version of Blessing Skin Server. | */ 'version' => '3.4.0', + /* + |-------------------------------------------------------------------------- + | Update Source + |-------------------------------------------------------------------------- + | + | Where to get information of new versions. + | + */ + 'update_source' => menv( + 'UPDATE_SOURCE', + 'https://work.prinzeugen.net/blessing-skin-server/update.json' + ), + /* |-------------------------------------------------------------------------- | Application Environment diff --git a/config/options.php b/config/options.php index 72ea224a..afa7cdf7 100644 --- a/config/options.php +++ b/config/options.php @@ -30,8 +30,6 @@ return [ 'score_per_player' => '100', 'sign_after_zero' => 'false', 'version' => '', - 'check_update' => 'true', - 'update_source' => 'https://work.prinzeugen.net/update.json', 'copyright_text' => 'Copyright © '.getdate()['year'].' {site_name}. All rights reserved.', 'auto_del_invalid_texture' => 'false', 'allow_downloading_texture' => 'true', diff --git a/resources/lang/en/admin.yml b/resources/lang/en/admin.yml index 33fe93e3..08749fb6 100644 --- a/resources/lang/en/admin.yml +++ b/resources/lang/en/admin.yml @@ -152,18 +152,19 @@ update: cautions: title: Cautions text: | - Please choose update source according to your host location. - Low-speed connection between update source and your host will cause long-time loading at checking/downloading page. + Please choose update source according to your host's network environment. + Low-speed connection between update source and your host will cause long-time loading at checking and downloading page. + To change the default update source, please refer to this wiki article. download: downloading: Downloading update package... size: "Size of package:" - errors: + errors: prefix: "An error occured: " - connection: "Unable to access to current update source. Details:" - write-permission: Unable to make cache directory. Please sure permission. - unzip: "Failed to unzip update file. Error code: " + connection: We can't connect to the update source. :error + write-permission: Unable to create the cache directory. Please check the permission. + unzip: "Failed to extract update package. Error code: " overwrite: Unable to overwrite files. invalid-action: Invalid action diff --git a/resources/lang/en/options.yml b/resources/lang/en/options.yml index faa63bc0..07cb5b3b 100644 --- a/resources/lang/en/options.yml +++ b/resources/lang/en/options.yml @@ -148,14 +148,4 @@ resources: description: If your CDN doesn't cache 404 pages, please turn this on. A flood of requests to un-existent players will greatly slow down the site. cache_expire_time: title: Cache Exipre Time - hint: In seconds, 86400 = one day, 31536000 = one year - -update: - title: Check Update - - check_update: - title: Check Update - label: Check update automatically and notify me. - update_source: - title: Update Source - description: 'Available update source list can be found at: @GitHub Wiki' + hint: In seconds, 86400 = one day, 31536000 = one year. diff --git a/resources/lang/zh_CN/admin.yml b/resources/lang/zh_CN/admin.yml index e1714d6f..21cab487 100644 --- a/resources/lang/zh_CN/admin.yml +++ b/resources/lang/zh_CN/admin.yml @@ -153,7 +153,8 @@ update: title: 注意事项 text: | 请根据你的主机所在位置(国内/国外)选择更新源。 - 如错选至相对于你的主机速度较慢的源,可能会造成检查/下载更新页面长时间无响应。 + 如错选至相对于你的主机速度较慢的源,可能会造成检查与下载更新页面长时间无响应。 + 如何更换更新源?点击了解详情。 download: downloading: 正在下载更新包 @@ -161,8 +162,8 @@ update: errors: prefix: 发生错误: - connection: 无法访问当前更新源。详细信息: - write-permission: 您的服务器不支持自动更新:创建下载缓存文件夹失败,请检查目录权限。 + connection: 无法访问当前更新源。详细信息::error + write-permission: 你的服务器不支持自动更新:创建下载缓存文件夹失败,请检查目录权限。 unzip: 更新包解压缩失败。错误代码: overwrite: 您的服务器不支持自动更新:无法覆盖文件。 diff --git a/resources/lang/zh_CN/options.yml b/resources/lang/zh_CN/options.yml index d5050405..86546ca2 100644 --- a/resources/lang/zh_CN/options.yml +++ b/resources/lang/zh_CN/options.yml @@ -149,13 +149,3 @@ resources: cache_expire_time: title: 缓存失效时间 hint: 秒数,86400 = 一天,31536000 = 一年 - -update: - title: 更新选项 - - check_update: - title: 检查更新 - label: 自动检查更新并提示 - update_source: - title: 更新源 - description: 可用的更新源列表可以在这里查看:@GitHub Wiki diff --git a/resources/views/admin/master.tpl b/resources/views/admin/master.tpl index 300b0f61..e4745620 100644 --- a/resources/views/admin/master.tpl +++ b/resources/views/admin/master.tpl @@ -94,9 +94,12 @@ @include('common.dependencies.script') - @if (option('check_update')) - - @endif + @if (option('allow_sending_statistics')) diff --git a/resources/views/admin/update.tpl b/resources/views/admin/update.tpl index fe3ec1b5..ce3e8a89 100644 --- a/resources/views/admin/update.tpl +++ b/resources/views/admin/update.tpl @@ -64,7 +64,13 @@ @else -