Просмотр исходного кода

Update Airbnb client version and availability mutation hash; fix CalDAV credential wiring

- Bump _CLIENT_VERSION and EditPanelAvailabilityMutation hash from new HAR
- get_calendar() and _fetch_caldav now read CalDAV credentials from store config
  instead of constructing bare Calendar instances with no connection info
- Regenerate config-all.json (long_window_days, sqlite db_path defaults)
ZiB 4 месяцев назад
Родитель
Сommit
da4a1f1fd5

+ 2 - 1
room_cal/config-all.json

@@ -50,7 +50,7 @@
       "calendar_name": "Room"
     },
     "sqlite": {
-      "db_path": ""
+      "db_path": "store.db"
     }
   },
   "global": {
@@ -67,6 +67,7 @@
       "weekend": 72
     },
     "reservation_window_days": 90,
+    "long_window_days": 400,
     "busy_calendar_name": "Busy"
   },
   "services": {

+ 2 - 2
room_cal/ical_feeds/__init__.py

@@ -59,14 +59,14 @@ def _parse_ical(raw_bytes: bytes, calendar_name: str) -> list[EventRecord]:
 
 
 async def _fetch_caldav(entry: CalendarEntry) -> list[EventRecord]:
-  from room_cal.store import Calendar
+  from room_cal.store import get_calendar
 
   calendar_name = entry.caldav
   today = datetime.today()
   start = today - timedelta(days=entry.past_days if entry.past_days is not None else _DEFAULT_PAST_DAYS)
   end = today + timedelta(days=entry.future_days if entry.future_days is not None else _DEFAULT_FUTURE_DAYS)
 
-  cal = Calendar(calendar_name)
+  cal = get_calendar(calendar_name)
   raw_events = await cal.fetch_events(start, end)
   return [
     EventRecord(

+ 2 - 2
room_cal/service_api/_airbnb.py

@@ -44,11 +44,11 @@ class AirbnbData:
 
 _BASE = 'https://www.airbnb.com/api/v3'
 _API_KEY = 'd306zoyjsyarp7ifhu67rjxn52tv0t20'
-_CLIENT_VERSION = 'f3b3e542c2948871cd2fc1c805ad2df39d6d64db'
+_CLIENT_VERSION = '1290e625734ec090772f14c380214201d956a304'
 _HASHES = {
   'getDLSHostCalendar':               '048e22675ffa53121628d2d07b519b9b71f5dab342a1ceb75aa72d8814a00ea7',
   'EditPanelPricingSettingsMutation': 'e27fed4f08dd4ab4c0267c5d6c0a7e4920730deadf48f92feba9b0d08befafa4',
-  'EditPanelAvailabilityMutation':    'b855fc706de32097489d2ea83a113476a273acdff59aad682c837075af45dcc8',
+  'EditPanelAvailabilityMutation':    '2e056e7f98f8dc410a294c649adf719452980eb4d8ea95540fb1297af2637f67',
   'StayHostingDetailsQuery':          '1e81282ae4de44e05bc8b776456644efd4ebcd676451ce7f6c3c5757a1057e02',
   'getNightlyPriceTips':              '07538bf1a5afc8171f1e7443f0007d7f020142fc7ab60df065e7e1edd1a0b29f',
   'HostCalendarListingEventsQuery':   '8bfe5f5572a25fdaff5b5790604e1de3aec5f37731fc505684022d590d06e0a8',

+ 3 - 1
room_cal/store/_caldav.py

@@ -207,7 +207,9 @@ _calendar_registry: dict[str, Calendar] = {}
 def get_calendar(name: str = DEFAULT_CALENDAR_NAME) -> Calendar:
   """Return the shared Calendar instance for the given name, creating it on first call."""
   if name not in _calendar_registry:
-    _calendar_registry[name] = Calendar(name)
+    from room_cal._utils import get_config
+    cal_cfg = get_config().store.caldav
+    _calendar_registry[name] = Calendar(name, url=cal_cfg.url, username=cal_cfg.username, password=cal_cfg.password)
   return _calendar_registry[name]