Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmd/lang.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"os"
"strings"

_ "github.com/OpenListTeam/OpenList/v4/drivers"
"github.com/OpenListTeam/OpenList/v4/internal/bootstrap"
"github.com/OpenListTeam/OpenList/v4/internal/bootstrap/data"
"github.com/OpenListTeam/OpenList/v4/internal/conf"
Expand Down
7 changes: 6 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"os"

"github.com/OpenListTeam/OpenList/v4/cmd/flags"
_ "github.com/OpenListTeam/OpenList/v4/drivers"
"github.com/OpenListTeam/OpenList/v4/drivers"
_ "github.com/OpenListTeam/OpenList/v4/internal/archive"
_ "github.com/OpenListTeam/OpenList/v4/internal/offline_download"
"github.com/OpenListTeam/OpenList/v4/internal/op"
"github.com/spf13/cobra"
)

Expand All @@ -20,6 +21,10 @@ Complete documentation is available at https://doc.oplist.org/`,
}

func Execute() {
if err := op.InstallDrivers(drivers.All()); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
if err := RootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
Expand Down
7 changes: 2 additions & 5 deletions drivers/115/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package _115

import (
"github.com/OpenListTeam/OpenList/v4/internal/driver"
"github.com/OpenListTeam/OpenList/v4/internal/op"
)

type Addition struct {
Expand All @@ -20,8 +19,6 @@ var config = driver.Config{
LinkCacheMode: driver.LinkCacheUA,
}

func init() {
op.RegisterDriver(func() driver.Driver {
return &Pan115{}
})
func New() driver.Driver {
return &Pan115{}
}
7 changes: 2 additions & 5 deletions drivers/115_open/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package _115_open

import (
"github.com/OpenListTeam/OpenList/v4/internal/driver"
"github.com/OpenListTeam/OpenList/v4/internal/op"
)

type Addition struct {
Expand All @@ -23,8 +22,6 @@ var config = driver.Config{
LinkCacheMode: driver.LinkCacheUA,
}

func init() {
op.RegisterDriver(func() driver.Driver {
return &Open115{}
})
func New() driver.Driver {
return &Open115{}
}
7 changes: 2 additions & 5 deletions drivers/115_share/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package _115_share

import (
"github.com/OpenListTeam/OpenList/v4/internal/driver"
"github.com/OpenListTeam/OpenList/v4/internal/op"
)

type Addition struct {
Expand All @@ -22,8 +21,6 @@ var config = driver.Config{
NoUpload: true,
}

func init() {
op.RegisterDriver(func() driver.Driver {
return &Pan115Share{}
})
func New() driver.Driver {
return &Pan115Share{}
}
19 changes: 8 additions & 11 deletions drivers/123/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package _123

import (
"github.com/OpenListTeam/OpenList/v4/internal/driver"
"github.com/OpenListTeam/OpenList/v4/internal/op"
)

type Addition struct {
Expand All @@ -23,14 +22,12 @@ var config = driver.Config{
PreferProxy: true,
}

func init() {
op.RegisterDriver(func() driver.Driver {
// 新增默认选项 要在RegisterDriver初始化设置 才会对正在使用的用户生效
return &Pan123{
Addition: Addition{
UploadThread: 3,
Platform: "web",
},
}
})
func New() driver.Driver {
// 新增默认选项 要在RegisterDriver初始化设置 才会对正在使用的用户生效
return &Pan123{
Addition: Addition{
UploadThread: 3,
Platform: "web",
},
}
}
7 changes: 2 additions & 5 deletions drivers/123_link/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package _123Link

import (
"github.com/OpenListTeam/OpenList/v4/internal/driver"
"github.com/OpenListTeam/OpenList/v4/internal/op"
)

type Addition struct {
Expand All @@ -16,8 +15,6 @@ var config = driver.Config{
Name: "123PanLink",
}

func init() {
op.RegisterDriver(func() driver.Driver {
return &Pan123Link{}
})
func New() driver.Driver {
return &Pan123Link{}
}
7 changes: 2 additions & 5 deletions drivers/123_open/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package _123_open

import (
"github.com/OpenListTeam/OpenList/v4/internal/driver"
"github.com/OpenListTeam/OpenList/v4/internal/op"
)

type Addition struct {
Expand Down Expand Up @@ -42,8 +41,6 @@ var config = driver.Config{
PreferProxy: true,
}

func init() {
op.RegisterDriver(func() driver.Driver {
return &Open123{}
})
func New() driver.Driver {
return &Open123{}
}
7 changes: 2 additions & 5 deletions drivers/123_share/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package _123Share

import (
"github.com/OpenListTeam/OpenList/v4/internal/driver"
"github.com/OpenListTeam/OpenList/v4/internal/op"
)

type Addition struct {
Expand All @@ -22,8 +21,6 @@ var config = driver.Config{
PreferProxy: true,
}

func init() {
op.RegisterDriver(func() driver.Driver {
return &Pan123Share{}
})
func New() driver.Driver {
return &Pan123Share{}
}
11 changes: 4 additions & 7 deletions drivers/139/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package _139

import (
"github.com/OpenListTeam/OpenList/v4/internal/driver"
"github.com/OpenListTeam/OpenList/v4/internal/op"
)

type Addition struct {
Expand All @@ -29,10 +28,8 @@ var config = driver.Config{
ProxyRangeOption: true,
}

func init() {
op.RegisterDriver(func() driver.Driver {
d := &Yun139{}
d.ProxyRange = true
return d
})
func New() driver.Driver {
d := &Yun139{}
d.ProxyRange = true
return d
}
7 changes: 2 additions & 5 deletions drivers/189/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package _189

import (
"github.com/OpenListTeam/OpenList/v4/internal/driver"
"github.com/OpenListTeam/OpenList/v4/internal/op"
)

type Addition struct {
Expand All @@ -19,8 +18,6 @@ var config = driver.Config{
Alert: `info|You can try to use 189PC driver if this driver does not work.`,
}

func init() {
op.RegisterDriver(func() driver.Driver {
return &Cloud189{}
})
func New() driver.Driver {
return &Cloud189{}
}
7 changes: 2 additions & 5 deletions drivers/189_tv/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package _189_tv

import (
"github.com/OpenListTeam/OpenList/v4/internal/driver"
"github.com/OpenListTeam/OpenList/v4/internal/op"
)

type Addition struct {
Expand All @@ -22,8 +21,6 @@ var config = driver.Config{
CheckStatus: true,
}

func init() {
op.RegisterDriver(func() driver.Driver {
return &Cloud189TV{}
})
func New() driver.Driver {
return &Cloud189TV{}
}
7 changes: 2 additions & 5 deletions drivers/189pc/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package _189pc

import (
"github.com/OpenListTeam/OpenList/v4/internal/driver"
"github.com/OpenListTeam/OpenList/v4/internal/op"
)

type Addition struct {
Expand Down Expand Up @@ -31,8 +30,6 @@ var config = driver.Config{
CheckStatus: true,
}

func init() {
op.RegisterDriver(func() driver.Driver {
return &Cloud189PC{}
})
func New() driver.Driver {
return &Cloud189PC{}
}
8 changes: 2 additions & 6 deletions drivers/alias/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package alias

import (
"github.com/OpenListTeam/OpenList/v4/internal/driver"
"github.com/OpenListTeam/OpenList/v4/internal/op"
)

type Addition struct {
Expand All @@ -21,14 +20,11 @@ var config = driver.Config{
Name: "Alias",
LocalSort: true,
NoCache: true,
NoUpload: false,
DefaultRoot: "/",
ProxyRangeOption: true,
LinkCacheMode: driver.LinkCacheAuto,
}

func init() {
op.RegisterDriver(func() driver.Driver {
return &Alias{}
})
func New() driver.Driver {
return &Alias{}
}
12 changes: 4 additions & 8 deletions drivers/alidoc/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package alidoc

import (
"github.com/OpenListTeam/OpenList/v4/internal/driver"
"github.com/OpenListTeam/OpenList/v4/internal/op"
)

type Addition struct {
Expand All @@ -11,13 +10,10 @@ type Addition struct {
}

var config = driver.Config{
Name: "AliDoc",
LocalSort: true,
DefaultRoot: "",
Name: "AliDoc",
LocalSort: true,
}

func init() {
op.RegisterDriver(func() driver.Driver {
return &AliDoc{}
})
func New() driver.Driver {
return &AliDoc{}
}
Loading
Loading