mirror of
https://github.com/bit1001/tdl.git
synced 2024-09-20 06:35:54 +08:00
refactor(consts): separate
This commit is contained in:
parent
e1045fbb5d
commit
30dd6e048f
|
@ -9,9 +9,9 @@ builds:
|
||||||
- -trimpath
|
- -trimpath
|
||||||
ldflags:
|
ldflags:
|
||||||
- -s -w
|
- -s -w
|
||||||
- -X {{ .ModulePath }}/global.Version={{ .Version }}
|
- -X {{ .ModulePath }}/pkg/consts.Version={{ .Version }}
|
||||||
- -X {{ .ModulePath }}/global.Commit={{ .ShortCommit }}
|
- -X {{ .ModulePath }}/pkg/consts.Commit={{ .ShortCommit }}
|
||||||
- -X {{ .ModulePath }}/global.CommitDate={{ .CommitDate }}
|
- -X {{ .ModulePath }}/pkg/consts.CommitDate={{ .CommitDate }}
|
||||||
mod_timestamp: '{{ .CommitTimestamp }}'
|
mod_timestamp: '{{ .CommitTimestamp }}'
|
||||||
goos:
|
goos:
|
||||||
- linux
|
- linux
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/iyear/tdl/global"
|
"github.com/iyear/tdl/pkg/consts"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"runtime"
|
"runtime"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
@ -20,9 +20,9 @@ var Cmd = &cobra.Command{
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
_ = template.Must(template.New("version").Parse(version)).Execute(buf, map[string]interface{}{
|
_ = template.Must(template.New("version").Parse(version)).Execute(buf, map[string]interface{}{
|
||||||
"Version": global.Version,
|
"Version": consts.Version,
|
||||||
"Commit": global.Commit,
|
"Commit": consts.Commit,
|
||||||
"Date": global.CommitDate,
|
"Date": consts.CommitDate,
|
||||||
"GoVersion": runtime.Version(),
|
"GoVersion": runtime.Version(),
|
||||||
"GOOS": runtime.GOOS,
|
"GOOS": runtime.GOOS,
|
||||||
"GOARCH": runtime.GOARCH,
|
"GOARCH": runtime.GOARCH,
|
||||||
|
|
|
@ -1,39 +1,8 @@
|
||||||
package consts
|
package consts
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gotd/td/telegram"
|
|
||||||
"github.com/iyear/tdl/global"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
|
||||||
)
|
|
||||||
|
|
||||||
// TODO(iyear): usr -X flag to set id and hash
|
|
||||||
const (
|
|
||||||
AppID = 17349
|
|
||||||
AppHash = "344583e45741c457fe1862106095a5eb"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
DownloadModeURL = "url"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
Device = telegram.DeviceConfig{
|
|
||||||
DeviceModel: "tdl",
|
|
||||||
SystemVersion: runtime.GOOS,
|
|
||||||
AppVersion: global.Version,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
DataDir string
|
|
||||||
KVPath string
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
DocsPath = "docs"
|
|
||||||
DownloadPath = "downloads"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
7
pkg/consts/dl.go
Normal file
7
pkg/consts/dl.go
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package consts
|
||||||
|
|
||||||
|
const (
|
||||||
|
DownloadModeURL = "url"
|
||||||
|
)
|
||||||
|
|
||||||
|
const DownloadPath = "downloads"
|
7
pkg/consts/path.go
Normal file
7
pkg/consts/path.go
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package consts
|
||||||
|
|
||||||
|
var (
|
||||||
|
DataDir string
|
||||||
|
KVPath string
|
||||||
|
DocsPath = "docs"
|
||||||
|
)
|
21
pkg/consts/telegram.go
Normal file
21
pkg/consts/telegram.go
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package consts
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gotd/td/telegram"
|
||||||
|
"runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO(iyear): usr -X flag to set id and hash
|
||||||
|
// Telegram desktop client
|
||||||
|
const (
|
||||||
|
AppID = 17349
|
||||||
|
AppHash = "344583e45741c457fe1862106095a5eb"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
Device = telegram.DeviceConfig{
|
||||||
|
DeviceModel: "tdl",
|
||||||
|
SystemVersion: runtime.GOOS,
|
||||||
|
AppVersion: Version,
|
||||||
|
}
|
||||||
|
)
|
|
@ -1,4 +1,4 @@
|
||||||
package global
|
package consts
|
||||||
|
|
||||||
// vars below are set by '-X' flag
|
// vars below are set by '-X' flag
|
||||||
var (
|
var (
|
Loading…
Reference in a new issue