mirror of
https://shylinux.com/x/icebergs
synced 2025-06-28 03:02:59 +08:00
opt some
This commit is contained in:
parent
0ab3b73e38
commit
4bc53b7764
@ -75,13 +75,15 @@ func _share_local(m *ice.Message, arg ...string) {
|
|||||||
if m.Option(ice.POD) != "" { // 远程文件
|
if m.Option(ice.POD) != "" { // 远程文件
|
||||||
pp := path.Join(ice.VAR_PROXY, m.Option(ice.POD), p)
|
pp := path.Join(ice.VAR_PROXY, m.Option(ice.POD), p)
|
||||||
cache := time.Now().Add(-time.Hour * 240000)
|
cache := time.Now().Add(-time.Hour * 240000)
|
||||||
|
var size int64
|
||||||
if s, e := os.Stat(pp); e == nil {
|
if s, e := os.Stat(pp); e == nil {
|
||||||
cache = s.ModTime()
|
cache = s.ModTime()
|
||||||
|
size = s.Size()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传文件
|
// 上传文件
|
||||||
m.Cmd(SPACE, m.Option(ice.POD), SPIDE, ice.DEV, SPIDE_RAW, m.MergeURL2(SHARE_PROXY, nfs.PATH, ""),
|
m.Cmd(SPACE, m.Option(ice.POD), SPIDE, ice.DEV, SPIDE_RAW, m.MergeURL2(SHARE_PROXY, nfs.PATH, ""),
|
||||||
SPIDE_PART, m.OptionSimple(ice.POD), nfs.PATH, p, CACHE, cache.Format(ice.MOD_TIME), UPLOAD, "@"+p)
|
SPIDE_PART, m.OptionSimple(ice.POD), nfs.PATH, p, nfs.SIZE, size, CACHE, cache.Format(ice.MOD_TIME), UPLOAD, "@"+p)
|
||||||
|
|
||||||
if s, e := os.Stat(pp); e == nil && !s.IsDir() {
|
if s, e := os.Stat(pp); e == nil && !s.IsDir() {
|
||||||
p = pp
|
p = pp
|
||||||
|
@ -183,7 +183,11 @@ func _spide_part(m *ice.Message, arg ...string) (io.Reader, string) {
|
|||||||
defer mp.Close()
|
defer mp.Close()
|
||||||
|
|
||||||
cache := time.Now().Add(-time.Hour * 240000)
|
cache := time.Now().Add(-time.Hour * 240000)
|
||||||
|
var size int64
|
||||||
for i := 1; i < len(arg)-1; i += 2 {
|
for i := 1; i < len(arg)-1; i += 2 {
|
||||||
|
if arg[i] == nfs.SIZE {
|
||||||
|
size = kit.Int64(arg[i+1])
|
||||||
|
}
|
||||||
if arg[i] == SPIDE_CACHE {
|
if arg[i] == SPIDE_CACHE {
|
||||||
if t, e := time.ParseInLocation(ice.MOD_TIME, arg[i+1], time.Local); e == nil {
|
if t, e := time.ParseInLocation(ice.MOD_TIME, arg[i+1], time.Local); e == nil {
|
||||||
cache = t
|
cache = t
|
||||||
@ -191,9 +195,9 @@ func _spide_part(m *ice.Message, arg ...string) (io.Reader, string) {
|
|||||||
}
|
}
|
||||||
if strings.HasPrefix(arg[i+1], "@") {
|
if strings.HasPrefix(arg[i+1], "@") {
|
||||||
if s, e := os.Stat(arg[i+1][1:]); e == nil {
|
if s, e := os.Stat(arg[i+1][1:]); e == nil {
|
||||||
m.Debug("local: %s cache: %s", s.ModTime(), cache)
|
m.Debug("local: %s size: %d size: %d cache: %s", s.ModTime(), s.Size(), size, cache)
|
||||||
if s.ModTime().Before(cache) {
|
if s.Size() == size && s.ModTime().Before(cache) {
|
||||||
break
|
// break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if f, e := os.Open(arg[i+1][1:]); m.Assert(e) {
|
if f, e := os.Open(arg[i+1][1:]); m.Assert(e) {
|
||||||
@ -341,8 +345,8 @@ func init() {
|
|||||||
conf := m.Confm(cli.RUNTIME, "conf")
|
conf := m.Confm(cli.RUNTIME, "conf")
|
||||||
m.Cmd(SPIDE, mdb.CREATE, ice.OPS, kit.Select("http://127.0.0.1:9020", conf["ctx_ops"]))
|
m.Cmd(SPIDE, mdb.CREATE, ice.OPS, kit.Select("http://127.0.0.1:9020", conf["ctx_ops"]))
|
||||||
m.Cmd(SPIDE, mdb.CREATE, ice.DEV, kit.Select("http://contexts.woa.com:80", conf["ctx_dev"]))
|
m.Cmd(SPIDE, mdb.CREATE, ice.DEV, kit.Select("http://contexts.woa.com:80", conf["ctx_dev"]))
|
||||||
m.Cmd(SPIDE, mdb.CREATE, ice.SHY, kit.Select("https://shylinux.com:443", conf["ctx_shy"]))
|
m.Cmd(SPIDE, mdb.CREATE, ice.SHY, kit.Select("https://contexts.com.cn:443", conf["ctx_shy"]))
|
||||||
// m.Cmd(SPIDE, mdb.CREATE, ice.SHY, kit.Select("https://contexts.com.cn:443", conf["ctx_shy"]))
|
// m.Cmd(SPIDE, mdb.CREATE, ice.SHY, kit.Select("https://shylinux.com:443", conf["ctx_shy"]))
|
||||||
}},
|
}},
|
||||||
mdb.CREATE: {Name: "create name address", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create name address", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_spide_create(m, m.Option(mdb.NAME), m.Option(ADDRESS))
|
_spide_create(m, m.Option(mdb.NAME), m.Option(ADDRESS))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user