1
0
mirror of https://shylinux.com/x/icebergs synced 2025-06-28 03:02:59 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2022-04-10 12:56:58 +08:00
parent 0ab3b73e38
commit 4bc53b7764
2 changed files with 12 additions and 6 deletions

View File

@ -75,13 +75,15 @@ func _share_local(m *ice.Message, arg ...string) {
if m.Option(ice.POD) != "" { // 远程文件
pp := path.Join(ice.VAR_PROXY, m.Option(ice.POD), p)
cache := time.Now().Add(-time.Hour * 240000)
var size int64
if s, e := os.Stat(pp); e == nil {
cache = s.ModTime()
size = s.Size()
}
// 上传文件
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() {
p = pp

View File

@ -183,7 +183,11 @@ func _spide_part(m *ice.Message, arg ...string) (io.Reader, string) {
defer mp.Close()
cache := time.Now().Add(-time.Hour * 240000)
var size int64
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 t, e := time.ParseInLocation(ice.MOD_TIME, arg[i+1], time.Local); e == nil {
cache = t
@ -191,9 +195,9 @@ func _spide_part(m *ice.Message, arg ...string) (io.Reader, string) {
}
if strings.HasPrefix(arg[i+1], "@") {
if s, e := os.Stat(arg[i+1][1:]); e == nil {
m.Debug("local: %s cache: %s", s.ModTime(), cache)
if s.ModTime().Before(cache) {
break
m.Debug("local: %s size: %d size: %d cache: %s", s.ModTime(), s.Size(), size, cache)
if s.Size() == size && s.ModTime().Before(cache) {
// break
}
}
if f, e := os.Open(arg[i+1][1:]); m.Assert(e) {
@ -341,8 +345,8 @@ func init() {
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.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) {
_spide_create(m, m.Option(mdb.NAME), m.Option(ADDRESS))