()
| 864 | } |
| 865 | |
| 866 | async function apiRevertGlobalBak() { |
| 867 | const { id: bakcupId } = $.toObj($request.body) |
| 868 | const backup = $.getjson(bakcupId) |
| 869 | if (backup) { |
| 870 | const { |
| 871 | chavy_boxjs_sysCfgs, |
| 872 | chavy_boxjs_sysApps, |
| 873 | chavy_boxjs_sessions, |
| 874 | chavy_boxjs_userCfgs, |
| 875 | chavy_boxjs_cur_sessions, |
| 876 | chavy_boxjs_app_subCaches, |
| 877 | ...datas |
| 878 | } = backup |
| 879 | $.setdata(JSON.stringify(chavy_boxjs_sessions), $.KEY_sessions) |
| 880 | $.setdata(JSON.stringify(chavy_boxjs_userCfgs), $.KEY_usercfgs) |
| 881 | $.setdata(JSON.stringify(chavy_boxjs_cur_sessions), $.KEY_cursessions) |
| 882 | $.setdata(JSON.stringify(chavy_boxjs_app_subCaches), $.KEY_app_subCaches) |
| 883 | const isNull = (val) => |
| 884 | [undefined, null, 'null', 'undefined', ''].includes(val) |
| 885 | Object.keys(datas).forEach((datkey) => |
| 886 | $.setdata(isNull(datas[datkey]) ? '' : `${datas[datkey]}`, datkey) |
| 887 | ) |
| 888 | } |
| 889 | const boxdata = getBoxData() |
| 890 | $.json = boxdata |
| 891 | } |
| 892 | |
| 893 | async function apiSaveGlobalBak() { |
| 894 | const backups = $.getjson($.KEY_backups, []) |
nothing calls this directly
no test coverage detected