[mirror] Scalable static site server for Git forges (like GitHub Pages)
1edition = "2023";
2
3option go_package = "codeberg.org/git-pages/git-pages/git_pages";
4
5import "google/protobuf/timestamp.proto";
6
7enum Type {
8 // Invalid entry.
9 InvalidEntry = 0;
10 // Directory.
11 Directory = 1;
12 // Inline file. `Blob.Data` contains file contents.
13 InlineFile = 2;
14 // External file. `Blob.Data` contains object reference.
15 ExternalFile = 3;
16 // Symlink. `Blob.Data` contains relative path.
17 Symlink = 4;
18}
19
20// Transformation names should match HTTP `Accept-Encoding:` header.
21enum Transform {
22 // No transformation.
23 Identity = 0;
24 // Zstandard compression.
25 Zstd = 1;
26}
27
28message Entry {
29 Type type = 1;
30 // Only present for `type == InlineFile` and `type == ExternalFile`.
31 // For transformed entries, refers to the pre-transformation (decompressed) size; otherwise
32 // equal to `compressed_size`.
33 int64 original_size = 7;
34 // Only present for `type == InlineFile` and `type == ExternalFile`.
35 // For transformed entries, refers to the post-transformation (compressed) size; otherwise
36 // equal to `original_size`.
37 int64 compressed_size = 2;
38 // Meaning depends on `type`:
39 // * If `type == InlineFile`, contains file data.
40 // * If `type == ExternalFile`, contains blob name (an otherwise unspecified
41 // cryptographically secure content hash).
42 // * If `type == Symlink`, contains link target.
43 // * Otherwise not present.
44 bytes data = 3;
45 // Only present for `type == InlineFile` and `type == ExternalFile` that
46 // have been transformed.
47 Transform transform = 4;
48 // Only present for `type == InlineFile` and `type == ExternalFile`.
49 // Currently, optional (not present on certain legacy manifests).
50 string content_type = 5;
51 // May be present for `type == InlineFile` and `type == ExternalFile`.
52 // Used to reduce the amount of work being done during git checkouts.
53 // The type of hash used is determined by the length:
54 // * 40 bytes: SHA1DC (as hex)
55 // * 64 bytes: SHA256 (as hex)
56 string git_hash = 6;
57}
58
59// See https://docs.netlify.com/manage/routing/redirects/overview/ for details.
60// Only a subset of the Netlify specification is representable here.
61message RedirectRule {
62 string from = 1;
63 string to = 2;
64 uint32 status = 3;
65 bool force = 4;
66}
67
68// See https://docs.netlify.com/manage/routing/headers/ for details.
69message Header {
70 string name = 1;
71 repeated string values = 2;
72}
73
74message HeaderRule {
75 string path = 1;
76 repeated Header header_map = 2;
77}
78
79message Problem {
80 string path = 1;
81 string cause = 2;
82}
83
84message Manifest {
85 // Source metadata.
86 string repo_url = 1;
87 string branch = 2;
88 string commit = 3;
89
90 // Site contents.
91 map<string, Entry> contents = 4;
92 int64 original_size = 10; // sum of each `entry.original_size`
93 int64 compressed_size = 5; // sum of each `entry.compressed_size`
94 int64 stored_size = 8; // sum of deduplicated `entry.compressed_size` for external files only
95
96 // Netlify-style `_redirects` and `_headers` rules.
97 repeated RedirectRule redirects = 6;
98 repeated HeaderRule headers = 9;
99
100 // Diagnostics for non-fatal errors.
101 repeated Problem problems = 7;
102}
103
104enum AuditEvent {
105 // Invalid event.
106 InvalidEvent = 0;
107 // A manifest was committed (a site was created or updated).
108 CommitManifest = 1;
109 // A manifest was deleted (a site was deleted).
110 DeleteManifest = 2;
111 // A domain was frozen.
112 FreezeDomain = 3;
113 // A domain was thawed.
114 UnfreezeDomain = 4;
115}
116
117message AuditRecord {
118 // Audit event metadata.
119 int64 id = 1;
120 google.protobuf.Timestamp timestamp = 2;
121 AuditEvent event = 3;
122 Principal principal = 4;
123
124 // Affected resource.
125 string domain = 10;
126 string project = 11; // only for `*Manifest` events
127
128 // Snapshot of site manifest.
129 Manifest manifest = 12; // only for `*Manifest` events
130}
131
132message Principal {
133 string ip_address = 1;
134 bool cli_admin = 2;
135}