1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-25 09:08:06 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-04-16 23:34:52 +08:00
parent 38b0e906a4
commit ddfac6f635
9 changed files with 13 additions and 23 deletions

3
go.mod
View File

@ -3,9 +3,8 @@ module shylinux.com/x/icebergs
go 1.11
require (
shylinux.com/x/go-git/v5 v5.6.2
shylinux.com/x/go-git/v5 v5.6.3
shylinux.com/x/go-qrcode v0.0.2
shylinux.com/x/ice v1.3.0
shylinux.com/x/toolkits v0.7.5
shylinux.com/x/websocket v0.0.2
)

7
go.sum
View File

@ -1,10 +1,7 @@
shylinux.com/x/go-git/v5 v5.6.3 h1:TgxQSryjeDVOA33eYF8s+URzC3xdXsfJQaJAyq1liz0=
shylinux.com/x/go-git/v5 v5.6.3/go.mod h1:FiJKLqM5ppFERgywelAfywwxc7UxpaYN5YH3Lhc2gys=
shylinux.com/x/go-qrcode v0.0.2 h1:/c0PLj+1RT+kUPfnZVXwgbgH5m1SxBUjM2MIKXbDk+E=
shylinux.com/x/go-qrcode v0.0.2/go.mod h1:TlzGBENHXy19xC3AsC6h4Vs5fx2ZuDA4TZ0U3C2OeK4=
shylinux.com/x/gogit v0.0.7 h1:2ep5QpXWLs0UBCywJuUHda/aagskYvFmn0nj3vpEdY4=
shylinux.com/x/gogit v0.0.7/go.mod h1:wYfHxpQT1C8yNV+yC1jStIy0I12bfUCyJARhn0sNn1M=
shylinux.com/x/ice v1.3.0/go.mod h1:sgSlRKoEKnZbmHZ8QuQ3VrFOlW/imi12GX2Z9drkngY=
shylinux.com/x/icebergs v1.5.4/go.mod h1:njja7CnbJD39p4OGDvIxmh7p8206nAlDiAiTh34CNiw=
shylinux.com/x/toolkits v0.7.4/go.mod h1:8LbYHe7oxBIqb6s4MSOD+4d28QvPdvkyCVtwB/JW7AA=
shylinux.com/x/toolkits v0.7.5 h1:OHk2zLWubFion4cJBo+lSTyzBp3buzV7Xu/Q91Hvf7M=
shylinux.com/x/toolkits v0.7.5/go.mod h1:8LbYHe7oxBIqb6s4MSOD+4d28QvPdvkyCVtwB/JW7AA=
shylinux.com/x/websocket v0.0.2 h1:aeeZyAsh6QN7+l5oMXlO9/rlQgx6CHvDtpZyAqMCSlU=

View File

@ -4,7 +4,6 @@ import (
"strings"
"time"
"shylinux.com/x/gogit"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/cli"
@ -52,11 +51,6 @@ func _status_list(m *ice.Message) (files, adds, dels int, last time.Time) {
ReposList(m).Table(func(value ice.Maps) {
m.Option(cli.CMD_DIR, value[nfs.PATH])
files, adds, dels = _status_stat(m, files, adds, dels)
if repos, e := gogit.OpenRepository(_git_dir(value[nfs.PATH])); e == nil {
if ci, e := repos.GetCommit(); e == nil && ci.Author.When.After(last) {
last = ci.Author.When
}
}
tags := _git_tags(m)
kit.SplitKV(ice.SP, ice.NL, _git_status(m), func(text string, ls []string) {
switch kit.Ext(ls[1]) {
@ -146,6 +140,9 @@ func init() {
OAUTH: {Help: "授权", Hand: func(m *ice.Message, arg ...string) {
m.ProcessOpen(kit.MergeURL2(kit.Select(ice.Info.Make.Remote, _git_remote(m)), "/chat/cmd/web.code.git.token", aaa.USERNAME, m.Option(ice.MSG_USERNAME), tcp.HOST, web.UserHost(m)))
}},
COMMIT: {Name: "commit actions=add,opt,fix comment*=some", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(REPOS, COMMIT, arg)
}},
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
if m.Option(mdb.TYPE) != web.WORKER {
return
@ -170,9 +167,6 @@ func init() {
if _configs_get(m, USER_EMAIL) == "" {
m.Echo("please config user.email").Action(CONFIGS)
} else if len(arg) == 0 {
m.Cmdy(REPOS, STATUS)
m.Action(PULL, PUSH, "insteadof", "oauth").Sort("repos,status,file")
return
files, adds, dels, last := _status_list(m)
m.StatusTimeCount("files", files, "adds", adds, "dels", dels, "last", last.Format(ice.MOD_TIME), nfs.ORIGIN, _git_remote(m))
m.Action(PULL, PUSH, "insteadof", "oauth").Sort("repos,type,file")

View File

@ -40,7 +40,7 @@ func _ssh_open(m *ice.Message, arg ...string) {
}
func _ssh_dial(m *ice.Message, cb func(net.Conn), arg ...string) {
p := kit.HomePath(".ssh", fmt.Sprintf("%s@%s:%s", m.Option(aaa.USERNAME), m.Option(tcp.HOST), m.Option(tcp.PORT)))
if nfs.ExistsFile(m, p) {
if nfs.Exists(m, p) {
if c, e := net.Dial("unix", p); e == nil {
cb(c)
return

View File

@ -12,7 +12,6 @@ import (
"strings"
"golang.org/x/crypto/ssh"
pty "shylinux.com/x/creackpty"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/cli"
@ -22,6 +21,7 @@ import (
psh "shylinux.com/x/icebergs/base/ssh"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/base/web"
"shylinux.com/x/icebergs/misc/xterm"
kit "shylinux.com/x/toolkits"
)
@ -87,7 +87,7 @@ func _ssh_accept(m *ice.Message, h string, c net.Conn) {
}
}
func _ssh_prepare(m *ice.Message, channel ssh.Channel, requests <-chan *ssh.Request) {
pty, tty, err := pty.Open()
pty, tty, err := xterm.Open()
if m.Warn(err) {
return
}

View File

@ -12,7 +12,7 @@ import (
kit "shylinux.com/x/toolkits"
)
func open() (pty, tty *os.File, err error) {
func Open() (pty, tty *os.File, err error) {
pFD, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|syscall.O_CLOEXEC, 0)
if err != nil {
return nil, nil, err

View File

@ -12,7 +12,7 @@ import (
kit "shylinux.com/x/toolkits"
)
func open() (*os.File, *os.File, error) {
func Open() (*os.File, *os.File, error) {
p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0)
if err != nil {
return nil, nil, err

View File

@ -9,4 +9,4 @@ import (
)
func Setsize(*os.File, *Winsize) error { return errors.New("unsupported") }
func open() (pty, tty *os.File, err error) { return nil, nil, errors.New("unsuported") }
func Open() (pty, tty *os.File, err error) { return nil, nil, errors.New("unsuported") }

View File

@ -40,7 +40,7 @@ func Command(m *ice.Message, dir string, cli string, arg ...string) (*XTerm, err
cmd.Env = append(cmd.Env, os.Environ()...)
cmd.Env = append(cmd.Env, "TERM=xterm")
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true, Setctty: true}
pty, tty, err := open()
pty, tty, err := Open()
if err != nil {
return nil, err
}