mirror of
https://github.com/iyear/tdl
synced 2025-01-07 03:16:41 +08:00
chore(prj): optimize imports
This commit is contained in:
parent
d0568bd286
commit
d3c02afe24
@ -2,10 +2,12 @@ package archive
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/fatih/color"
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
"github.com/mholt/archiver/v4"
|
||||
"os"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/mholt/archiver/v4"
|
||||
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
)
|
||||
|
||||
func Backup(ctx context.Context, dst string) error {
|
||||
|
@ -2,12 +2,14 @@ package archive
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/fatih/color"
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
"github.com/mholt/archiver/v4"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/mholt/archiver/v4"
|
||||
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
)
|
||||
|
||||
func Recover(ctx context.Context, file string) error {
|
||||
|
@ -4,6 +4,9 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/go-faster/jx"
|
||||
"github.com/gotd/contrib/middleware/ratelimit"
|
||||
@ -11,17 +14,16 @@ import (
|
||||
"github.com/gotd/td/telegram/query"
|
||||
"github.com/gotd/td/telegram/query/messages"
|
||||
"github.com/gotd/td/tg"
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
"go.uber.org/multierr"
|
||||
"golang.org/x/time/rate"
|
||||
|
||||
"github.com/iyear/tdl/app/internal/tgc"
|
||||
"github.com/iyear/tdl/pkg/prog"
|
||||
"github.com/iyear/tdl/pkg/storage"
|
||||
"github.com/iyear/tdl/pkg/texpr"
|
||||
"github.com/iyear/tdl/pkg/tmedia"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
"go.uber.org/multierr"
|
||||
"golang.org/x/time/rate"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -4,22 +4,24 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gotd/contrib/middleware/ratelimit"
|
||||
"github.com/gotd/td/telegram/message/peer"
|
||||
"github.com/gotd/td/telegram/peers"
|
||||
"github.com/gotd/td/telegram/query"
|
||||
"github.com/gotd/td/tg"
|
||||
"github.com/mattn/go-runewidth"
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/time/rate"
|
||||
|
||||
"github.com/iyear/tdl/app/internal/tgc"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/storage"
|
||||
"github.com/iyear/tdl/pkg/texpr"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"github.com/mattn/go-runewidth"
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/time/rate"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Dialog struct {
|
||||
|
@ -2,6 +2,7 @@ package chat
|
||||
|
||||
import (
|
||||
"github.com/gotd/td/tg"
|
||||
|
||||
"github.com/iyear/tdl/pkg/tmedia"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
)
|
||||
|
@ -1,8 +1,9 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"github.com/iyear/tdl/pkg/texpr"
|
||||
"testing"
|
||||
|
||||
"github.com/iyear/tdl/pkg/texpr"
|
||||
)
|
||||
|
||||
func TestMessageExpr(t *testing.T) {
|
||||
|
@ -5,9 +5,14 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/fatih/color"
|
||||
"github.com/gotd/contrib/middleware/floodwait"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/multierr"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/iyear/tdl/app/internal/dliter"
|
||||
"github.com/iyear/tdl/app/internal/tgc"
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
@ -16,9 +21,6 @@ import (
|
||||
"github.com/iyear/tdl/pkg/key"
|
||||
"github.com/iyear/tdl/pkg/kv"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/multierr"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
|
@ -3,20 +3,22 @@ package dl
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/bcicen/jstream"
|
||||
"github.com/gotd/td/telegram/peers"
|
||||
"github.com/gotd/td/tg"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/iyear/tdl/app/internal/dliter"
|
||||
"github.com/iyear/tdl/pkg/dcpool"
|
||||
"github.com/iyear/tdl/pkg/kv"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/storage"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"go.uber.org/zap"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -2,14 +2,16 @@ package dl
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gotd/td/telegram/peers"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/iyear/tdl/app/internal/dliter"
|
||||
"github.com/iyear/tdl/pkg/dcpool"
|
||||
"github.com/iyear/tdl/pkg/kv"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/storage"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func parseURLs(ctx context.Context, pool dcpool.Pool, kvd kv.KV, urls []string) ([]*dliter.Dialog, error) {
|
||||
|
@ -5,17 +5,19 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/gotd/td/telegram/peers"
|
||||
"github.com/gotd/td/telegram/query"
|
||||
"github.com/gotd/td/tg"
|
||||
|
||||
"github.com/iyear/tdl/pkg/downloader"
|
||||
"github.com/iyear/tdl/pkg/storage"
|
||||
"github.com/iyear/tdl/pkg/tmedia"
|
||||
"github.com/iyear/tdl/pkg/tplfunc"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"path/filepath"
|
||||
"text/template"
|
||||
"time"
|
||||
)
|
||||
|
||||
func New(ctx context.Context, opts *Options) (*Iter, error) {
|
||||
|
@ -1,12 +1,14 @@
|
||||
package dliter
|
||||
|
||||
import (
|
||||
"github.com/gotd/td/telegram/peers"
|
||||
"github.com/gotd/td/tg"
|
||||
"github.com/iyear/tdl/pkg/dcpool"
|
||||
"github.com/iyear/tdl/pkg/kv"
|
||||
"sync"
|
||||
"text/template"
|
||||
|
||||
"github.com/gotd/td/telegram/peers"
|
||||
"github.com/gotd/td/tg"
|
||||
|
||||
"github.com/iyear/tdl/pkg/dcpool"
|
||||
"github.com/iyear/tdl/pkg/kv"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
|
@ -5,8 +5,9 @@ import (
|
||||
"crypto/sha256"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"sort"
|
||||
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
)
|
||||
|
||||
func sortDialogs(dialogs []*Dialog, desc bool) {
|
||||
|
@ -3,9 +3,11 @@ package tgc
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/gotd/td/telegram"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
)
|
||||
|
||||
func RunWithAuth(ctx context.Context, client *telegram.Client, f func(ctx context.Context) error) error {
|
||||
|
@ -3,11 +3,18 @@ package tgc
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/cenkalti/backoff/v4"
|
||||
"github.com/gotd/contrib/middleware/floodwait"
|
||||
tdclock "github.com/gotd/td/clock"
|
||||
"github.com/gotd/td/telegram"
|
||||
"github.com/gotd/td/telegram/dcs"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/iyear/tdl/pkg/clock"
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
"github.com/iyear/tdl/pkg/key"
|
||||
@ -15,11 +22,6 @@ import (
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/storage"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/zap"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
)
|
||||
|
||||
func New(ctx context.Context, login bool, middlewares ...telegram.Middleware) (*telegram.Client, kv.KV, error) {
|
||||
|
@ -3,11 +3,12 @@ package login
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/fatih/color"
|
||||
"github.com/gotd/td/telegram/auth"
|
||||
"github.com/gotd/td/tg"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// noSignUp can be embedded to prevent signing up.
|
||||
|
@ -3,15 +3,17 @@ package login
|
||||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"time"
|
||||
|
||||
"github.com/cenkalti/backoff/v4"
|
||||
"github.com/fatih/color"
|
||||
"github.com/gotd/td/telegram"
|
||||
"github.com/gotd/td/telegram/auth"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/iyear/tdl/app/internal/tgc"
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
"github.com/iyear/tdl/pkg/key"
|
||||
"github.com/spf13/viper"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Code(ctx context.Context) error {
|
||||
|
@ -3,10 +3,16 @@ package login
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/fatih/color"
|
||||
"github.com/gotd/td/session"
|
||||
tdtdesktop "github.com/gotd/td/session/tdesktop"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
"github.com/iyear/tdl/pkg/key"
|
||||
"github.com/iyear/tdl/pkg/kv"
|
||||
@ -14,10 +20,6 @@ import (
|
||||
"github.com/iyear/tdl/pkg/tdesktop"
|
||||
"github.com/iyear/tdl/pkg/tpath"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"github.com/spf13/viper"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const tdata = "tdata"
|
||||
|
@ -3,13 +3,15 @@ package up
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/gabriel-vasile/mimetype"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/uploader"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"go.uber.org/zap"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type file struct {
|
||||
|
@ -2,11 +2,13 @@ package up
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/iyear/tdl/app/internal/tgc"
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
"github.com/iyear/tdl/pkg/uploader"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
|
@ -1,11 +1,12 @@
|
||||
package up
|
||||
|
||||
import (
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"io/fs"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
)
|
||||
|
||||
func walk(paths, excludes []string) ([]*file, error) {
|
||||
|
@ -2,9 +2,11 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/iyear/tdl/app/archive"
|
||||
"github.com/spf13/cobra"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/iyear/tdl/app/archive"
|
||||
)
|
||||
|
||||
func NewBackup() *cobra.Command {
|
||||
|
@ -2,11 +2,13 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/iyear/tdl/app/chat"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"github.com/spf13/cobra"
|
||||
"math"
|
||||
)
|
||||
|
||||
func NewChat() *cobra.Command {
|
||||
|
@ -2,12 +2,14 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/iyear/tdl/app/dl"
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func NewDownload() *cobra.Command {
|
||||
|
@ -2,9 +2,10 @@ package cmd
|
||||
|
||||
import (
|
||||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/iyear/tdl/app/login"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewLogin() *cobra.Command {
|
||||
|
16
cmd/root.go
16
cmd/root.go
@ -1,18 +1,20 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
"github.com/iyear/tdl/pkg/kv"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/cobra/doc"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/zap"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
"github.com/iyear/tdl/pkg/kv"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
)
|
||||
|
||||
func New() *cobra.Command {
|
||||
|
@ -1,9 +1,10 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/iyear/tdl/app/up"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewUpload() *cobra.Command {
|
||||
|
@ -3,11 +3,13 @@ package cmd
|
||||
import (
|
||||
"bytes"
|
||||
_ "embed"
|
||||
"github.com/fatih/color"
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
"github.com/spf13/cobra"
|
||||
"runtime"
|
||||
"text/template"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
)
|
||||
|
||||
//go:embed version.tmpl
|
||||
|
6
main.go
6
main.go
@ -2,10 +2,12 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/fatih/color"
|
||||
"github.com/iyear/tdl/cmd"
|
||||
"os"
|
||||
"os/signal"
|
||||
|
||||
"github.com/fatih/color"
|
||||
|
||||
"github.com/iyear/tdl/cmd"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -2,9 +2,10 @@ package clock
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/beevik/ntp"
|
||||
"github.com/gotd/td/clock"
|
||||
"time"
|
||||
)
|
||||
|
||||
const defaultHost = "pool.ntp.org"
|
||||
|
@ -2,13 +2,15 @@ package dcpool
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/gotd/td/telegram"
|
||||
"github.com/gotd/td/tg"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/takeout"
|
||||
"go.uber.org/multierr"
|
||||
"go.uber.org/zap"
|
||||
"sync"
|
||||
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/takeout"
|
||||
)
|
||||
|
||||
type Pool interface {
|
||||
|
@ -4,20 +4,22 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/fatih/color"
|
||||
"github.com/gabriel-vasile/mimetype"
|
||||
"github.com/gotd/td/telegram/downloader"
|
||||
"github.com/iyear/tdl/pkg/dcpool"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/prog"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/sync/errgroup"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/gabriel-vasile/mimetype"
|
||||
"github.com/gotd/td/telegram/downloader"
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"github.com/iyear/tdl/pkg/dcpool"
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/prog"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
)
|
||||
|
||||
const TempExt = ".tmp"
|
||||
|
@ -3,6 +3,7 @@ package downloader
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/gotd/td/tg"
|
||||
)
|
||||
|
||||
|
@ -2,10 +2,12 @@ package downloader
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/iyear/tdl/pkg/ps"
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
|
||||
"github.com/iyear/tdl/pkg/ps"
|
||||
)
|
||||
|
||||
func (d *Downloader) renderPinned(ctx context.Context, pw progress.Writer) {
|
||||
|
@ -1,9 +1,10 @@
|
||||
package downloader
|
||||
|
||||
import (
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
)
|
||||
|
||||
// writeAt wrapper for file to use progress bar
|
||||
|
@ -2,10 +2,11 @@ package key
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/gotd/td/telegram/peers"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/gotd/td/telegram/peers"
|
||||
)
|
||||
|
||||
var keyPool = sync.Pool{
|
||||
|
@ -2,11 +2,13 @@ package kv
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/iyear/tdl/pkg/validator"
|
||||
"go.etcd.io/bbolt"
|
||||
"go.uber.org/multierr"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"go.etcd.io/bbolt"
|
||||
"go.uber.org/multierr"
|
||||
|
||||
"github.com/iyear/tdl/pkg/validator"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -2,6 +2,7 @@ package logger
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
|
@ -1,9 +1,10 @@
|
||||
package prog
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
"time"
|
||||
)
|
||||
|
||||
func New(formatter progress.UnitsFormatter) progress.Writer {
|
||||
|
@ -3,10 +3,12 @@ package ps
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"github.com/shirou/gopsutil/v3/process"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/shirou/gopsutil/v3/process"
|
||||
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
)
|
||||
|
||||
var proc *process.Process
|
||||
|
@ -3,10 +3,12 @@ package storage
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
|
||||
"github.com/gotd/td/telegram/peers"
|
||||
|
||||
"github.com/iyear/tdl/pkg/key"
|
||||
"github.com/iyear/tdl/pkg/kv"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type Peers struct {
|
||||
|
@ -3,7 +3,9 @@ package storage
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/gotd/td/telegram"
|
||||
|
||||
"github.com/iyear/tdl/pkg/key"
|
||||
"github.com/iyear/tdl/pkg/kv"
|
||||
)
|
||||
|
@ -4,7 +4,9 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/gotd/td/telegram/updates"
|
||||
|
||||
"github.com/iyear/tdl/pkg/key"
|
||||
"github.com/iyear/tdl/pkg/kv"
|
||||
)
|
||||
|
@ -3,6 +3,7 @@ package takeout
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/gotd/td/bin"
|
||||
"github.com/gotd/td/telegram"
|
||||
"github.com/gotd/td/tg"
|
||||
|
@ -2,7 +2,9 @@ package takeout
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gotd/td/tg"
|
||||
|
||||
"github.com/iyear/tdl/pkg/consts"
|
||||
)
|
||||
|
||||
|
@ -2,8 +2,9 @@
|
||||
package tdesktop
|
||||
|
||||
import (
|
||||
_ "unsafe" // for go:linkname
|
||||
|
||||
_ "github.com/gotd/td/session/tdesktop" // for FileKey
|
||||
_ "unsafe" // for go:linkname
|
||||
)
|
||||
|
||||
//go:linkname FileKey github.com/gotd/td/session/tdesktop.fileKey
|
||||
|
@ -1,9 +1,10 @@
|
||||
package texpr
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/antonmedv/expr"
|
||||
"github.com/antonmedv/expr/vm"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var vmPool = sync.Pool{New: func() any {
|
||||
|
@ -2,9 +2,10 @@ package texpr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/fatih/color"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
type FieldsGetter struct {
|
||||
|
@ -1,9 +1,10 @@
|
||||
package texpr
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFieldsGetter(t *testing.T) {
|
||||
|
@ -1,10 +1,12 @@
|
||||
package tmedia
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/gabriel-vasile/mimetype"
|
||||
"github.com/gotd/td/tg"
|
||||
|
||||
"github.com/iyear/tdl/pkg/downloader"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func GetDocumentInfo(doc *tg.MessageMediaDocument) (*downloader.Item, bool) {
|
||||
|
@ -2,6 +2,7 @@ package tmedia
|
||||
|
||||
import (
|
||||
"github.com/gotd/td/tg"
|
||||
|
||||
"github.com/iyear/tdl/pkg/downloader"
|
||||
)
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
package tmedia
|
||||
|
||||
import (
|
||||
"github.com/gotd/td/tg"
|
||||
"github.com/iyear/tdl/pkg/downloader"
|
||||
"strconv"
|
||||
|
||||
"github.com/gotd/td/tg"
|
||||
|
||||
"github.com/iyear/tdl/pkg/downloader"
|
||||
)
|
||||
|
||||
func GetPhotoInfo(photo *tg.MessageMediaPhoto) (*downloader.Item, bool) {
|
||||
|
@ -3,8 +3,9 @@
|
||||
package tpath
|
||||
|
||||
import (
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
)
|
||||
|
||||
// https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/SourceFiles/platform/linux/specific_linux.cpp#L669-L684
|
||||
|
@ -1,9 +1,10 @@
|
||||
package tplfunc
|
||||
|
||||
import (
|
||||
"github.com/iancoleman/strcase"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"github.com/iancoleman/strcase"
|
||||
)
|
||||
|
||||
var String = []Func{
|
||||
|
@ -2,6 +2,7 @@ package uploader
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gotd/td/telegram/uploader"
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
)
|
||||
|
@ -2,10 +2,12 @@ package uploader
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/iyear/tdl/pkg/ps"
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
|
||||
"github.com/iyear/tdl/pkg/ps"
|
||||
)
|
||||
|
||||
func runPS(ctx context.Context, pw progress.Writer) {
|
||||
|
@ -4,20 +4,22 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/gotd/td/telegram/message"
|
||||
"github.com/gotd/td/telegram/message/styling"
|
||||
"github.com/gotd/td/telegram/peers"
|
||||
"github.com/gotd/td/telegram/uploader"
|
||||
"github.com/gotd/td/tg"
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"github.com/iyear/tdl/pkg/kv"
|
||||
"github.com/iyear/tdl/pkg/prog"
|
||||
"github.com/iyear/tdl/pkg/storage"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"github.com/jedib0t/go-pretty/v6/progress"
|
||||
"golang.org/x/sync/errgroup"
|
||||
"io"
|
||||
"time"
|
||||
)
|
||||
|
||||
var formatter = utils.Byte.FormatBinaryBytes
|
||||
|
@ -2,9 +2,10 @@ package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type cmd struct{}
|
||||
|
@ -2,9 +2,10 @@ package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/yapingcat/gomedia/go-mp4"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/yapingcat/gomedia/go-mp4"
|
||||
)
|
||||
|
||||
type media struct{}
|
||||
|
@ -1,8 +1,9 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"golang.org/x/net/proxy"
|
||||
"net/url"
|
||||
|
||||
"golang.org/x/net/proxy"
|
||||
)
|
||||
|
||||
type _proxy struct{}
|
||||
|
@ -3,12 +3,13 @@ package utils
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/gotd/td/telegram/peers"
|
||||
"github.com/gotd/td/telegram/query"
|
||||
"github.com/gotd/td/tg"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/gotd/td/telegram/peers"
|
||||
"github.com/gotd/td/telegram/query"
|
||||
"github.com/gotd/td/tg"
|
||||
)
|
||||
|
||||
type telegram struct{}
|
||||
|
@ -1,10 +1,11 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("Test tdl archive", func() {
|
||||
|
@ -2,10 +2,12 @@ package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/iyear/tdl/app/chat"
|
||||
"strings"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"strings"
|
||||
|
||||
"github.com/iyear/tdl/app/chat"
|
||||
)
|
||||
|
||||
var _ = Describe("Test tdl chat ls", FlakeAttempts(3), func() {
|
||||
|
@ -1,17 +1,19 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"github.com/fatih/color"
|
||||
tcmd "github.com/iyear/tdl/cmd"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/spf13/cobra"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/fatih/color"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
tcmd "github.com/iyear/tdl/cmd"
|
||||
)
|
||||
|
||||
func TestCommand(t *testing.T) {
|
||||
|
@ -1,15 +1,16 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/tidwall/gjson"
|
||||
"log"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
||||
"github.com/google/uuid"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
var _ = Describe("Test tdl upload", FlakeAttempts(3), func() {
|
||||
|
Loading…
Reference in New Issue
Block a user