Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

> 更多功能正在持续开发... 欢迎交流评论

- 支持通过 `admin.assets_version` 配置项(或 `ADMIN_ASSETS_VERSION` 环境变量)自定义 JS/CSS 缓存破坏版本号,不再强制跟随框架版本
- [2025/08/05 增强对枚举字段的渲染支持](https://github.com/PrintNow/dcat-admin/pull/5)
- [@deflinhec : 修正 Grid 以 LazyRenderable 呈現時Group Filter 沒有正確篩選](https://github.com/PrintNow/dcat-admin/commit/4390a8f494c20910828e7c93513d13032f0d01dd)
- [新增 highlightjs 类以支持代码块高亮显示](https://github.com/PrintNow/dcat-admin/commit/52050882eea475b9d3863ace98048404f7d320b7)
Expand Down
12 changes: 12 additions & 0 deletions config/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@
*/
'assets_server' => env('ADMIN_ASSETS_SERVER'),

/*
|--------------------------------------------------------------------------
| Assets version
|--------------------------------------------------------------------------
|
| The version string appended to JS/CSS URLs as a cache-busting query
| parameter (e.g. `?v1.0.0`). Defaults to the framework version. Set to
| null/empty to disable the version query entirely.
|
*/
'assets_version' => env('ADMIN_ASSETS_VERSION'),

/**
* @deprecated 不再建议使用此配置。如果你使用了反向代理,配置好 `app/Http/Middleware/TrustProxies.php` 中的 $proxies 属性,
* 页面就会自动使用 https 协议。未来将完全移除此配置。
Expand Down
12 changes: 12 additions & 0 deletions src/Console/stubs/config.stub
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ return [
*/
'assets_server' => env('ADMIN_ASSETS_SERVER'),

/*
|--------------------------------------------------------------------------
| Assets version
|--------------------------------------------------------------------------
|
| The version string appended to JS/CSS URLs as a cache-busting query
| parameter (e.g. `?v1.0.0`). Defaults to the framework version. Set to
| null/empty to disable the version query entirely.
|
*/
'assets_version' => env('ADMIN_ASSETS_VERSION'),

/*
|--------------------------------------------------------------------------
| Access via `https`
Expand Down
8 changes: 7 additions & 1 deletion src/Layout/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,13 @@ public function withVersionQuery($url)
$url .= '?';
}

$ver = 'v'.Admin::VERSION;
$assetsVersion = config('admin.assets_version', Admin::VERSION);

if (! $assetsVersion) {
return rtrim($url, '?');
}

$ver = 'v'.$assetsVersion;

return Str::endsWith($url, '?') ? $url.$ver : $url.'&'.$ver;
}
Expand Down
Loading