Initial commit: lzwlab.cn server project (docs, nginx, gitea, rustdesk, file transfer app)

This commit is contained in:
2026-08-26 22:59:47 +08:00
commit 7da61a0456
18 changed files with 2703 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
"""手动/定时清理过期文件与孤儿缓存文件。"""
import logging
import time
import auth
import storage
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
log = logging.getLogger("lzwlab-cleanup")
def main() -> int:
cfg = auth.load_config()
files_dir = cfg["files_dir"]
db_path = cfg["database_path"]
storage.init_db(db_path)
now = int(time.time())
removed = storage.cleanup_expired(db_path, files_dir, now=now)
orphans = storage.cleanup_orphans(db_path, files_dir, now=now)
log.info("清理完成:过期文件 %d 个,孤儿缓存 %d", removed, orphans)
return 0
if __name__ == "__main__":
raise SystemExit(main())