launcher.py 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # mautrix-instagram - A Matrix-Instagram puppeting bridge.
  2. # Copyright (C) 2020 Tulir Asokan
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU Affero General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU Affero General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Affero General Public License
  15. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. from typing import Dict, Any
  17. from .base import BaseAndroidAPI
  18. pre_login_configs = ("ig_fbns_blocked,ig_android_felix_release_players,"
  19. "ig_user_mismatch_soft_error,ig_android_carrier_signals_killswitch,"
  20. "ig_android_killswitch_perm_direct_ssim,fizz_ig_android,"
  21. "ig_mi_block_expired_events,ig_android_os_version_blocking_config")
  22. post_login_configs = ("ig_android_insights_welcome_dialog_tooltip,"
  23. "ig_android_extra_native_debugging_info,"
  24. "ig_android_insights_top_account_dialog_tooltip,"
  25. "ig_android_explore_startup_prefetch_launcher,"
  26. "ig_android_newsfeed_recyclerview,ig_android_react_native_ota_kill_switch,"
  27. "ig_qe_value_consistency_checker,"
  28. "ig_android_qp_keep_promotion_during_cooldown,"
  29. "ig_launcher_ig_explore_post_chaining_hide_comments_android_v0,"
  30. "ig_android_video_playback,"
  31. "ig_launcher_ig_android_network_stack_queue_undefined_request_qe,"
  32. "ig_camera_android_attributed_effects_endpoint_api_query_config,"
  33. "ig_android_notification_setting_sync,ig_android_dogfooding,"
  34. "ig_launcher_ig_explore_post_chaining_pill_android_v0,"
  35. "ig_android_request_compression_launcher,ig_delink_lasso_accounts,"
  36. "ig_android_stories_send_preloaded_reels_with_reels_tray,"
  37. "ig_android_critical_path_manager,"
  38. "ig_android_shopping_django_product_search,ig_android_qp_surveys_v1,"
  39. "ig_android_feed_attach_report_logs,ig_android_uri_parser_cache_launcher,"
  40. "ig_android_global_scheduler_infra,ig_android_explore_grid_viewpoint,"
  41. "ig_android_global_scheduler_direct,ig_android_upload_heap_on_oom,"
  42. "ig_launcher_ig_android_network_stack_cap_api_request_qe,"
  43. "ig_android_async_view_model_launcher,ig_android_bug_report_screen_record,"
  44. "ig_canvas_ad_pixel,ig_android_bloks_demos,"
  45. "ig_launcher_force_switch_on_dialog,ig_story_insights_entry,"
  46. "ig_android_executor_limit_per_group_config,"
  47. "ig_android_bitmap_strong_ref_cache_layer_launcher,"
  48. "ig_android_cold_start_class_preloading,"
  49. "ig_direct_e2e_send_waterfall_sample_rate_config,"
  50. "ig_android_qp_waterfall_logging,ig_synchronous_account_switch,"
  51. "ig_launcher_ig_android_reactnative_realtime_ota,"
  52. "ig_contact_invites_netego_killswitch,"
  53. "ig_launcher_ig_explore_video_chaining_container_module_android,"
  54. "ig_launcher_ig_explore_remove_topic_channel_tooltip_experiment_android,"
  55. "ig_android_request_cap_tuning_with_bandwidth,"
  56. "ig_android_rageshake_redesign,"
  57. "ig_launcher_explore_navigation_redesign_android,"
  58. "ig_android_betamap_cold_start,ig_android_employee_options,"
  59. "ig_android_direct_gifs_killswitch,ig_android_gps_improvements_launcher,"
  60. "ig_launcher_ig_android_network_stack_cap_video_request_qe,"
  61. "ig_launcher_ig_android_network_request_cap_tuning_qe,"
  62. "ig_android_qp_xshare_to_fb,ig_android_feed_report_ranking_issue,"
  63. "ig_launcher_ig_explore_verified_badge_android,"
  64. "ig_android_bloks_data_release,ig_android_feed_camera_latency")
  65. class LauncherSyncAPI(BaseAndroidAPI):
  66. async def launcher_pre_login_sync(self):
  67. await self.__sync({
  68. "id": self.state.device.uuid,
  69. "configs": pre_login_configs,
  70. })
  71. async def launcher_post_login_sync(self):
  72. await self.__sync({
  73. "_csrftoken": self.state.cookies.csrf_token,
  74. "id": self.state.cookies.user_id,
  75. "_uid": self.state.cookies.user_id,
  76. "_uuid": self.state.device.uuid,
  77. "configs": post_login_configs,
  78. })
  79. async def __sync(self, req: Dict[str, Any]):
  80. # TODO parse response?
  81. return await self.std_http_post("/api/v1/launcher/sync/", data=req)