Tahinli/forge
public0 watching
★ 0
| 1 | //! Releases: a tag with a title, notes and optional downloadable assets. The stored shape is in |
| 2 | //! migrations/0020_releases.sql; the store functions live in store/releases.rs. |
| 3 | //! |
| 4 | //! A release names a git tag. The tag itself lives in git, so deleting a release keeps it. |
| 5 | //! Asset bytes live in the blob store under `assets/<asset id>`; only metadata is stored here. |
| 6 | |
| 7 | use crateId; |
| 8 | |
| 9 | /// Longest release title, in characters. |
| 10 | pub const MAX_TITLE_CHARS: usize = 200; |
| 11 | /// Longest release body, in characters. |
| 12 | pub const MAX_BODY_CHARS: usize = 65_536; |
| 13 | /// Longest asset file name, in bytes. Names are ASCII, so bytes and characters agree. |
| 14 | pub const MAX_ASSET_NAME_LEN: usize = 200; |
| 15 | |
| 16 | /// A release. `published_at` is set once it is first published and stays set; `draft` decides |
| 17 | /// visibility. Drafts are shown only to people with Write on the repo. |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | /// A file attached to a release. `download_count` counts completed starts of downloads. |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | /// Input for `Store::create_release`. |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | /// The editable fields of a release. The tag and its target never change. |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | /// Input for `Store::add_asset`. The blob is already written under `assets/<id>`. |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | /// True for a file name that is safe in a `Content-Disposition` header and a URL segment: 1 to |
| 84 | /// [`MAX_ASSET_NAME_LEN`] of ASCII letters, digits, `.`, `-`, `_` or `+`, not starting with a dot. |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | /// The content type stored for an upload: a `type/subtype` token pair, or |
| 95 | /// `application/octet-stream` when the client sent nothing usable. |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 |