Implement partial Netlify _redirects support.

This is roughly to match the Codeberg subset:
https://docs.codeberg.org/codeberg-pages/redirects/
This commit is contained in:
Catherine
2025-09-24 19:11:27 +00:00
parent 59eb65ff66
commit 714e37cce8
3 changed files with 138 additions and 22 deletions
+13 -4
View File
@@ -82,10 +82,17 @@ func (Type) EnumDescriptor() ([]byte, []int) {
}
type Entry struct {
state protoimpl.MessageState `protogen:"open.v1"`
Type *Type `protobuf:"varint,1,opt,name=type,enum=Type" json:"type,omitempty"`
Size *uint32 `protobuf:"varint,2,opt,name=size" json:"size,omitempty"`
Data []byte `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"`
state protoimpl.MessageState `protogen:"open.v1"`
Type *Type `protobuf:"varint,1,opt,name=type,enum=Type" json:"type,omitempty"`
// Only present for `type == InlineFile` and `type == ExternalFile`
Size *uint32 `protobuf:"varint,2,opt,name=size" json:"size,omitempty"`
// Meaning depends on `type`:
// - If `type == InlineFile`, contains file data.
// - If `type == ExternalFile`, contains blob name (an otherwise unspecified
// cryptographically secure content hash).
// - If `type == Symlink`, contains link target.
// - Otherwise not present.
Data []byte `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -141,6 +148,8 @@ func (x *Entry) GetData() []byte {
return nil
}
// See https://docs.netlify.com/manage/routing/redirects/overview/ for details.
// Only a subset of the Netlify specification is representable here.
type Redirect struct {
state protoimpl.MessageState `protogen:"open.v1"`
From *string `protobuf:"bytes,1,opt,name=from" json:"from,omitempty"`