diff --git a/app/Http/Controllers/UpdateController.php b/app/Http/Controllers/UpdateController.php index 49d1ac87..6b6e701b 100644 --- a/app/Http/Controllers/UpdateController.php +++ b/app/Http/Controllers/UpdateController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers; use Arr; use Log; use Utils; +use Option; use ZipArchive; use App\Services\Storage; use Illuminate\Http\Request; @@ -35,7 +36,7 @@ class UpdateController extends Controller 'release_url' => '', 'pre_release' => false, // fallback to current time - 'release_time' => time(), + 'release_time' => '', 'new_version_available' => false ]; @@ -43,10 +44,6 @@ class UpdateController extends Controller if ($this->getUpdateInfo()) { $info['latest_version'] = $this->getUpdateInfo('latest_version'); - if ($current_release = $this->getReleaseInfo($this->currentVersion)) { - $info['release_time'] = Arr::get($current_release, 'release_time') ?: time(); - } - $info['new_version_available'] = version_compare( $info['latest_version'], $info['current_version'], '>' @@ -63,10 +60,26 @@ class UpdateController extends Controller // if detailed release info is not given $info['new_version_available'] = false; } + + if (!$info['new_version_available']) { + $info['release_time'] = Arr::get($this->getReleaseInfo($this->currentVersion), 'release_time'); + } } + $update = Option::form('update', '更新选项', function($form) + { + $form->checkbox('check_update', '检查更新')->label('自动检查更新并提示'); + $form->text('update_source', '更新源') + ->description('可用的更新源列表可以在这里查看:@GitHub Wiki'); + })->handle()->always(function($form) { + try { + $response = file_get_contents(option('update_source')); + } catch (\Exception $e) { + $form->addMessage('无法访问当前更新源。详细信息:'.$e->getMessage(), 'danger'); + } + }); - return view('admin.update')->with('info', $info); + return view('admin.update')->with('info', $info)->with('update', $update); } public function checkUpdates() diff --git a/resources/lang/en/admin.yml b/resources/lang/en/admin.yml index b1e297c8..8a214c1a 100644 --- a/resources/lang/en/admin.yml +++ b/resources/lang/en/admin.yml @@ -1,70 +1,80 @@ +index: + total-users: Registered Users + total-players: Players + total-textures: Uploaded Textures + disk-usage: Disk Usage + overview: Overview + customize: change-color: Change theme color - color: + colors: blue: Blue (Default) - blue-white-sidebar: Blue with white sidebar + blue-light: Blue Light yellow: Yellow - yellow-white-sidebar: Yellow with white sidebar + yellow-light: Yellow Light green: Green - green-white-sidebar: Green with white sidebar + green-light: Green Light purple: Purple - purple-white-sidebar: Purple with white sidebar + purple-light: Purple Light red: Red - red-white-sidebar: Red with white sidebar + red-light: Red Light black: Black - black-white-sidebar: Black with white sidebar - -index: - users-count: 注册用户 - players-count: 角色总数 - textures-count: 上传材质总数 - usage: Usage - overview: Overview + black-light: Black Light plugins: name: Name description: Description author: Author version: Version - status: Status - opration: Opration - enabled: Enabled - disabled: Disabled - disable-plugin: Disable plugin - enable-plugin: Enable plugin - plugin-config: Plugin configuration - no-cofig: Plugin has been disabled or no configuration. - delete-plugin: delete-plugin + status: + title: Status + enabled: Enabled + disabled: Disabled - no-result: No result + operations: + title: Operations + disable: Disable + enable: Enable + configure: Configure + no-config-notice: The plugin has been disabled or no configuration is provided. + delete: Delete + + empty: No result update: - update-info: Update information - update-available: New version available. - latest-version: 'Latest version:' - current-version: 'Current version' - release-time: 'Release time:' - change-log: 'Change log:' - no-log: 'Empty' - download-link: 'Download link:' - download-full: Click here to download full zip file - pre-release-warning: 本次更新为预发布版,请谨慎选择是否更新。 - latest-now: It is latest version. - pre-release: 当前版本为未发布测试版 - button: Update - check-forum: 查看 MCBBS 发布贴 - forum-url: 'http://www.mcbbs.net/thread-552877-1-1.html' - caution: Cautions - choose-source: Please choose update source according to location (China or not) of your server. - choose-wrong: 如错选至相对于你的主机速度较慢的源,可能会造成检查/下载更新页面长时间无响应。 - update-options: Update options - config-saved: Saved - connection-error: 无法访问当前更新源。详细信息: - check-update: Check update - auto-check: 自动检查更新并提示 - source: Sources - source-list: Available sources list - downloading: Downloading - size: 'Package size:' + info: + title: Update Information + + up-to-date: Already up-to-date. + available: New version available. + pre-release-warning: This update is a pre-release, please double check before updating. + + versions: + latest: "Latest Version:" + current: "Current Version:" + + release-time: "Release Time:" + pre-release: You are now using pre-release version. + + change-log: + text: "Change Log:" + empty: Empty + + downloads: + text: "Download Link:" + link: Click to download full program package. + + check-github: Check GitHub Releases + button: Update Now + + 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. + + download: + downloading: Downloading update package... + size: "Size of package:" diff --git a/resources/lang/en/general.yml b/resources/lang/en/general.yml index 72db3cc5..02fefb9c 100644 --- a/resources/lang/en/general.yml +++ b/resources/lang/en/general.yml @@ -13,11 +13,11 @@ anonymous: Guest back: Back dashboard: Dashboard my-closet: Closet -player-manage: Player Manage -user-manage: User Manage -plugin-manage: Plugin Manage +player-manage: Players +user-manage: Users +plugin-manage: Plugins plugin-market: Plugin Market -plugin-installed: Installed +plugin-installed: Installed Plugins customize: Customize options: Options import-v2: Import Data diff --git a/resources/lang/en/locale.js b/resources/lang/en/locale.js index 55d50081..00a49c2a 100644 --- a/resources/lang/en/locale.js +++ b/resources/lang/en/locale.js @@ -127,14 +127,14 @@ cape: 'Cape', pid: 'Texture ID', pidNotice: 'Please enter the tid of texture', - changePlayerTexture: 'Change textures of :player' + changePlayerTexture: 'Change textures of :player', // Index - textureUpload: 'Texture Upload', - registration: 'Registration' + textureUploads: 'Texture Uploads', + userRegistration: 'User Registration', // Plugins - deletionConfirmation: 'Really delete this plugin?' + confirmDeletion: 'Are you sure to delete this plugin?' }, utils: { fatalError: 'Fatal Error (Please contact the author)' diff --git a/resources/lang/zh-CN/admin.yml b/resources/lang/zh-CN/admin.yml deleted file mode 100644 index 1f8ae42e..00000000 --- a/resources/lang/zh-CN/admin.yml +++ /dev/null @@ -1,70 +0,0 @@ -customize: - change-color: 更改配色 - - color: - blue: 蓝色主题(默认) - blue-white-sidebar: 蓝色主题-白色侧边栏 - yellow: 黄色主题 - yellow-white-sidebar: 黄色主题-白色侧边栏 - green: 绿色主题 - green-white-sidebar: 绿色主题-白色侧边栏 - purple: 基佬紫 - purple-white-sidebar: 紫色主题-白色侧边栏 - red: 喜庆红(笑) - red-white-sidebar: 红色主题-白色侧边栏 - black: 高端黑 - black-white-sidebar: 黑色主题-白色侧边栏 - -index: - users-count: 注册用户 - players-count: 角色总数 - textures-count: 上传材质总数 - usage: 占用空间大小 - overview: 概览 - -plugins: - name: 名称 - description: 描述 - author: 作者 - version: 版本 - status: 状态 - opration: 操作 - - enabled: 已启用 - disabled: 已禁用 - disable-plugin: 禁用插件 - enable-plugin: 启用插件 - plugin-config: 插件配置 - no-cofig: 插件已被禁用或无配置页 - delete-plugin: 删除插件 - - no-result: 无结果 - -update: - update-info: 更新信息 - update-available: 有更新可用。 - latest-version: 最新版本: - current-version: 当前版本: - release-time: 发布时间: - change-log: 更新日志: - no-log: 无内容 - download-link: 下载地址: - download-full: 点击下载完整安装包 - pre-release-warning: 本次更新为预发布版,请谨慎选择是否更新。 - latest-now: 已更新至最新版本。 - pre-release: 当前版本为未发布测试版 - button: 马上升级 - check-forum: 查看 MCBBS 发布贴 - forum-url: 'http://www.mcbbs.net/thread-552877-1-1.html' - caution: 注意事项 - choose-source: 请根据你的主机所在位置(国内/国外)选择更新源。 - choose-wrong: 如错选至相对于你的主机速度较慢的源,可能会造成检查/下载更新页面长时间无响应。 - update-options: 更新选项 - config-saved: 设置已保存。 - connection-error: 无法访问当前更新源。详细信息: - check-update: 检查更新 - auto-check: 自动检查更新并提示 - source: 更新源 - source-list: 可用的更新源列表可以在这里查看: - downloading: 正在下载更新包 - size: 更新包大小: diff --git a/resources/lang/zh_CN/admin.yml b/resources/lang/zh_CN/admin.yml new file mode 100644 index 00000000..a69d5dd0 --- /dev/null +++ b/resources/lang/zh_CN/admin.yml @@ -0,0 +1,80 @@ +index: + total-users: 注册用户 + total-players: 角色总数 + total-textures: 上传材质总数 + disk-usage: 占用空间大小 + overview: 概览 + +customize: + change-color: 更改配色 + + colors: + blue: 蓝色主题(默认) + blue-light: 蓝色主题 - 白色侧边栏 + yellow: 黄色主题 + yellow-light: 黄色主题 - 白色侧边栏 + green: 绿色主题 + green-light: 绿色主题 - 白色侧边栏 + purple: 基佬紫 + purple-light: 紫色主题 - 白色侧边栏 + red: 喜庆红(笑) + red-light: 红色主题 - 白色侧边栏 + black: 高端黑 + black-light: 黑色主题 - 白色侧边栏 + +plugins: + name: 名称 + description: 描述 + author: 作者 + version: 版本 + + status: + title: 状态 + enabled: 已启用 + disabled: 已禁用 + + operations: + title: 操作 + disable: 禁用插件 + enable: 启用插件 + configure: 插件配置 + no-config-notice: 插件已被禁用或无配置页 + delete: 删除插件 + + empty: 无结果 + +update: + info: + title: 更新信息 + + up-to-date: 已更新至最新版本。 + available: 有更新可用。 + pre-release-warning: 本次更新为预发布版,请谨慎选择是否更新。 + + versions: + latest: 最新版本: + current: 当前版本: + + release-time: 发布时间: + pre-release: 当前版本为未发布测试版 + + change-log: + text: 更新日志: + empty: 无内容 + + downloads: + text: 下载地址: + link: 点击下载完整安装包 + + check-github: 查看 GitHub Releases + button: 马上升级 + + cautions: + title: 注意事项 + text: | + 请根据你的主机所在位置(国内/国外)选择更新源。 + 如错选至相对于你的主机速度较慢的源,可能会造成检查/下载更新页面长时间无响应。 + + download: + downloading: 正在下载更新包 + size: 更新包大小: diff --git a/resources/lang/zh_CN/locale.js b/resources/lang/zh_CN/locale.js index 177b33fe..40d270ba 100644 --- a/resources/lang/zh_CN/locale.js +++ b/resources/lang/zh_CN/locale.js @@ -127,14 +127,14 @@ cape: '披风', pid: '材质 ID', pidNotice: '输入要更换的材质的 TID', - changePlayerTexture: '更换角色 :player 的材质' + changePlayerTexture: '更换角色 :player 的材质', // Index - textureUpload: '材质上传', - registration: '用户注册' + textureUploads: '材质上传', + userRegistration: '用户注册', // Plugins - deletionConfirmation: '真的要删除这个插件吗?' + confirmDeletion: '真的要删除这个插件吗?' }, utils: { fatalError: '严重错误(请联系作者)' diff --git a/resources/views/admin/customize.tpl b/resources/views/admin/customize.tpl index cce26c7e..259e383c 100644 --- a/resources/views/admin/customize.tpl +++ b/resources/views/admin/customize.tpl @@ -30,54 +30,14 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @foreach(['blue', 'yellow', 'green', 'purple', 'red', 'black'] as $color) + @foreach([$color, "$color-light"] as $innerColor) + + + + + @endforeach + @endforeach
{{ trans('admin.customize.color.blue') }}
{{ trans('admin.customize.color.blue-white-sidebar') }}
{{ trans('admin.customize.color.yellow') }}
{{ trans('admin.customize.color.yellow-white-sidebar') }}
{{ trans('admin.customize.color.green') }}
{{ trans('admin.customize.color.green-white-sidebar') }}
{{ trans('admin.customize.color.purple') }}
{{ trans('admin.customize.color.purple-white-sidebar') }}
{{ trans('admin.customize.color.red') }}
{{ trans('admin.customize.color.red-white-sidebar') }}
{{ trans('admin.customize.color.black') }}
{{ trans('admin.customize.color.black-white-sidebar') }}
{{ trans("admin.customize.colors.$innerColor") }}
diff --git a/resources/views/admin/index.tpl b/resources/views/admin/index.tpl index 9b2908b4..d2d2b002 100644 --- a/resources/views/admin/index.tpl +++ b/resources/views/admin/index.tpl @@ -25,7 +25,7 @@
- {{ trans('admin.index.users-count') }} + {{ trans('admin.index.total-users') }} {{ App\Models\User::all()->count() }}
@@ -37,7 +37,7 @@
- {{ trans('admin.index.players-count') }} + {{ trans('admin.index.total-players') }} {{ App\Models\Player::all()->count() }}
@@ -48,7 +48,7 @@
- {{ trans('admin.index.textures-count') }} + {{ trans('admin.index.total-textures') }} {{ \Database::table('textures')->getRecordNum() }}
@@ -56,7 +56,7 @@
- {{ trans('admin.index.usage') }} + {{ trans('admin.index.disk-usage') }} fetchArray("SELECT SUM(`size`) AS total_size FROM `{table}` WHERE 1")['total_size'] ?: 0; ?> {{ $size > 1024 ? round($size / 1024, 1)."MB" : $size."KB" }}
@@ -113,7 +113,7 @@ labels: {!! json_encode($labels) !!}, datasets: [ { - label: trans("admin.textureUpload"), + label: trans("admin.textureUploads"), fillColor: "rgba(210, 214, 222, 1)", strokeColor: "rgba(210, 214, 222, 1)", pointColor: "rgba(210, 214, 222, 1)", @@ -123,7 +123,7 @@ data: {!! json_encode($data['texture_upload']) !!} }, { - label: trans("admin.registration"), + label: trans("admin.userRegistration"), fillColor: "rgba(60,141,188,0.9)", strokeColor: "rgba(60,141,188,0.8)", pointColor: "#3b8bba", diff --git a/resources/views/admin/plugins.tpl b/resources/views/admin/plugins.tpl index 757fb1bc..e281c536 100644 --- a/resources/views/admin/plugins.tpl +++ b/resources/views/admin/plugins.tpl @@ -36,8 +36,8 @@ td#description { {{ trans('admin.plugins.description') }} {{ trans('admin.plugins.author') }} {{ trans('admin.plugins.version') }} - {{ trans('admin.plugins.status') }} - {{ trans('admin.plugins.operation') }} + {{ trans('admin.plugins.status.title') }} + {{ trans('admin.plugins.operations.title') }} @@ -50,33 +50,33 @@ td#description { {{ $plugin->version }} @if ($plugin->isEnabled()) - {{ trans('admin.plugins.enabled') }} + {{ trans('admin.plugins.status.enabled') }} @else - {{ trans('admin.plugins.disabled') }} + {{ trans('admin.plugins.status.disabled') }} @endif @if ($plugin->isEnabled()) - {{ trans('admin.plugins.disable-plugin') }} + {{ trans('admin.plugins.operations.disable') }} @else - {{ trans('admin.plugins.enable-plugin') }} + {{ trans('admin.plugins.operations.enable') }} @endif @if ($plugin->isEnabled() && $plugin->hasConfigView()) - {{ trans('admin.plugins.plugin-config') }} + {{ trans('admin.plugins.operations.configure') }} @else - {{ trans('admin.plugins.no-config') }} + {{ trans('admin.plugins.operations.configure') }} @endif - {{ trans('admin.plugins.delete-plugin') }} + {{ trans('admin.plugins.operations.delete') }} @empty 0 - {{ trans('admin.plugins.no-result') }} + {{ trans('admin.plugins.empty') }} (´・ω・`) @endforelse @@ -105,7 +105,7 @@ td#description { function deletePlugin(name) { swal({ - text: trans('admin.deletionConfirmation'), + text: trans('admin.confirmDeletion'), type: 'warning', showCancelButton: true }).then(function() { diff --git a/resources/views/admin/update.tpl b/resources/views/admin/update.tpl index 5908e780..96f43f5e 100644 --- a/resources/views/admin/update.tpl +++ b/resources/views/admin/update.tpl @@ -27,67 +27,67 @@
-

{{ trans('admin.update.update-info') }}

+

{{ trans('admin.update.info.title') }}

@if ($info['new_version_available']) -
{{ trans('admin.update.update-available') }}
+
{{ trans('admin.update.info.available') }}
- + - + - + - + - + @if($info['pre_release']) -
{{ trans('admin.update.pre-release-warning') }}
+
{{ trans('admin.update.info.pre-release-warning') }}
@endif
{{ trans('admin.update.latest-version') }}{{ trans('admin.update.info.versions.latest') }} v{{ $info['latest_version'] }}
{{ trans('admin.update.current-version') }}{{ trans('admin.update.info.versions.current') }} v{{ $info['current_version'] }}
{{ trans('admin.update.release-time') }}{{ trans('admin.update.info.release-time') }} {{ Utils::getTimeFormatted($info['release_time']) }}
{{ trans('admin.update.change-log') }}{{ trans('admin.update.info.change-log.text') }} - {!! nl2br($info['release_note']) ?: "{{ trans('admin.update.no-log') }}" !!} + {!! nl2br($info['release_note']) ?: trans('admin.update.info.change-log.empty') !!}
{{ trans('admin.update.download-link') }}{{ trans('admin.update.info.downloads.text') }} - {{ trans('admin.update.download-full') }} + {{ trans('admin.update.info.downloads.link') }}
@else -
{{ trans('admin.update.latest-now') }}
+
{{ trans('admin.update.info.up-to-date') }}
- + - + @@ -96,75 +96,23 @@ @endif
-

{{ trans('admin.update.caution') }}

+

{{ trans('admin.update.cautions.title') }}

-

{{ trans('admin.update.choose-source') }}

-

{{ trans('admin.update.choose-wrong') }}

+

{!! nl2br(trans('admin.update.cautions.text')) !!}

-
-
-

{{ trans('admin.update.update-options') }}

-
-
-
- $value) { - if ($key != "option" && $key != "submit") - Option::set($key, $value); - } - - echo '
{{ trans('admin.update.config-saved') }}
'; - } - - try { - $response = file_get_contents(option('update_source')); - } catch (Exception $e) { - echo '
{{ trans('admin.update.connection-error') }}'.$e->getMessage().'
'; - } - - ?> -
{{ trans('admin.update.current-version') }}{{ trans('admin.update.info.versions.current') }} v{{ $info['current_version'] }}
{{ trans('admin.update.release-time') }}{{ trans('admin.update.info.release-time') }} - @if (isset($info['release_time'])) + @if ($info['release_time']) {{ Utils::getTimeFormatted($info['release_time']) }} @else - {{ trans('admin.update.pre-release') }} + {{ trans('admin.update.info.pre-release') }} @endif
- - - - - - - - - - - -
{{ trans('admin.update.check-update') }} - -
{{ trans('admin.update.source') }} - - -

{{ trans('admin.update.source-list') }}@GitHub Wiki

-
-
- - -
+ {!! $update->render() !!}