@aiyiran/myclaw 1.1.86 → 1.1.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2646,7 +2646,7 @@
|
|
|
2646
2646
|
}, 3000);
|
|
2647
2647
|
}
|
|
2648
2648
|
|
|
2649
|
-
fetch(MYCLAW_API_BASE + '/api/sync-templates')
|
|
2649
|
+
fetch(MYCLAW_API_BASE + '/api/sync-templates?force=1')
|
|
2650
2650
|
.then(function (r) { return r.json(); })
|
|
2651
2651
|
.then(function (sync) {
|
|
2652
2652
|
headSyncBtn.disabled = false;
|
package/package.json
CHANGED
package/server/sync_workspace.py
CHANGED
|
@@ -872,7 +872,7 @@ class MyclawAPIHandler(BaseHTTPRequestHandler):
|
|
|
872
872
|
elif path == '/api/file':
|
|
873
873
|
return self._handle_file(params)
|
|
874
874
|
elif path == '/api/sync-templates':
|
|
875
|
-
return self._handle_sync_templates()
|
|
875
|
+
return self._handle_sync_templates(params)
|
|
876
876
|
elif path == '/api/sync-status':
|
|
877
877
|
return self._handle_sync_status()
|
|
878
878
|
else:
|
|
@@ -1264,11 +1264,16 @@ class MyclawAPIHandler(BaseHTTPRequestHandler):
|
|
|
1264
1264
|
except Exception as e:
|
|
1265
1265
|
self._send_json({"error": str(e)}, 500)
|
|
1266
1266
|
|
|
1267
|
-
def _handle_sync_templates(self):
|
|
1268
|
-
"""GET /api/sync-templates
|
|
1267
|
+
def _handle_sync_templates(self, params=None):
|
|
1268
|
+
"""GET /api/sync-templates[?force=1]
|
|
1269
1269
|
快速比对 CDN index_updated_at 与本地,若一致立即返回 {changed: false}。
|
|
1270
1270
|
若有变化,启动后台线程下载,立即返回 {changed: true, syncing: true}。
|
|
1271
|
+
force=1:删除本地 index,强制重新全量比对。
|
|
1271
1272
|
"""
|
|
1273
|
+
# force=1:清除本地 index 强制重新下载
|
|
1274
|
+
if params and params.get('force', [''])[0] == '1':
|
|
1275
|
+
if os.path.isfile(TEMPLATE_LOCAL_INDEX):
|
|
1276
|
+
os.remove(TEMPLATE_LOCAL_INDEX)
|
|
1272
1277
|
# 快速拉取 CDN index(仅 JSON,通常 <1s)
|
|
1273
1278
|
try:
|
|
1274
1279
|
import ssl
|