Specify update source by environment variable
This commit is contained in:
parent
e1d686d1a7
commit
5b3b2da64c
|
|
@ -59,7 +59,7 @@ class UpdateController extends Controller
|
||||||
|
|
||||||
public function __construct(\GuzzleHttp\Client $guzzle)
|
public function __construct(\GuzzleHttp\Client $guzzle)
|
||||||
{
|
{
|
||||||
$this->updateSource = option('update_source');
|
$this->updateSource = config('app.update_source');
|
||||||
$this->currentVersion = config('app.version');
|
$this->currentVersion = config('app.version');
|
||||||
|
|
||||||
$this->guzzle = $guzzle;
|
$this->guzzle = $guzzle;
|
||||||
|
|
@ -110,18 +110,15 @@ class UpdateController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$update = Option::form('update', OptionForm::AUTO_DETECT, function ($form) {
|
$connectivity = true;
|
||||||
$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');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
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()
|
public function checkUpdates()
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,24 @@ return [
|
||||||
| Application Version
|
| Application Version
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Version of Blessing Skin Server
|
| Version of Blessing Skin Server.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
'version' => '3.4.0',
|
'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
|
| Application Environment
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,6 @@ return [
|
||||||
'score_per_player' => '100',
|
'score_per_player' => '100',
|
||||||
'sign_after_zero' => 'false',
|
'sign_after_zero' => 'false',
|
||||||
'version' => '',
|
'version' => '',
|
||||||
'check_update' => 'true',
|
|
||||||
'update_source' => 'https://work.prinzeugen.net/update.json',
|
|
||||||
'copyright_text' => '<strong>Copyright © '.getdate()['year'].' <a href="{site_url}">{site_name}</a>.</strong> All rights reserved.',
|
'copyright_text' => '<strong>Copyright © '.getdate()['year'].' <a href="{site_url}">{site_name}</a>.</strong> All rights reserved.',
|
||||||
'auto_del_invalid_texture' => 'false',
|
'auto_del_invalid_texture' => 'false',
|
||||||
'allow_downloading_texture' => 'true',
|
'allow_downloading_texture' => 'true',
|
||||||
|
|
|
||||||
|
|
@ -152,18 +152,19 @@ update:
|
||||||
cautions:
|
cautions:
|
||||||
title: Cautions
|
title: Cautions
|
||||||
text: |
|
text: |
|
||||||
Please choose update source according to your host location.
|
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/downloading page.
|
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 <a target="_blank" href="https://github.com/printempw/blessing-skin-server/wiki/%E6%9B%B4%E6%96%B0%E6%BA%90%E5%88%97%E8%A1%A8">this wiki article</a>.
|
||||||
|
|
||||||
download:
|
download:
|
||||||
downloading: Downloading update package...
|
downloading: Downloading update package...
|
||||||
size: "Size of package:"
|
size: "Size of package:"
|
||||||
|
|
||||||
errors:
|
errors:
|
||||||
prefix: "An error occured: "
|
prefix: "An error occured: "
|
||||||
connection: "Unable to access to current update source. Details:"
|
connection: We can't connect to the update source. :error
|
||||||
write-permission: Unable to make cache directory. Please sure permission.
|
write-permission: Unable to create the cache directory. Please check the permission.
|
||||||
unzip: "Failed to unzip update file. Error code: "
|
unzip: "Failed to extract update package. Error code: "
|
||||||
overwrite: Unable to overwrite files.
|
overwrite: Unable to overwrite files.
|
||||||
|
|
||||||
invalid-action: Invalid action
|
invalid-action: Invalid action
|
||||||
|
|
|
||||||
|
|
@ -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.
|
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:
|
cache_expire_time:
|
||||||
title: Cache Exipre Time
|
title: Cache Exipre Time
|
||||||
hint: In seconds, 86400 = one day, 31536000 = one year
|
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: <a href="https://github.com/printempw/blessing-skin-server/wiki/%E6%9B%B4%E6%96%B0%E6%BA%90%E5%88%97%E8%A1%A8">@GitHub Wiki</a>'
|
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,8 @@ update:
|
||||||
title: 注意事项
|
title: 注意事项
|
||||||
text: |
|
text: |
|
||||||
请根据你的主机所在位置(国内/国外)选择更新源。
|
请根据你的主机所在位置(国内/国外)选择更新源。
|
||||||
如错选至相对于你的主机速度较慢的源,可能会造成检查/下载更新页面长时间无响应。
|
如错选至相对于你的主机速度较慢的源,可能会造成检查与下载更新页面长时间无响应。
|
||||||
|
如何更换更新源?<a target="_blank" href="https://github.com/printempw/blessing-skin-server/wiki/%E6%9B%B4%E6%96%B0%E6%BA%90%E5%88%97%E8%A1%A8">点击了解详情</a>。
|
||||||
|
|
||||||
download:
|
download:
|
||||||
downloading: 正在下载更新包
|
downloading: 正在下载更新包
|
||||||
|
|
@ -161,8 +162,8 @@ update:
|
||||||
|
|
||||||
errors:
|
errors:
|
||||||
prefix: 发生错误:
|
prefix: 发生错误:
|
||||||
connection: 无法访问当前更新源。详细信息:
|
connection: 无法访问当前更新源。详细信息::error
|
||||||
write-permission: 您的服务器不支持自动更新:创建下载缓存文件夹失败,请检查目录权限。
|
write-permission: 你的服务器不支持自动更新:创建下载缓存文件夹失败,请检查目录权限。
|
||||||
unzip: 更新包解压缩失败。错误代码:
|
unzip: 更新包解压缩失败。错误代码:
|
||||||
overwrite: 您的服务器不支持自动更新:无法覆盖文件。
|
overwrite: 您的服务器不支持自动更新:无法覆盖文件。
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,13 +149,3 @@ resources:
|
||||||
cache_expire_time:
|
cache_expire_time:
|
||||||
title: 缓存失效时间
|
title: 缓存失效时间
|
||||||
hint: 秒数,86400 = 一天,31536000 = 一年
|
hint: 秒数,86400 = 一天,31536000 = 一年
|
||||||
|
|
||||||
update:
|
|
||||||
title: 更新选项
|
|
||||||
|
|
||||||
check_update:
|
|
||||||
title: 检查更新
|
|
||||||
label: 自动检查更新并提示
|
|
||||||
update_source:
|
|
||||||
title: 更新源
|
|
||||||
description: 可用的更新源列表可以在这里查看:<a href="https://github.com/printempw/blessing-skin-server/wiki/%E6%9B%B4%E6%96%B0%E6%BA%90%E5%88%97%E8%A1%A8">@GitHub Wiki</a>
|
|
||||||
|
|
|
||||||
|
|
@ -94,9 +94,12 @@
|
||||||
<!-- App Scripts -->
|
<!-- App Scripts -->
|
||||||
@include('common.dependencies.script')
|
@include('common.dependencies.script')
|
||||||
|
|
||||||
@if (option('check_update'))
|
<script>
|
||||||
<script>$(document).ready(checkForUpdates);</script>
|
$(document).ready(() => {
|
||||||
@endif
|
checkForUpdates();
|
||||||
|
checkForPluginUpdates();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
@if (option('allow_sending_statistics'))
|
@if (option('allow_sending_statistics'))
|
||||||
<script>sendFeedback();</script>
|
<script>sendFeedback();</script>
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,13 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@else
|
@else
|
||||||
<div class="callout callout-success">@lang('admin.update.info.up-to-date')</div>
|
|
||||||
|
@if ($connectivity === true)
|
||||||
|
<div class="callout callout-success">{{ trans('admin.update.info.up-to-date') }}</div>
|
||||||
|
@else
|
||||||
|
<div class="callout callout-danger">{{ trans('admin.update.errors.connection', ['error' => $connectivity]) }}</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
@ -103,10 +109,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
|
||||||
{!! $update->render() !!}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section><!-- /.content -->
|
</section><!-- /.content -->
|
||||||
</div><!-- /.content-wrapper -->
|
</div><!-- /.content-wrapper -->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user