system.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. // SiYuan - Refactor your thinking
  2. // Copyright (c) 2020-present, b3log.org
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Affero General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Affero General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Affero General Public License
  15. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. package api
  17. import (
  18. "io"
  19. "net/http"
  20. "os"
  21. "path/filepath"
  22. "strings"
  23. "sync"
  24. "time"
  25. "github.com/88250/gulu"
  26. "github.com/88250/lute"
  27. "github.com/gin-gonic/gin"
  28. "github.com/jinzhu/copier"
  29. "github.com/siyuan-note/logging"
  30. "github.com/siyuan-note/siyuan/kernel/conf"
  31. "github.com/siyuan-note/siyuan/kernel/model"
  32. "github.com/siyuan-note/siyuan/kernel/util"
  33. )
  34. func getNetwork(c *gin.Context) {
  35. ret := gulu.Ret.NewResult()
  36. defer c.JSON(http.StatusOK, ret)
  37. maskedConf, err := model.GetMaskedConf()
  38. if err != nil {
  39. ret.Code = -1
  40. ret.Msg = "get conf failed: " + err.Error()
  41. return
  42. }
  43. ret.Data = map[string]interface{}{
  44. "proxy": maskedConf.System.NetworkProxy,
  45. }
  46. }
  47. func getChangelog(c *gin.Context) {
  48. ret := gulu.Ret.NewResult()
  49. defer c.JSON(http.StatusOK, ret)
  50. data := map[string]interface{}{"show": false, "html": ""}
  51. ret.Data = data
  52. changelogsDir := filepath.Join(util.WorkingDir, "changelogs")
  53. if !gulu.File.IsDir(changelogsDir) {
  54. return
  55. }
  56. if !model.Conf.ShowChangelog {
  57. return
  58. }
  59. changelogPath := filepath.Join(changelogsDir, "v"+util.Ver, "v"+util.Ver+"_"+model.Conf.Lang+".md")
  60. if !gulu.File.IsExist(changelogPath) {
  61. changelogPath = filepath.Join(changelogsDir, "v"+util.Ver, "v"+util.Ver+".md")
  62. if !gulu.File.IsExist(changelogPath) {
  63. logging.LogErrorf("changelog not found: %s", changelogPath)
  64. return
  65. }
  66. }
  67. contentData, err := os.ReadFile(changelogPath)
  68. if err != nil {
  69. logging.LogErrorf("read changelog failed: %s", err)
  70. return
  71. }
  72. model.Conf.ShowChangelog = false
  73. luteEngine := lute.New()
  74. htmlContent := luteEngine.MarkdownStr("", string(contentData))
  75. htmlContent = util.LinkTarget(htmlContent, "")
  76. data["show"] = true
  77. data["html"] = htmlContent
  78. ret.Data = data
  79. }
  80. func getEmojiConf(c *gin.Context) {
  81. ret := gulu.Ret.NewResult()
  82. defer c.JSON(http.StatusOK, ret)
  83. builtConfPath := filepath.Join(util.AppearancePath, "emojis", "conf.json")
  84. data, err := os.ReadFile(builtConfPath)
  85. if err != nil {
  86. logging.LogErrorf("read emojis conf.json failed: %s", err)
  87. ret.Code = -1
  88. ret.Msg = err.Error()
  89. return
  90. }
  91. var conf []map[string]interface{}
  92. if err = gulu.JSON.UnmarshalJSON(data, &conf); err != nil {
  93. logging.LogErrorf("unmarshal emojis conf.json failed: %s", err)
  94. ret.Code = -1
  95. ret.Msg = err.Error()
  96. return
  97. }
  98. customConfDir := filepath.Join(util.DataDir, "emojis")
  99. custom := map[string]interface{}{
  100. "id": "custom",
  101. "title": "Custom",
  102. "title_zh_cn": "自定义",
  103. "title_ja_jp": "カスタム",
  104. }
  105. items := []map[string]interface{}{}
  106. custom["items"] = items
  107. if gulu.File.IsDir(customConfDir) {
  108. model.CustomEmojis = sync.Map{}
  109. customEmojis, err := os.ReadDir(customConfDir)
  110. if err != nil {
  111. logging.LogErrorf("read custom emojis failed: %s", err)
  112. } else {
  113. for _, customEmoji := range customEmojis {
  114. name := customEmoji.Name()
  115. if strings.HasPrefix(name, ".") {
  116. continue
  117. }
  118. if customEmoji.IsDir() {
  119. // 子级
  120. subCustomEmojis, err := os.ReadDir(filepath.Join(customConfDir, name))
  121. if err != nil {
  122. logging.LogErrorf("read custom emojis failed: %s", err)
  123. continue
  124. }
  125. for _, subCustomEmoji := range subCustomEmojis {
  126. if subCustomEmoji.IsDir() {
  127. continue
  128. }
  129. name = subCustomEmoji.Name()
  130. if strings.HasPrefix(name, ".") {
  131. continue
  132. }
  133. addCustomEmoji(customEmoji.Name()+"/"+name, &items)
  134. }
  135. continue
  136. }
  137. addCustomEmoji(name, &items)
  138. }
  139. }
  140. }
  141. custom["items"] = items
  142. conf = append([]map[string]interface{}{custom}, conf...)
  143. ret.Data = conf
  144. return
  145. }
  146. func addCustomEmoji(name string, items *[]map[string]interface{}) {
  147. ext := filepath.Ext(name)
  148. nameWithoutExt := strings.TrimSuffix(name, ext)
  149. emoji := map[string]interface{}{
  150. "unicode": name,
  151. "description": nameWithoutExt,
  152. "description_zh_cn": nameWithoutExt,
  153. "description_ja_jp": nameWithoutExt,
  154. "keywords": nameWithoutExt,
  155. }
  156. *items = append(*items, emoji)
  157. imgSrc := "/emojis/" + name
  158. model.CustomEmojis.Store(nameWithoutExt, imgSrc)
  159. }
  160. func checkUpdate(c *gin.Context) {
  161. ret := gulu.Ret.NewResult()
  162. defer c.JSON(http.StatusOK, ret)
  163. arg, ok := util.JsonArg(c, ret)
  164. if !ok {
  165. return
  166. }
  167. showMsg := arg["showMsg"].(bool)
  168. model.CheckUpdate(showMsg)
  169. }
  170. func exportLog(c *gin.Context) {
  171. ret := gulu.Ret.NewResult()
  172. defer c.JSON(http.StatusOK, ret)
  173. zipPath := model.ExportSystemLog()
  174. ret.Data = map[string]interface{}{
  175. "zip": zipPath,
  176. }
  177. }
  178. func exportConf(c *gin.Context) {
  179. ret := gulu.Ret.NewResult()
  180. defer c.JSON(http.StatusOK, ret)
  181. logging.LogInfof("exporting conf...")
  182. name := "siyuan-conf-" + time.Now().Format("20060102150405") + ".json"
  183. tmpDir := filepath.Join(util.TempDir, "export")
  184. if err := os.MkdirAll(tmpDir, 0755); err != nil {
  185. logging.LogErrorf("export conf failed: %s", err)
  186. ret.Code = -1
  187. ret.Msg = err.Error()
  188. return
  189. }
  190. clonedConf := &model.AppConf{}
  191. if err := copier.CopyWithOption(clonedConf, model.Conf, copier.Option{IgnoreEmpty: false, DeepCopy: true}); err != nil {
  192. logging.LogErrorf("export conf failed: %s", err)
  193. ret.Code = -1
  194. ret.Msg = err.Error()
  195. return
  196. }
  197. if nil != clonedConf.Editor {
  198. clonedConf.Editor.Emoji = []string{}
  199. }
  200. if nil != clonedConf.Export {
  201. clonedConf.Export.PandocBin = ""
  202. }
  203. clonedConf.UserData = ""
  204. clonedConf.Account = nil
  205. clonedConf.AccessAuthCode = ""
  206. if nil != clonedConf.System {
  207. clonedConf.System.ID = ""
  208. clonedConf.System.Name = ""
  209. clonedConf.System.OSPlatform = ""
  210. clonedConf.System.Container = ""
  211. clonedConf.System.IsMicrosoftStore = false
  212. clonedConf.System.IsInsider = false
  213. }
  214. clonedConf.Sync = nil
  215. clonedConf.Stat = nil
  216. clonedConf.Api = nil
  217. clonedConf.Repo = nil
  218. clonedConf.Publish = nil
  219. clonedConf.CloudRegion = 0
  220. clonedConf.DataIndexState = 0
  221. data, err := gulu.JSON.MarshalIndentJSON(clonedConf, "", " ")
  222. if err != nil {
  223. logging.LogErrorf("export conf failed: %s", err)
  224. ret.Code = -1
  225. ret.Msg = err.Error()
  226. return
  227. }
  228. tmp := filepath.Join(tmpDir, name)
  229. if err = os.WriteFile(tmp, data, 0644); err != nil {
  230. logging.LogErrorf("export conf failed: %s", err)
  231. ret.Code = -1
  232. ret.Msg = err.Error()
  233. return
  234. }
  235. zipFile, err := gulu.Zip.Create(tmp + ".zip")
  236. if err != nil {
  237. logging.LogErrorf("export conf failed: %s", err)
  238. ret.Code = -1
  239. ret.Msg = err.Error()
  240. return
  241. }
  242. if err = zipFile.AddEntry(name, tmp); err != nil {
  243. logging.LogErrorf("export conf failed: %s", err)
  244. ret.Code = -1
  245. ret.Msg = err.Error()
  246. return
  247. }
  248. if err = zipFile.Close(); err != nil {
  249. logging.LogErrorf("export conf failed: %s", err)
  250. ret.Code = -1
  251. ret.Msg = err.Error()
  252. return
  253. }
  254. logging.LogInfof("exported conf")
  255. zipPath := "/export/" + name + ".zip"
  256. ret.Data = map[string]interface{}{
  257. "name": name,
  258. "zip": zipPath,
  259. }
  260. }
  261. func importConf(c *gin.Context) {
  262. ret := gulu.Ret.NewResult()
  263. defer c.JSON(200, ret)
  264. logging.LogInfof("importing conf...")
  265. form, err := c.MultipartForm()
  266. if err != nil {
  267. logging.LogErrorf("read upload file failed: %s", err)
  268. ret.Code = -1
  269. ret.Msg = err.Error()
  270. return
  271. }
  272. files := form.File["file"]
  273. if 1 != len(files) {
  274. ret.Code = -1
  275. ret.Msg = "invalid upload file"
  276. return
  277. }
  278. f := files[0]
  279. fh, err := f.Open()
  280. if err != nil {
  281. logging.LogErrorf("read upload file failed: %s", err)
  282. ret.Code = -1
  283. ret.Msg = err.Error()
  284. return
  285. }
  286. data, err := io.ReadAll(fh)
  287. fh.Close()
  288. if err != nil {
  289. logging.LogErrorf("read upload file failed: %s", err)
  290. ret.Code = -1
  291. ret.Msg = err.Error()
  292. return
  293. }
  294. tmpDir := filepath.Join(util.TempDir, "import")
  295. if err = os.MkdirAll(tmpDir, 0755); err != nil {
  296. logging.LogErrorf("import conf failed: %s", err)
  297. ret.Code = -1
  298. ret.Msg = err.Error()
  299. return
  300. }
  301. tmp := filepath.Join(tmpDir, f.Filename)
  302. if err = os.WriteFile(tmp, data, 0644); err != nil {
  303. logging.LogErrorf("import conf failed: %s", err)
  304. ret.Code = -1
  305. ret.Msg = err.Error()
  306. return
  307. }
  308. if err = gulu.Zip.Unzip(tmp, tmpDir); err != nil {
  309. logging.LogErrorf("import conf failed: %s", err)
  310. ret.Code = -1
  311. ret.Msg = err.Error()
  312. return
  313. }
  314. tmp = filepath.Join(tmpDir, f.Filename[:len(f.Filename)-4])
  315. data, err = os.ReadFile(tmp)
  316. if err != nil {
  317. logging.LogErrorf("import conf failed: %s", err)
  318. ret.Code = -1
  319. ret.Msg = err.Error()
  320. return
  321. }
  322. importedConf := model.NewAppConf()
  323. if err = gulu.JSON.UnmarshalJSON(data, importedConf); err != nil {
  324. logging.LogErrorf("import conf failed: %s", err)
  325. ret.Code = -1
  326. ret.Msg = err.Error()
  327. return
  328. }
  329. if err = copier.CopyWithOption(model.Conf, importedConf, copier.Option{IgnoreEmpty: true, DeepCopy: true}); err != nil {
  330. logging.LogErrorf("import conf failed: %s", err)
  331. ret.Code = -1
  332. ret.Msg = err.Error()
  333. return
  334. }
  335. logging.LogInfof("imported conf")
  336. model.Close(false, true, 1)
  337. }
  338. func getConf(c *gin.Context) {
  339. ret := gulu.Ret.NewResult()
  340. defer c.JSON(http.StatusOK, ret)
  341. maskedConf, err := model.GetMaskedConf()
  342. if err != nil {
  343. ret.Code = -1
  344. ret.Msg = "get conf failed: " + err.Error()
  345. return
  346. }
  347. if !maskedConf.Sync.Enabled || (0 == maskedConf.Sync.Provider && !model.IsSubscriber()) {
  348. maskedConf.Sync.Stat = model.Conf.Language(53)
  349. }
  350. // REF: https://github.com/siyuan-note/siyuan/issues/11364
  351. role := model.GetGinContextRole(c)
  352. if model.IsReadOnlyRole(role) {
  353. maskedConf.ReadOnly = true
  354. }
  355. if !model.IsValidRole(role, []model.Role{
  356. model.RoleAdministrator,
  357. }) {
  358. model.HideConfSecret(maskedConf)
  359. }
  360. ret.Data = map[string]interface{}{
  361. "conf": maskedConf,
  362. "start": !util.IsUILoaded,
  363. }
  364. }
  365. func setUILayout(c *gin.Context) {
  366. ret := gulu.Ret.NewResult()
  367. defer c.JSON(http.StatusOK, ret)
  368. if util.ReadOnly {
  369. return
  370. }
  371. arg, ok := util.JsonArg(c, ret)
  372. if !ok {
  373. return
  374. }
  375. param, err := gulu.JSON.MarshalJSON(arg["layout"])
  376. if err != nil {
  377. ret.Code = -1
  378. ret.Msg = err.Error()
  379. return
  380. }
  381. uiLayout := &conf.UILayout{}
  382. if err = gulu.JSON.UnmarshalJSON(param, uiLayout); err != nil {
  383. ret.Code = -1
  384. ret.Msg = err.Error()
  385. return
  386. }
  387. model.Conf.SetUILayout(uiLayout)
  388. model.Conf.Save()
  389. }
  390. func setAPIToken(c *gin.Context) {
  391. ret := gulu.Ret.NewResult()
  392. defer c.JSON(http.StatusOK, ret)
  393. arg, ok := util.JsonArg(c, ret)
  394. if !ok {
  395. return
  396. }
  397. token := arg["token"].(string)
  398. model.Conf.Api.Token = token
  399. model.Conf.Save()
  400. }
  401. func setAccessAuthCode(c *gin.Context) {
  402. ret := gulu.Ret.NewResult()
  403. defer c.JSON(http.StatusOK, ret)
  404. arg, ok := util.JsonArg(c, ret)
  405. if !ok {
  406. return
  407. }
  408. aac := arg["accessAuthCode"].(string)
  409. if model.MaskedAccessAuthCode == aac {
  410. aac = model.Conf.AccessAuthCode
  411. }
  412. model.Conf.AccessAuthCode = aac
  413. model.Conf.Save()
  414. session := util.GetSession(c)
  415. workspaceSession := util.GetWorkspaceSession(session)
  416. workspaceSession.AccessAuthCode = aac
  417. session.Save(c)
  418. go func() {
  419. time.Sleep(200 * time.Millisecond)
  420. util.ReloadUI()
  421. }()
  422. return
  423. }
  424. func setFollowSystemLockScreen(c *gin.Context) {
  425. ret := gulu.Ret.NewResult()
  426. defer c.JSON(http.StatusOK, ret)
  427. arg, ok := util.JsonArg(c, ret)
  428. if !ok {
  429. return
  430. }
  431. lockScreenMode := int(arg["lockScreenMode"].(float64))
  432. model.Conf.System.LockScreenMode = lockScreenMode
  433. model.Conf.Save()
  434. return
  435. }
  436. func getSysFonts(c *gin.Context) {
  437. ret := gulu.Ret.NewResult()
  438. defer c.JSON(http.StatusOK, ret)
  439. ret.Data = util.GetSysFonts(model.Conf.Lang)
  440. }
  441. func version(c *gin.Context) {
  442. ret := gulu.Ret.NewResult()
  443. defer c.JSON(http.StatusOK, ret)
  444. ret.Data = util.Ver
  445. }
  446. func currentTime(c *gin.Context) {
  447. ret := gulu.Ret.NewResult()
  448. defer c.JSON(http.StatusOK, ret)
  449. ret.Data = util.CurrentTimeMillis()
  450. }
  451. func bootProgress(c *gin.Context) {
  452. ret := gulu.Ret.NewResult()
  453. defer c.JSON(http.StatusOK, ret)
  454. progress, details := util.GetBootProgressDetails()
  455. ret.Data = map[string]interface{}{"progress": progress, "details": details}
  456. }
  457. func setAppearanceMode(c *gin.Context) {
  458. ret := gulu.Ret.NewResult()
  459. defer c.JSON(http.StatusOK, ret)
  460. arg, ok := util.JsonArg(c, ret)
  461. if !ok {
  462. return
  463. }
  464. mode := int(arg["mode"].(float64))
  465. model.Conf.Appearance.Mode = mode
  466. if 0 == mode {
  467. model.Conf.Appearance.ThemeJS = gulu.File.IsExist(filepath.Join(util.ThemesPath, model.Conf.Appearance.ThemeLight, "theme.js"))
  468. } else {
  469. model.Conf.Appearance.ThemeJS = gulu.File.IsExist(filepath.Join(util.ThemesPath, model.Conf.Appearance.ThemeDark, "theme.js"))
  470. }
  471. model.Conf.Save()
  472. ret.Data = map[string]interface{}{
  473. "appearance": model.Conf.Appearance,
  474. }
  475. }
  476. func setNetworkServe(c *gin.Context) {
  477. ret := gulu.Ret.NewResult()
  478. defer c.JSON(http.StatusOK, ret)
  479. arg, ok := util.JsonArg(c, ret)
  480. if !ok {
  481. return
  482. }
  483. networkServe := arg["networkServe"].(bool)
  484. model.Conf.System.NetworkServe = networkServe
  485. model.Conf.Save()
  486. util.PushMsg(model.Conf.Language(42), 1000*15)
  487. time.Sleep(time.Second * 3)
  488. }
  489. func setGoogleAnalytics(c *gin.Context) {
  490. ret := gulu.Ret.NewResult()
  491. defer c.JSON(http.StatusOK, ret)
  492. arg, ok := util.JsonArg(c, ret)
  493. if !ok {
  494. return
  495. }
  496. googleAnalytics := arg["googleAnalytics"].(bool)
  497. model.Conf.System.DisableGoogleAnalytics = !googleAnalytics
  498. model.Conf.Save()
  499. }
  500. func setUploadErrLog(c *gin.Context) {
  501. ret := gulu.Ret.NewResult()
  502. defer c.JSON(http.StatusOK, ret)
  503. arg, ok := util.JsonArg(c, ret)
  504. if !ok {
  505. return
  506. }
  507. uploadErrLog := arg["uploadErrLog"].(bool)
  508. model.Conf.System.UploadErrLog = uploadErrLog
  509. model.Conf.Save()
  510. util.PushMsg(model.Conf.Language(42), 1000*15)
  511. time.Sleep(time.Second * 3)
  512. }
  513. func setAutoLaunch(c *gin.Context) {
  514. ret := gulu.Ret.NewResult()
  515. defer c.JSON(http.StatusOK, ret)
  516. arg, ok := util.JsonArg(c, ret)
  517. if !ok {
  518. return
  519. }
  520. autoLaunch := int(arg["autoLaunch"].(float64))
  521. model.Conf.System.AutoLaunch2 = autoLaunch
  522. model.Conf.Save()
  523. }
  524. func setDownloadInstallPkg(c *gin.Context) {
  525. ret := gulu.Ret.NewResult()
  526. defer c.JSON(http.StatusOK, ret)
  527. arg, ok := util.JsonArg(c, ret)
  528. if !ok {
  529. return
  530. }
  531. downloadInstallPkg := arg["downloadInstallPkg"].(bool)
  532. model.Conf.System.DownloadInstallPkg = downloadInstallPkg
  533. model.Conf.Save()
  534. }
  535. func setNetworkProxy(c *gin.Context) {
  536. ret := gulu.Ret.NewResult()
  537. defer c.JSON(http.StatusOK, ret)
  538. arg, ok := util.JsonArg(c, ret)
  539. if !ok {
  540. return
  541. }
  542. scheme := arg["scheme"].(string)
  543. host := arg["host"].(string)
  544. port := arg["port"].(string)
  545. model.Conf.System.NetworkProxy = &conf.NetworkProxy{
  546. Scheme: scheme,
  547. Host: host,
  548. Port: port,
  549. }
  550. model.Conf.Save()
  551. proxyURL := model.Conf.System.NetworkProxy.String()
  552. util.SetNetworkProxy(proxyURL)
  553. util.PushMsg(model.Conf.Language(102), 3000)
  554. }
  555. func addUIProcess(c *gin.Context) {
  556. pid := c.Query("pid")
  557. util.UIProcessIDs.Store(pid, true)
  558. }
  559. func exit(c *gin.Context) {
  560. ret := gulu.Ret.NewResult()
  561. defer c.JSON(http.StatusOK, ret)
  562. arg, ok := util.JsonArg(c, ret)
  563. if !ok {
  564. return
  565. }
  566. forceArg := arg["force"]
  567. var force bool
  568. if nil != forceArg {
  569. force = forceArg.(bool)
  570. }
  571. execInstallPkgArg := arg["execInstallPkg"] // 0:默认检查新版本,1:不执行新版本安装,2:执行新版本安装
  572. execInstallPkg := 0
  573. if nil != execInstallPkgArg {
  574. execInstallPkg = int(execInstallPkgArg.(float64))
  575. }
  576. exitCode := model.Close(force, true, execInstallPkg)
  577. ret.Code = exitCode
  578. switch exitCode {
  579. case 0:
  580. case 1: // 同步执行失败
  581. ret.Msg = model.Conf.Language(96) + "<div class=\"fn__space\"></div><button class=\"b3-button b3-button--white\">" + model.Conf.Language(97) + "</button>"
  582. ret.Data = map[string]interface{}{"closeTimeout": 0}
  583. case 2: // 提示新安装包
  584. ret.Msg = model.Conf.Language(61)
  585. ret.Data = map[string]interface{}{"closeTimeout": 0}
  586. }
  587. }