Cơ sở dữ liệu model thiết bị (tên thân thiện)

Ứng dụng macOS của OpenClaw hiển thị tên thiết bị Apple dễ đọc trong giao diện Instances bằng cách ánh xạ các model identifier của Apple (ví dụ iPad16,6, Mac16,6) sang tên dễ hiểu hơn.

Dữ liệu ánh xạ được lưu dưới dạng JSON tại:

  • apps/macos/Sources/OpenClaw/Resources/DeviceModels/

Nguồn dữ liệu

Hiện tại mình lấy dữ liệu ánh xạ từ repository có giấy phép MIT:

  • kyle-seongwoo-jun/apple-device-identifiers

Để đảm bảo build ổn định, các file JSON được ghim vào các commit cụ thể từ upstream (được ghi lại trong apps/macos/Sources/OpenClaw/Resources/DeviceModels/NOTICE.md).

Cập nhật cơ sở dữ liệu

  1. Chọn các commit upstream mà các bạn muốn ghim vào (một commit cho iOS, một commit cho macOS).
  2. Cập nhật commit hash trong apps/macos/Sources/OpenClaw/Resources/DeviceModels/NOTICE.md.
  3. Tải lại các file JSON, ghim vào các commit đó:
IOS_COMMIT="<commit sha for ios-device-identifiers.json>"
MAC_COMMIT="<commit sha for mac-device-identifiers.json>"

curl -fsSL "https://raw.githubusercontent.com/kyle-seongwoo-jun/apple-device-identifiers/${IOS_COMMIT}/ios-device-identifiers.json" \
  -o apps/macos/Sources/OpenClaw/Resources/DeviceModels/ios-device-identifiers.json

curl -fsSL "https://raw.githubusercontent.com/kyle-seongwoo-jun/apple-device-identifiers/${MAC_COMMIT}/mac-device-identifiers.json" \
  -o apps/macos/Sources/OpenClaw/Resources/DeviceModels/mac-device-identifiers.json
  1. Đảm bảo apps/macos/Sources/OpenClaw/Resources/DeviceModels/LICENSE.apple-device-identifiers.txt vẫn khớp với upstream (thay thế nếu license upstream có thay đổi).
  2. Kiểm tra ứng dụng macOS build thành công (không có warning):
swift build --package-path apps/macos