Skip to content

Commit

Permalink
Merge pull request #2660 from Drakkar-Software/dev
Browse files Browse the repository at this point in the history
dev merge
  • Loading branch information
GuillaumeDSM authored Jul 5, 2024
2 parents bc3b456 + 17d2e78 commit ca60e8e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
[![Twitter](https://img.shields.io/twitter/follow/DrakkarsOctobot.svg?label=twitter&style=social)](https://octobot.click/gh-twitter)
[![YouTube](https://img.shields.io/youtube/channel/views/UC2YAaBeWY8y_Olqs79b_X8A?label=youtube&style=social)](https://octobot.click/gh-youtube)

## 🎉 OctoBot is launching on Product Hunt on July 10th

<p align="center">
<a href="https://www.producthunt.com/posts/octobot-open-source?embed=true&utm_source=badge-featured&utm_medium=badge&utm_souce=badge-octobot&#0045;open&#0045;source" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=463219&theme=light" alt="OctoBot&#0032;open&#0032;source - Your&#0032;open&#0032;source&#0032;investment&#0032;strategy&#0032;builder | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
</p>
<p align="center">
👆 Follow the launch to get your exclusive discount!
</p>

<p align="center">
<img src="../assets/illustration.png" alt="Octobot automating trades of its user while the user is relaxing on his couch">
</p>
Expand Down
14 changes: 8 additions & 6 deletions octobot/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ async def update_or_repair_tentacles_if_necessary(community_auth, selected_profi
elif force_refresh_tentacles_setup_config:
community_tentacles_packages.refresh_tentacles_setup_config()

# await install_or_update_tentacles(config, additional_tentacles_package_urls) #TMPPP
if local_profile_tentacles_setup_config is None or \
not tentacles_manager_api.are_tentacles_up_to_date(local_profile_tentacles_setup_config, constants.VERSION):
logger.info("OctoBot tentacles are not up to date. Updating tentacles...")
Expand Down Expand Up @@ -175,11 +174,14 @@ async def install_all_tentacles(
async with aiohttp_util.ssl_fallback_aiohttp_client_session(
commons_constants.KNOWN_POTENTIALLY_SSL_FAILED_REQUIRED_URL
) as aiohttp_session:
base_urls = [tentacles_url] + (
constants.ADDITIONAL_TENTACLES_PACKAGE_URL.split(constants.URL_SEPARATOR)
if constants.ADDITIONAL_TENTACLES_PACKAGE_URL else []
)
for url in (base_urls if not only_additional else []) + (additional_tentacles_package_urls or []):
base_urls = [tentacles_url] + community_tentacles_packages.get_env_variable_tentacles_urls()
# avoid duplicates
additional_urls = [
url
for url in (additional_tentacles_package_urls or [])
if url not in base_urls
]
for url in (base_urls if not only_additional else []) + additional_urls:
if url is None:
continue
hide_url = url in additional_tentacles_package_urls
Expand Down
3 changes: 2 additions & 1 deletion octobot/community/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,9 @@ async def _init_community_data(self, fetch_private_data):
self.update_supports(),
self.init_public_data(),
]
if fetch_private_data:
if constants.IS_CLOUD_ENV or fetch_private_data:
coros.append(self.update_selected_bot())
if fetch_private_data:
coros.append(self.fetch_private_data())
if not self.user_account.is_hosting_enabled():
coros.append(self.update_is_hosting_enabled(True))
Expand Down
13 changes: 12 additions & 1 deletion octobot/community/tentacles_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ def get_to_install_and_remove_tentacles(
adapt_url_to_bot_version(package_url)
for package_url in community_auth.get_saved_package_urls()
] if community_auth.is_logged_in() else []
to_keep_tentacles = set(
additional_tentacles_package_urls + [
adapt_url_to_bot_version(package_url)
for package_url in get_env_variable_tentacles_urls()
] + get_env_variable_tentacles_urls()
)
was_connected_with_remote_packages = community_auth.was_connected_with_remote_packages()

# do not remove tentacles:
Expand All @@ -72,7 +78,7 @@ def get_to_install_and_remove_tentacles(
to_remove_urls = [
package_url
for package_url in installed_community_package_urls
if package_url not in additional_tentacles_package_urls
if package_url not in to_keep_tentacles
] if can_remove_tentacles else []
if to_remove_urls:
tentacles_manager_api.reload_tentacle_info()
Expand All @@ -98,6 +104,11 @@ def get_to_install_and_remove_tentacles(
return list(set(to_install_urls)), list(set(to_remove_tentacles)), force_refresh_tentacles_setup_config


def get_env_variable_tentacles_urls() -> list[str]:
return constants.ADDITIONAL_TENTACLES_PACKAGE_URL.split(constants.URL_SEPARATOR) \
if constants.ADDITIONAL_TENTACLES_PACKAGE_URL else []


def is_community_tentacle_url(url: str) -> bool:
return constants.COMMUNITY_EXTENSIONS_PACKAGES_IDENTIFIER in url

Expand Down

0 comments on commit ca60e8e

Please sign in to comment.