MCPcopy
hub / github.com/chavyleung/scripts / apiRevertGlobalBak

Function apiRevertGlobalBak

chavy.box.js:811–836  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

809}
810
811async function apiRevertGlobalBak() {
812 const { id: bakcupId } = $.toObj($request.body)
813 const backup = $.getjson(bakcupId)
814 if (backup) {
815 const {
816 chavy_boxjs_sysCfgs,
817 chavy_boxjs_sysApps,
818 chavy_boxjs_sessions,
819 chavy_boxjs_userCfgs,
820 chavy_boxjs_cur_sessions,
821 chavy_boxjs_app_subCaches,
822 ...datas
823 } = backup
824 $.setdata(JSON.stringify(chavy_boxjs_sessions), $.KEY_sessions)
825 $.setdata(JSON.stringify(chavy_boxjs_userCfgs), $.KEY_usercfgs)
826 $.setdata(JSON.stringify(chavy_boxjs_cur_sessions), $.KEY_cursessions)
827 $.setdata(JSON.stringify(chavy_boxjs_app_subCaches), $.KEY_app_subCaches)
828 const isNull = (val) =>
829 [undefined, null, 'null', 'undefined', ''].includes(val)
830 Object.keys(datas).forEach((datkey) =>
831 $.setdata(isNull(datas[datkey]) ? '' : `${datas[datkey]}`, datkey)
832 )
833 }
834 const boxdata = getBoxData()
835 $.json = boxdata
836}
837
838async function apiSaveGlobalBak() {
839 const backups = $.getjson($.KEY_backups, [])

Callers

nothing calls this directly

Calls 5

isNullFunction · 0.70
getBoxDataFunction · 0.70
toObjMethod · 0.45
getjsonMethod · 0.45
setdataMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…