Skip to content

Releases: dcat-x/dcat-admin

v2.0.4

Choose a tag to compare

@github-actions github-actions released this 09 Oct 08:09

What's Changed

  • fix(ui): 修复菜单图标、缩进、暗黑模式白条与横向滚动条

Full Changelog: v2.0.3...v2.0.4

v2.0.3

Choose a tag to compare

@github-actions github-actions released this 03 Sep 01:20

What's Changed

  • fix(admin): 修复菜单树与数据规则查询异常
  • fix(notification): 修复 JSON session 通知渲染异常
  • fix(permission): 修复部门与数据权限启用异常

Full Changelog: v2.0.2...v2.0.3

v2.0.2

Choose a tag to compare

@github-actions github-actions released this 29 Jul 02:12

What's Changed

  • fix(admin): 修复控制器闭包上下文错误

Full Changelog: v2.0.1...v2.0.2

v2.0.1

Choose a tag to compare

@github-actions github-actions released this 06 May 05:48

What's Changed

  • fix(show): 修复 Field::image()/file() 闭包内 $this 误绑导致 BadMethodCallException
  • docs(changelog): 润色 v2.0.0 条目,合并重复 Added 段并补充上下文

Full Changelog: v2.0.0...v2.0.1

v2.0.0

Choose a tag to compare

@github-actions github-actions released this 01 May 00:15

v2.0.0 是包含破坏性变更的主版本,主要面向想升级到 Laravel 13 的用户。停留在 PHP 8.2 / Laravel 12 的项目请固定 `dcat-x/laravel-admin: ^1.0`,1.x 仍维护安全修复。

Breaking Changes

  • PHP 最低版本提升至 8.3 — Laravel 13 要求 PHP 8.3+,对应 dcat-admin 升至 v2.0.0;PHP 8.2 用户请继续使用 v1.x
  • 移除 `doctrine/dbal` 依赖 — Laravel 11+ 已不再依赖该包,dcat-admin 源码全程零引用;如外部项目通过本包传递依赖该库,请显式 `composer require doctrine/dbal`

Added

  • 支持 Laravel 13 — 同时兼容 Laravel 12 与 Laravel 13:
    • `laravel/framework: ^12.0||^13.0`
    • `orchestra/testbench: ^10.0||^11.0`
    • `phpunit/phpunit: ^11.0||^12.0`
    • `spatie/eloquent-sortable: ^4.0||^5.0`
  • CI 双版矩阵 — PHP 8.3/8.4 × Laravel 12/13 共 6 个 job,本地双跑 5027 tests / 8071 assertions 全绿

Fixed

  • `ListField::formatValidatorMessages()` 数组消息处理 — 此前把 `MessageBag::toArray()` 返回的 `array` 当作单条消息整体塞进新 MessageBag,行为不正确(被 Laravel 13 收紧的 `MessageBag::add()` 类型签名揭出);修复为遍历每条字符串消息分别 add

Docs

  • README / `docs/getting-started/introduction.md` / `upgrade-from-original.md` / `update.md` 全部同步至 v2.x 兼容性矩阵
  • `update.md` 新增「从 1.x 升级到 2.x」完整章节

Upgrade

```json
{
"require": {
"php": "^8.3",
"laravel/framework": "^12.0||^13.0",
"dcat-x/laravel-admin": "^2.0"
}
}
```

详见 docs/getting-started/update.md#从-1x-升级到-2x。

Full Changelog: v1.2.2...v2.0.0

v1.2.2

Choose a tag to compare

@github-actions github-actions released this 30 Apr 06:56

Changed

  • 扁平化样式收敛 — border-radius / transition / opacity 散落硬编码统一为 var(--radius-*) / var(--transition-*) 体系;移除滚动条 45° 斜纹与暗色 tab 渐变 active 横条
  • 彻底移除 SCSS 阴影变量层 — _variables.scss 中 9 个值为 none 的 shadow 变量定义全部删除($shadow / $shadow-100..200 / $btn-shadow* 等),17 个组件文件中约 30 处冗余 box-shadow 引用一并清除
  • 移除 CSS 自定义属性 shadow 层 — _modern.scss :root 下 --shadow-xs/sm/md/lg/xl 5 个 none 定义删除;6 个 .shadow-* 工具类合并为单一规则(保留选择器作为外部 API)
  • 保留功能性阴影 — \$menu-shadow(菜单/侧栏轻量分层)、focus ring、kbd inset、固定列分隔阴影等语义性阴影不动

Compatibility

  • 工具类 .shadow / .shadow-100 / .shadow-200 / .shadow-xs..xl / .box-shadow 选择器作为外部 API 保留,HTML 中现有用法仍生效(视觉统一为 none)
  • .btn-shadow / .navbar-shadow 等装饰类已无视觉效果但选择器保留
  • 24 套主题全量重打通过;编译产物 dcat-app.css 132 KiB

Full Changelog: v1.2.1...v1.2.2

v1.2.1

Choose a tag to compare

@github-actions github-actions released this 30 Apr 06:19

Patch release. Recommended for all users on v1.2.0 — fixes a high-severity import replay vulnerability and a 500 on the most common Grid::make(new Model()) import path.

Fixed

Import execute 端点存在重放写入风险(high)

dcat-api/import/execute 此前没有任何授权检查,签名 _import_config 一旦泄露/留存就成为可重放的写权限——离职/降权管理员只要 cookie 仍有效就能持续写库。

修复方案:

  • buildImporterConfig() 把 user_id / source 路由名 / expires_at 一并签入 payload
  • execute() 调用 guardExecute() 做三重校验:
    • expires_at 过期 → 419 拒绝
    • user_id 与当前登录用户不一致 → 403 拒绝
    • source 路由的 admin.permission 中间件参数 → 用 PermissionChecker 重跑权限检查
  • template 端点不写库,跳过 guard,让用户在签名过期时仍能下载模板

默认 Grid 导入因丢失 model 信息而 500(high)

最常见用法 Grid::make(new SomeModel()) 创建的 repository 是基类 EloquentRepository 的实例,model 信息存在实例 state 而非类名;之前实现只签了 get_class($repo),下次请求 app(EloquentRepository::class) 拿到空壳,createModel() 必触发 TypeError。

修复方案:

  • EloquentRepository 新增 eloquentClass() 访问器
  • buildImporterConfig() 检测到 EloquentRepository 实例时同时签 model 类名
  • buildRepository() 接受 modelClass 参数,对基类 EloquentRepository 走 new EloquentRepository($modelClass) 重建带 model 的 repo;校验 model 是 Eloquent\Model 子类,否则返回 null

Changed

  • 全面扁平化 dcat 阴影系统 — dcat 自家代码移除散落的硬编码 rgba 阴影,改走统一的 $shadow / $shadow-100/200 变量;_modern.scss 末尾新增 AdminLTE Shadow Flatten 区块,通过主题层覆盖 AdminLTE 残留装饰阴影(不动 AdminLTE 源码)。保留功能性 / 语义性 shadow:a11y focus ring、.elevation-1..5 工具类、PACE / nprogress glow、kbd inset shadow、固定列分隔阴影、$menu-shadow
  • 统一 .alert-* 视觉风格 — 5 个 alert 之前 shadow 透明度各不相同(0.16 / 0.12 / 0.09 / 无 / 无),改为全部纯色背景 + 文字色,无浮起阴影,与 .callout-light 扁平化整体方向一致

Compatibility

  • 签名 payload 新增 user_id / source / expires_at / model 字段,向前兼容——老客户端缓存的页面(升级前打开未刷新)签名不带这些字段,guardExecute 检测字段存在性才校验,最坏只是无防重放保护,等同升级前行为;用户刷新页面后立即获得三层保护
  • 没有改任何前端 JS 调用方式,ImportButton URL / 字段名不变

Verify

composer ci 全绿(Pint / Rector / PHPStan level 5 / 5027 tests),新增 7 个测试覆盖修复的所有路径。


Full Changelog: v1.2.0...v1.2.1

v1.2.0

Choose a tag to compare

@github-actions github-actions released this 30 Apr 05:13

Breaking Changes

  • Action/Form 类名签名校验 — _action 和 _form_ 参数现在必须携带 HMAC 签名,未签名请求默认拒绝。新增 admin.allow_unsigned_dispatch(env: ADMIN_ALLOW_UNSIGNED_DISPATCH)作为升级期临时开关,默认 false。前端 JS 无需修改,直接构造请求的外部系统需适配(参见 docs/advanced/class-signing.md)
  • 导入预览接口移除 — POST /dcat-api/import/preview 路由及 Importer preview() 方法已删除,前端从未使用
  • 全局搜索最短关键词 — 从 1 字符提升到 2 字符
  • 导入配置签名格式变更 — _import_config 由 base64(json|sig) 改为 base64(json({p,s})) envelope,避免 payload 含 | 时被截断;老缓存页面提交会因校验失败回退空配置,刷新页面即恢复

Added

  • Octane 静态状态清理 — Resettable 接口 + FlushAdminState 集成,6 个核心类实现 resetState()(参见 docs/advanced/octane.md)
  • 导入器签名负载 — Grid 渲染时把 importer / repository 类名一同 HMAC 签名传输,服务端反序列化时校验类型归属(AbstractImporter / Repository)
  • AbstractImporter::setRepository() / repository() — 允许在没有 Grid 的场景显式注入 repository
  • 全局搜索增强 — limit 参数限制 1~50,搜索提供者异常隔离
  • Feature 测试基础设施 — FeatureTestCase 基类支持 HTTP 级测试
  • HasRequestCache::resetRequestCache() — 请求级缓存显式清理方法
  • Larastan 替代原生 PHPStan — 收窄忽略规则

Changed

  • 菜单权限匹配 — 支持 UUID/ULID/slug 路径,RESTful 结构化位置匹配
  • 上传控制器 — 公共逻辑抽到 UploadsFiles trait,新增文件校验,命名改用 Str::random(32)
  • 路由注册 — 全部改用 [Controller::class, 'method'] 数组语法
  • PHP 8.2+ 语法现代化 — is_null → === null、first-class callable、消除 call_user_func、清理死代码

Fixed

  • ClassSigner::verify() 默认拒绝未签名输入(high)— 此前 b8b9420 把校验失败降级为 warn+放行,等同于回退到无签名状态;攻击者只要不带签名即可绕过 HMAC 派发任意 Action(如 Extensions\Uninstall)
  • ExcelImporter::import() 不再依赖 grid(high)— 此前 resolveImporter() 创建的 importer 从未调用 setGrid(),$this->grid->model()->repository() 必空指针,generic /dcat-api/import/execute 真实上传时 500
  • 导入配置签名 pipe 截断(medium)— decodeConfig 用 explode('|', ..., 2) 切首个 |,含 required|email 这类规则的 JSON 必被截断,校验失败后静默落入空配置
  • 导入链路 — ImportController::resolveImporter() 缺少 Grid 上下文导致 NPE

Build

  • 生产 sourcemap 关闭 — webpack.mix.js 增加 mix.options({ sourceMaps: false }),配合清理 57 个孤儿 .map 文件,仓库瘦身约 19 MB(保留被 sourceMappingURL 显式引用的 4 个 colorpicker map)

Full Changelog: v1.1.31...v1.2.0

v1.1.31

Choose a tag to compare

@github-actions github-actions released this 16 Mar 08:04

What's Changed

  • ♻️ refactor: 优化 Rector 规则配置并清理死代码
  • 🎨 style: 优化代码生成模板(stubs)
  • ♻️ refactor: 引入 Rector 自动检测并修复 strict_types 类型安全问题
  • 🐛 fix: 修复 strict_types 下的潜在 TypeError(第五批)
  • 🐛 fix: 深度扫描修复 strict_types 下的潜在 TypeError(第四批)

Full Changelog: v1.1.30...v1.1.31

v1.1.30

Choose a tag to compare

@github-actions github-actions released this 16 Mar 07:03

What's Changed

  • 🐛 fix: 补充修复 strict_types 下的潜在 TypeError(第三批)
  • 🐛 fix: 全面修复 strict_types 下潜在的 TypeError

Full Changelog: v1.1.29...v1.1.30