Sfoglia il codice sorgente

Revert app version ID update

This reverts commits d6ebf5bbd274c99022a9b860f66d389423f46808, d752386822874afa4087cb3f5f70aa1881392be1 and 37765a81ceeb3738d4523ab59428239b4efb9338
Tulir Asokan 2 anni fa
parent
commit
9813b9842f

+ 3 - 4
mauigpapi/http/base.py

@@ -122,7 +122,7 @@ class BaseAndroidAPI:
             "x-ig-bandwidth-speed-kbps": "-1.000",
             "x-ig-bandwidth-totalbytes-b": "0",
             "x-ig-bandwidth-totaltime-ms": "0",
-            # "x-ig-app-startup-country": self.state.device.language.split("_")[1],
+            "x-ig-app-startup-country": self.state.device.language.split("_")[1],
             "x-bloks-version-id": self.state.application.BLOKS_VERSION_ID,
             "x-ig-www-claim": self.state.session.ig_www_claim or "0",
             "x-bloks-is-layout-rtl": str(self.state.device.is_layout_rtl).lower(),
@@ -134,7 +134,6 @@ class BaseAndroidAPI:
             "x-fb-connection-type": self.state.device.connection_type,
             "x-ig-capabilities": self.state.application.CAPABILITIES,
             "x-ig-app-id": self.state.application.FACEBOOK_ANALYTICS_APPLICATION_ID,
-            "priority": "u=3",
             "user-agent": self.state.user_agent,
             "accept-language": self.state.device.language.replace("_", "-"),
             "authorization": self.state.session.authorization,
@@ -145,10 +144,10 @@ class BaseAndroidAPI:
             "ig-u-ds-user-id": self.state.session.ds_user_id,
             "ig-u-rur": self.state.session.rur,
             "ig-intended-user-id": self.state.session.ds_user_id or "0",
-            # "ig-client-endpoint": "unknown",
+            "ig-client-endpoint": "unknown",
             "x-fb-http-engine": "Liger",
             "x-fb-client-ip": "True",
-            # "x-fb-rmd": "cached=0;state=NO_MATCH",
+            "x-fb-rmd": "cached=0;state=NO_MATCH",
             "x-fb-server-cluster": "True",
             "x-tigon-is-retry": "False",
             "accept-encoding": "gzip",

+ 4 - 50
mauigpapi/http/thread.py

@@ -139,50 +139,11 @@ class ThreadAPI(BaseAndroidAPI):
             f"/api/v1/direct_v2/threads/{thread_id}/", query=query, response_type=DMThreadResponse
         )
 
-    # /threads/.../get_items/ with urlencoded form body:
-    # visual_message_return_type:     unseen
-    # _uuid:                          device uuid
-    # original_message_client_contexts:["client context"]
-    # item_ids:                       [item id]
-
-    async def get_thread_participant_requests(self, thread_id: str, page_size: int = 10):
-        return await self.std_http_get(
-            f"/api/v1/direct_v2/threads/{thread_id}/participant_requests/",
-            query={"page_size": str(page_size)},
-        )
-
-    async def mark_seen(
-        self, thread_id: str, item_id: str, client_context: str | None = None
-    ) -> None:
-        if not client_context:
-            client_context = self.state.gen_client_context()
-        data = {
-            "thread_id": thread_id,
-            "action": "mark_seen",
-            "client_context": client_context,
-            "_uuid": self.state.device.uuid,
-            "offline_threading_id": client_context,
-        }
-        await self.std_http_post(
-            f"/api/v1/direct_v2/threads/{thread_id}/items/{item_id}/seen/", data=data
-        )
-
-    async def send_delivery_receipt(
-        self, thread_id: str, sender_id: int | str, item_id: str
-    ) -> None:
-        data = {
-            "thread_id": thread_id,
-            "_uuid": self.state.device.uuid,
-            "sender_ig_id": str(sender_id),
-            "dr_disable": "1",
-            "item_id": item_id,
-        }
-        await self.std_http_post("/api/v1/direct_v2/delivery_receipt/", data=data)
-
     async def create_group_thread(self, recipient_users: list[int | str]) -> Thread:
         return await self.std_http_post(
             "/api/v1/direct_v2/create_group_thread/",
             data={
+                "_csrftoken": self.state.cookies.csrf_token,
                 "_uuid": self.state.device.uuid,
                 "_uid": self.state.session.ds_user_id,
                 "recipient_users": json.dumps(
@@ -213,17 +174,10 @@ class ThreadAPI(BaseAndroidAPI):
             },
         )
 
-    async def delete_item(
-        self, thread_id: str, item_id: str, orig_client_context: str | None = None
-    ) -> None:
+    async def delete_item(self, thread_id: str, item_id: str) -> None:
         await self.std_http_post(
             f"/api/v1/direct_v2/threads/{thread_id}/items/{item_id}/delete/",
-            data={
-                "is_shh_mode": "0",
-                "send_attribution": "direct_thread",
-                "_uuid": self.state.device.uuid,
-                "original_message_client_context": orig_client_context,
-            },
+            data={"_csrftoken": self.state.cookies.csrf_token, "_uuid": self.state.device.uuid},
         )
 
     async def _broadcast(
@@ -242,12 +196,12 @@ class ThreadAPI(BaseAndroidAPI):
             "thread_ids": f"[{thread_id}]",
             "is_shh_mode": "0",
             "client_context": client_context,
+            "_csrftoken": self.state.cookies.csrf_token,
             "device_id": self.state.device.id,
             "mutation_token": client_context,
             "_uuid": self.state.device.uuid,
             **kwargs,
             "offline_threading_id": client_context,
-            "is_x_transport_forward": "false",
         }
         return await self.std_http_post(
             f"/api/v1/direct_v2/threads/broadcast/{item_type}/",

+ 3 - 19
mauigpapi/http/upload.py

@@ -44,13 +44,12 @@ class UploadAPI(BaseAndroidAPI):
                 }
             ),
             "media_type": str(MediaType.IMAGE.value),
-            "sticker_burnin_params": json.dumps([]),
             "upload_id": upload_id,
             "xsharing_user_ids": json.dumps([]),
         }
         if mime == "image/jpeg":
             params["image_compression"] = json.dumps(
-                {"lib_name": "moz", "lib_version": "3.1.m", "quality": "0"}
+                {"lib_name": "moz", "lib_version": "3.1.m", "quality": 80}
             )
         if width and height:
             params["original_width"] = str(width)
@@ -102,8 +101,6 @@ class UploadAPI(BaseAndroidAPI):
         if audio:
             params["is_direct_voice"] = "1"
         else:
-            params["sticker_burnin_params"] = json.dumps([])
-            params["hflip"] = "false"
             params["direct_v2"] = "1"
             params["for_direct_story"] = "1"
             params["content_tags"] = "use_default_cover"
@@ -124,7 +121,6 @@ class UploadAPI(BaseAndroidAPI):
         if not audio:
             headers["segment-type"] = "3"
             headers["segment-start-offset"] = "0"
-        # TODO call GET /rupload_igvideo with same params and priority header
         return (
             await self.std_http_post(
                 f"/rupload_igvideo/{name}",
@@ -137,12 +133,7 @@ class UploadAPI(BaseAndroidAPI):
         )
 
     async def finish_upload(
-        self,
-        upload_id: str,
-        source_type: str,
-        video: bool = False,
-        width: int | None = None,
-        height: int | None = None,
+        self, upload_id: str, source_type: str, video: bool = False
     ) -> FinishUploadResponse:
         headers = {
             "retry_context": json.dumps(
@@ -155,6 +146,7 @@ class UploadAPI(BaseAndroidAPI):
         }
         req = {
             "timezone_offset": self.state.device.timezone_offset,
+            "_csrftoken": self.state.cookies.csrf_token,
             "source_type": source_type,
             "_uid": self.state.session.ds_user_id,
             "device_id": self.state.device.id,
@@ -164,14 +156,6 @@ class UploadAPI(BaseAndroidAPI):
         }
         query = {}
         if video:
-            if width and height:
-                req["extra"] = {
-                    "source_width": width,
-                    "source_height": height,
-                }
-            req["filter_type"] = "0"
-            req["include_e2ee_mentioned_user_list"] = "false"
-            req["video_result"] = ""
             query["video"] = "1"
         return await self.std_http_post(
             "/api/v1/media/upload_finish/",

+ 2 - 23
mauigpapi/mqtt/conn.py

@@ -191,7 +191,6 @@ class AndroidMQTT:
             RealtimeTopic.RS_RESP,  # 245
             RealtimeTopic.T_RTC_LOG,  # 274
             RealtimeTopic.SEND_MESSAGE_RESPONSE,  # 133
-            RealtimeTopic.LARGE_SCALE_FIRE_AND_FORGET_SYNC,  # 279
             RealtimeTopic.MESSAGE_SYNC,  # 146
             RealtimeTopic.LIGHTSPEED_RESPONSE,  # 179
             RealtimeTopic.UNKNOWN_PP,  # 34
@@ -230,7 +229,7 @@ class AndroidMQTT:
                 "platform": "android",
                 "ig_mqtt_route": "django",
                 "pubsub_msg_type_blacklist": "direct, typing_type",
-                # "auth_cache_enabled": "1",
+                "auth_cache_enabled": "1",
             },
         )
         return zlib.compress(cfg.to_thrift(), level=9)
@@ -768,11 +767,7 @@ class AndroidMQTT:
             "thread_id": thread_id,
             "client_context": client_context,
             "offline_threading_id": client_context,
-            "mutation_token": client_context,
             "action": action.value,
-            "is_shh_mode": "0",
-            "sampled": False,
-            "session_id": f"UFS-{self.state.pigeon_session_id}-0",
             # "device_id": self.state.cookies["ig_did"],
             **kwargs,
         }
@@ -909,15 +904,7 @@ class AndroidMQTT:
         target_item_type: ThreadItemType = ThreadItemType.TEXT,
         shh_mode: bool = False,
         client_context: str | None = None,
-        original_message_client_context: str | None = None,
     ) -> Awaitable[CommandResponse]:
-        kwargs = (
-            {
-                "original_message_client_context": original_message_client_context,
-            }
-            if original_message_client_context
-            else {}
-        )
         return self.send_item(
             thread_id,
             reaction_status=reaction_status.value,
@@ -926,15 +913,10 @@ class AndroidMQTT:
             target_item_type=target_item_type.value,
             emoji=emoji,
             item_id=item_id,
-            reaction_action_source=(
-                "double_tap" if reaction_status == ReactionStatus.CREATED else "action_menu"
-            ),
+            reaction_action_source="double_tap",
             shh_mode=shh_mode,
             item_type=ThreadItemType.REACTION,
             client_context=client_context,
-            super_react_type="none",
-            send_attribution="direct_thread",
-            **kwargs,
         )
 
     def send_user_story(
@@ -986,9 +968,6 @@ class AndroidMQTT:
             client_context=client_context,
             replied_to_item_id=replied_to_item_id,
             replied_to_client_context=replied_to_client_context,
-            send_attribution="direct_thread",
-            send_silently=False,
-            is_x_transport_forward=False,
         )
 
     def mark_seen(

+ 0 - 2
mauigpapi/mqtt/subscription.py

@@ -344,7 +344,6 @@ _topic_map: dict[str, str] = {
     "/rs_req": "244",
     "/rs_resp": "245",
     "/t_rtc_log": "274",
-    "/ig_large_scale_fire_and_forget_sync": "279",
 }
 
 _reverse_topic_map: dict[str, str] = {value: key for key, value in _topic_map.items()}
@@ -367,7 +366,6 @@ class RealtimeTopic(Enum):
     RS_REQ = "/rs_req"
     RS_RESP = "/rs_resp"
     T_RTC_LOG = "/t_rtc_log"
-    LARGE_SCALE_FIRE_AND_FORGET_SYNC = "/ig_large_scale_fire_and_forget_sync"
 
     @property
     def encoded(self) -> str:

+ 3 - 3
mauigpapi/state/application.py

@@ -20,9 +20,9 @@ from mautrix.types import SerializableAttrs
 
 @dataclass
 class AndroidApplication(SerializableAttrs):
-    APP_VERSION: str = "279.0.0.23.112"
-    APP_VERSION_CODE: str = "466535821"
+    APP_VERSION: str = "256.0.0.18.105"
+    APP_VERSION_CODE: str = "407842973"
     FACEBOOK_ANALYTICS_APPLICATION_ID: str = "567067343352427"
 
-    BLOKS_VERSION_ID: str = "2fecedb8f3d321e9fc9b22f9693830c31650ff5b50516bdde984ff1b2090d2ac"
+    BLOKS_VERSION_ID: str = "0928297a84f74885ff39fc1628f8a40da3ef1c467555d555bfd9f8fe1aaacafe"
     CAPABILITIES: str = "3brTv10="

+ 0 - 1
mautrix_instagram/matrix.py

@@ -149,7 +149,6 @@ class MatrixHandler(BaseMatrixHandler):
         if not message:
             return
         user.log.debug(f"Marking {message.item_id} in {portal.thread_id} as read")
-        # await user.client.mark_seen(portal.thread_id, message.item_id)
         await user.mqtt.mark_seen(portal.thread_id, message.item_id)
 
     @staticmethod

+ 2 - 8
mautrix_instagram/portal.py

@@ -721,10 +721,7 @@ class Portal(DBPortal, BasePortal):
 
         async with self._reaction_lock:
             resp = await sender.mqtt.send_reaction(
-                self.thread_id,
-                item_id=message.item_id,
-                emoji=emoji,
-                original_message_client_context=message.client_context,
+                self.thread_id, item_id=message.item_id, emoji=emoji
             )
             if resp.status != "ok":
                 if resp.payload and resp.payload.message == "invalid unicode emoji":
@@ -773,7 +770,6 @@ class Portal(DBPortal, BasePortal):
                     item_id=reaction.ig_item_id,
                     reaction_status=ReactionStatus.DELETED,
                     emoji="",
-                    # TODO set original_message_client_context
                 )
             except Exception as e:
                 raise Exception(f"Removing reaction failed: {e}")
@@ -785,9 +781,7 @@ class Portal(DBPortal, BasePortal):
         if message and not message.is_internal:
             try:
                 await message.delete()
-                await sender.client.delete_item(
-                    self.thread_id, message.item_id, message.client_context
-                )
+                await sender.client.delete_item(self.thread_id, message.item_id)
                 self.log.trace(f"Removed {message} after Matrix redaction")
             except Exception as e:
                 raise Exception(f"Removing message failed: {e}")