Simford.Dong commited on
Commit
dab9dfe
·
1 Parent(s): 7c7da15

Backup entire .hermes-web-ui directory (not just .token)

Browse files

The hermes-web-ui stores session DB, channel configs (WeChat credentials),
device identity, and profile config in /data/.hermes-web-ui/. Only backing
up .token meant all channel login state was lost on restart.

Files changed (1) hide show
  1. src/data_sync.py +5 -6
src/data_sync.py CHANGED
@@ -57,7 +57,7 @@ class DatasetManager:
57
  'state_db': {'path': self.hermes_home / 'state.db', 'skip_backup': False},
58
  'logs': {'path': self.hermes_home / 'logs', 'skip_backup': True}, # 日志大且不重要
59
  'cron': {'path': self.hermes_home / 'cron', 'skip_backup': False},
60
- 'webui_token': {'path': Path('/data/.hermes-web-ui') / '.token', 'skip_backup': False},
61
  'image_cache': {'path': self.hermes_home / 'image_cache', 'skip_backup': True}, # 图片缓存大
62
  'baoyu_skills': {'path': Path('/home/appuser/.baoyu-skills'), 'skip_backup': False},
63
  }
@@ -249,11 +249,10 @@ class DatasetManager:
249
  if not baoyu_info.get('skip_backup') and baoyu_info['path'].exists():
250
  shutil.copytree(baoyu_info['path'], self.temp_dir / 'baoyu_skills', dirs_exist_ok=True)
251
 
252
- # WebUI 认证 Token
253
- webui_info = self.path_mapping['webui_token']
254
  if not webui_info.get('skip_backup') and webui_info['path'].exists():
255
- (self.temp_dir / 'webui').mkdir(exist_ok=True)
256
- shutil.copy2(webui_info['path'], self.temp_dir / 'webui' / '.token')
257
 
258
  # 确保空目录也能被 git/HF dataset 跟踪(git 不跟踪空目录)
259
  for subdir in ['memories', 'skills', 'sessions', 'cron', 'baoyu_skills']:
@@ -383,7 +382,7 @@ class DatasetManager:
383
  'state/state.db': self.path_mapping['state_db']['path'],
384
  'logs': self.path_mapping['logs']['path'],
385
  'cron': self.path_mapping['cron']['path'],
386
- 'webui/.token': self.path_mapping['webui_token']['path'],
387
  'image_cache': self.path_mapping['image_cache']['path'],
388
  'baoyu_skills': self.path_mapping['baoyu_skills']['path'],
389
  }
 
57
  'state_db': {'path': self.hermes_home / 'state.db', 'skip_backup': False},
58
  'logs': {'path': self.hermes_home / 'logs', 'skip_backup': True}, # 日志大且不重要
59
  'cron': {'path': self.hermes_home / 'cron', 'skip_backup': False},
60
+ 'webui_dir': {'path': Path('/data/.hermes-web-ui'), 'skip_backup': False},
61
  'image_cache': {'path': self.hermes_home / 'image_cache', 'skip_backup': True}, # 图片缓存大
62
  'baoyu_skills': {'path': Path('/home/appuser/.baoyu-skills'), 'skip_backup': False},
63
  }
 
249
  if not baoyu_info.get('skip_backup') and baoyu_info['path'].exists():
250
  shutil.copytree(baoyu_info['path'], self.temp_dir / 'baoyu_skills', dirs_exist_ok=True)
251
 
252
+ # WebUI 完整目录(含认证 Token、会话、频道配置等)
253
+ webui_info = self.path_mapping['webui_dir']
254
  if not webui_info.get('skip_backup') and webui_info['path'].exists():
255
+ shutil.copytree(webui_info['path'], self.temp_dir / 'webui', dirs_exist_ok=True)
 
256
 
257
  # 确保空目录也能被 git/HF dataset 跟踪(git 不跟踪空目录)
258
  for subdir in ['memories', 'skills', 'sessions', 'cron', 'baoyu_skills']:
 
382
  'state/state.db': self.path_mapping['state_db']['path'],
383
  'logs': self.path_mapping['logs']['path'],
384
  'cron': self.path_mapping['cron']['path'],
385
+ 'webui': self.path_mapping['webui_dir']['path'],
386
  'image_cache': self.path_mapping['image_cache']['path'],
387
  'baoyu_skills': self.path_mapping['baoyu_skills']['path'],
388
  }