Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

/docs does not work offline: allow a configurable swagger-ui asset URL

Đã đóng
#1,061 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
78/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
backend, documentation

Hướng nghiên cứu

Start in docs/ui.go and inspect how configuration fields are defined and exposed through config.yml. Add the optional Swagger UI asset URL while preserving the current cdnjs default and integrity hashes, then verify that /docs uses the configured base URL and retains the existing default behavior.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Split out of #1053. That issue is now SRI and version only, fixed by #1060.

/docs loads swagger-ui's CSS and JS from cdnjs. On an air-gapped or LAN-only install the page stays blank. The rest of the web UI is embedded with go:embed, so /docs is the only page that needs internet access.

Bundling swagger-ui-dist was turned down in #114 because of binary size (about 1.5 MB gzipped), and so were build tags. This proposal needs neither.

Proposal: an optional setting for where /docs loads the swagger-ui assets from, e.g. GOTIFY_SERVER_SWAGGERUIURL / server.swaggeruiurl in config.yml. It defaults to the current cdnjs path. docs/ui.go would put the setting in front of the three filenames and keep the same integrity hashes. A local mirror would then have to serve byte-identical files for the pinned version, so a changed or wrong-version mirror fails closed rather than running in the app origin.

  • No change to binary size or default behaviour.
  • An offline user runs something like npm pack swagger-ui-dist@<pinned> once, hosts the three files on any internal static server (or a reverse proxy path) and sets the URL.
  • About ten lines in docs/ui.go plus a config field.

Workaround until then: /swagger still serves the spec JSON, so an offline Swagger/OpenAPI viewer can load it directly.

If you're open to it I can send the PR or just close this if its still off the table.

Ngôn ngữ chính
Go
Star
16.1k
Fork
898
Merge trung bình
3 ngày 16 giờ
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của gotify/server

Tất cả issue của gotify/server

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.