mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 19:47:47 +08:00
feat: build in torrent client
This commit is contained in:
@@ -91,6 +91,7 @@ type Implementation string
|
||||
const (
|
||||
ImplementationTransmission Implementation = "transmission"
|
||||
ImplementationQbittorrent Implementation = "qbittorrent"
|
||||
ImplementationBuildin Implementation = "buildin"
|
||||
)
|
||||
|
||||
func (i Implementation) String() string {
|
||||
@@ -100,7 +101,7 @@ func (i Implementation) String() string {
|
||||
// ImplementationValidator is a validator for the "implementation" field enum values. It is called by the builders before save.
|
||||
func ImplementationValidator(i Implementation) error {
|
||||
switch i {
|
||||
case ImplementationTransmission, ImplementationQbittorrent:
|
||||
case ImplementationTransmission, ImplementationQbittorrent, ImplementationBuildin:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("downloadclients: invalid enum value for implementation field: %q", i)
|
||||
|
||||
@@ -26,7 +26,7 @@ var (
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "enable", Type: field.TypeBool},
|
||||
{Name: "name", Type: field.TypeString},
|
||||
{Name: "implementation", Type: field.TypeEnum, Enums: []string{"transmission", "qbittorrent"}},
|
||||
{Name: "implementation", Type: field.TypeEnum, Enums: []string{"transmission", "qbittorrent", "buildin"}},
|
||||
{Name: "url", Type: field.TypeString},
|
||||
{Name: "user", Type: field.TypeString, Default: ""},
|
||||
{Name: "password", Type: field.TypeString, Default: ""},
|
||||
|
||||
@@ -17,7 +17,7 @@ func (DownloadClients) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Bool("enable"),
|
||||
field.String("name"),
|
||||
field.Enum("implementation").Values("transmission", "qbittorrent"),
|
||||
field.Enum("implementation").Values("transmission", "qbittorrent", "buildin"),
|
||||
field.String("url"),
|
||||
field.String("user").Default(""),
|
||||
field.String("password").Default(""),
|
||||
|
||||
Reference in New Issue
Block a user