From f1def25bb5d864b254728228db2cd032afaae106 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Mon, 27 Sep 2021 09:59:25 -0500 Subject: [PATCH] Removed alpha version development. All versions would be a single update channel --- src/application.py | 10 ++--- src/controller/mainController.py | 4 +- src/installer_alpha.nsi | 70 ------------------------------ src/interactors/configuration.py | 12 ----- src/presenters/configuration.py | 17 -------- src/session.defaults | 1 - src/update/update.py | 27 ++++-------- src/update/updater.py | 12 ++--- src/views/dialogs/configuration.py | 7 --- src/write_version_data.py | 11 +++++ 10 files changed, 29 insertions(+), 142 deletions(-) delete mode 100644 src/installer_alpha.nsi diff --git a/src/application.py b/src/application.py index 178fdd9..dc894f9 100644 --- a/src/application.py +++ b/src/application.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- name = "Socializer" -version = "0.24" author = "Manuel Cortez" authorEmail = "manuel@manuelcortez.net" copyright = "Copyright (C) 2016-2020, Manuel Cortez" @@ -13,10 +12,7 @@ bts_name = "socializer" bts_access_token = "U29jaWFsaXplcg" bts_url = "https://issues.manuelcortez.net" ### Update information -# URL to retrieve the latest updates for the stable branch. -update_stable_url = "https://files.manuelcortez.net/socializer/update/stable.json" -# URL to retrieve update information for the "next" branch. This is a channel made for alpha versions. -# Every commit will trigger an update, so users wanting to have the bleeding edge code will get it as soon as it is committed here and build by a runner. -update_next_url = "https://files.manuelcortez.net/socializer/update/alpha.json" +update_url = "https://files.manuelcortez.net/socializer/update/alpha.json" # Short_id of the last commit, this is set to none here because it will be set manually by the building tools. -update_next_version = "03286a44" +version = "2021.09.22" +update_next_version = "4bdba42e" \ No newline at end of file diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 8e7c2a6..df6f0b6 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -99,7 +99,7 @@ class Controller(object): self.connect_pubsub_events() self.connect_gui_events() self.create_controls() - call_threaded(updater.do_update, update_type=self.session.settings["general"]["update_channel"]) + call_threaded(updater.do_update) def is_focused(self): """ Return True if the Socializer Window is Focused. """ @@ -707,7 +707,7 @@ class Controller(object): b.get_items() def check_for_updates(self, *args, **kwargs): - update = updater.do_update(update_type=self.session.settings["general"]["update_channel"]) + update = updater.do_update() if update == False: commonMessages.no_update_available() diff --git a/src/installer_alpha.nsi b/src/installer_alpha.nsi deleted file mode 100644 index c822036..0000000 --- a/src/installer_alpha.nsi +++ /dev/null @@ -1,70 +0,0 @@ -!include "MUI2.nsh" -!include "LogicLib.nsh" -Unicode true -CRCCheck on -ManifestSupportedOS all -XPStyle on -Name "Socializer" -OutFile "socializer_alpha_setup.exe" -InstallDir "$PROGRAMFILES\socializer" -InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "InstallLocation" -RequestExecutionLevel admin -SetCompress auto -SetCompressor /solid lzma -SetDatablockOptimize on -VIAddVersionKey ProductName "Socializer" -VIAddVersionKey LegalCopyright "Copyright 2019 Manuel Cortez." -VIAddVersionKey ProductVersion "0.24" -VIAddVersionKey FileVersion "0.24" -VIProductVersion "0.24.0.0" -VIFileVersion "0.24.0.0" -!insertmacro MUI_PAGE_WELCOME -!insertmacro MUI_PAGE_DIRECTORY -var StartMenuFolder -!insertmacro MUI_PAGE_STARTMENU startmenu $StartMenuFolder -!insertmacro MUI_PAGE_INSTFILES -!define MUI_FINISHPAGE_LINK "Visit Socializer website" -!define MUI_FINISHPAGE_LINK_LOCATION "http://socializer.su" -!define MUI_FINISHPAGE_RUN "$INSTDIR\socializer.exe" -!insertmacro MUI_PAGE_FINISH -!insertmacro MUI_UNPAGE_CONFIRM -!insertmacro MUI_UNPAGE_INSTFILES -!insertmacro MUI_LANGUAGE "Russian" -!insertmacro MUI_LANGUAGE "English" -!insertmacro MUI_LANGUAGE "Spanish" - -!insertmacro MUI_RESERVEFILE_LANGDLL -Section -SetShellVarContext All -SetOutPath "$INSTDIR" -File /r dist\* -CreateShortCut "$DESKTOP\socializer.lnk" "$INSTDIR\socializer.exe" -!insertmacro MUI_STARTMENU_WRITE_BEGIN startmenu -CreateDirectory "$SMPROGRAMS\$StartMenuFolder" -CreateShortCut "$SMPROGRAMS\$StartMenuFolder\socializer.lnk" "$INSTDIR\socializer.exe" -CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Socializer on the web.lnk" "http://socializer.su" -CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" -!insertmacro MUI_STARTMENU_WRITE_END -WriteUninstaller "$INSTDIR\Uninstall.exe" -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "DisplayName" "Socializer" -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "UninstallString" '"$INSTDIR\uninstall.exe"' -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "InstallLocation" $INSTDIR -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "Publisher" "Manuel Cortez" -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "DisplayVersion" "0.24" -WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "URLInfoAbout" "http://socializer.su" -WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "VersionMajor" 0 -WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "VersionMinor" 19 -WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "NoModify" 1 -WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "NoRepair" 1 -SectionEnd -Section "Uninstall" -SetShellVarContext All -DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" -RMDir /r /REBOOTOK $INSTDIR -Delete "$DESKTOP\socializer.lnk" -!insertmacro MUI_STARTMENU_GETFOLDER startmenu $StartMenuFolder -RMDir /r "$SMPROGRAMS\$StartMenuFolder" -SectionEnd -Function .onInit -!insertmacro MUI_LANGDLL_DISPLAY -FunctionEnd diff --git a/src/interactors/configuration.py b/src/interactors/configuration.py index 67a54ef..3c3bb24 100644 --- a/src/interactors/configuration.py +++ b/src/interactors/configuration.py @@ -45,18 +45,6 @@ class configurationInteractor(base.baseInteractor): self.presenter.update_setting(section="buffers", setting="count_for_video_buffers", value=self.view.get_value("buffers", "video_buffers_count")) self.presenter.update_setting(section="buffers", setting="count_for_chat_buffers", value=self.view.get_value("buffers", "chat_buffers_count")) self.presenter.update_setting(section="general", setting="load_images", value=self.view.get_value("general", "load_images")) - update_channel = self.presenter.get_update_channel_type(self.view.get_value("general", "update_channel")) - if update_channel != self.presenter.session.settings["general"]["update_channel"]: - if update_channel == "stable": - self.presenter.update_setting(section="general", setting="update_channel", value=update_channel) - elif update_channel == "weekly": - dialog = self.view.weekly_channel() - if dialog == widgetUtils.YES: - self.presenter.update_setting(section="general", setting="update_channel", value=update_channel) - elif update_channel == "alpha": - dialog = self.view.alpha_channel() - if dialog == widgetUtils.YES: - self.presenter.update_setting(section="general", setting="update_channel", value=update_channel) self.presenter.update_setting(section="chat", setting="notify_online", value=self.view.get_value("chat", "notify_online")) self.presenter.update_setting(section="chat", setting="notify_offline", value=self.view.get_value("chat", "notify_offline")) self.presenter.update_setting(section="chat", setting="notifications", value=self.presenter.get_notification_type(self.view.get_value("chat", "notifications"))) diff --git a/src/presenters/configuration.py b/src/presenters/configuration.py index 3df7fc4..537ccb5 100644 --- a/src/presenters/configuration.py +++ b/src/presenters/configuration.py @@ -22,28 +22,12 @@ class configurationPresenter(base.basePresenter): else: return _("Custom") - def get_update_channel_label(self, value): - if value == "stable": - return _("Stable") - elif value == "weekly": - return _("Weekly") - else: - return _("Alpha") - def get_notification_type(self, value): if value == _("Native"): return "native" else: return "custom" - def get_update_channel_type(self, value): - if value == _("Stable"): - return "stable" - elif value == _("Weekly"): - return "weekly" - else: - return "alpha" - def create_config(self): self.langs = languageHandler.getAvailableLanguages() langs = [i[1] for i in self.langs] @@ -54,7 +38,6 @@ class configurationPresenter(base.basePresenter): self.send_message("set", tab="general", setting="load_images", value=self.session.settings["general"]["load_images"]) self.send_message("set", tab="general", setting="use_proxy", value=config.app["app-settings"]["use_proxy"]) self.send_message("set", tab="general", setting="debug_logging", value=config.app["app-settings"]["debug_logging"]) - self.send_message("set", tab="general", setting="update_channel", value=self.get_update_channel_label(self.session.settings["general"]["update_channel"])) self.send_message("create_tab", tab="buffers") self.send_message("set", tab="buffers", setting="wall_buffer_count", value=self.session.settings["buffers"]["count_for_wall_buffers"]) self.send_message("set", tab="buffers", setting="video_buffers_count", value=self.session.settings["buffers"]["count_for_video_buffers"]) diff --git a/src/session.defaults b/src/session.defaults index 7bfb5f2..cf005e5 100644 --- a/src/session.defaults +++ b/src/session.defaults @@ -8,7 +8,6 @@ invited_to_group = boolean(default=False) [general] reverse_timelines = boolean(default=False) load_images = boolean(default=True) -update_channel = string(default="stable") [buffers] count_for_wall_buffers = integer(default=50) diff --git a/src/update/update.py b/src/update/update.py index e29d9cb..49741a7 100644 --- a/src/update/update.py +++ b/src/update/update.py @@ -17,13 +17,13 @@ except ImportError: from platform_utils import paths -def perform_update(endpoint, current_version, update_type="stable", app_name='', password=None, update_available_callback=None, progress_callback=None, update_complete_callback=None): +def perform_update(endpoint, current_version, app_name='', password=None, update_available_callback=None, progress_callback=None, update_complete_callback=None): requests_session = create_requests_session(app_name=app_name, version=current_version) available_update = find_update(endpoint, requests_session=requests_session) if not available_update: logger.debug("No update available") return False - available_version, available_description, update_url = find_version_data(update_type, current_version, available_update) + available_version, available_description, update_url = find_version_data(current_version, available_update) if available_version == False: return False logger.info("A new update is available. Version %s" % available_version) @@ -55,22 +55,13 @@ def find_update(endpoint, requests_session): content = response.json() return content -def find_version_data(update_type, current_version, available_update): - if update_type == "stable": - available_version = float(available_update['current_version']) - if not float(available_version) > float(current_version) or platform.system()+platform.architecture()[0][:2] not in available_update['downloads']: - logger.debug("No update for this architecture") - return (False, False, False) - available_description = available_update.get('description', None) - update_url = available_update ['downloads'][platform.system()+platform.architecture()[0][:2]] - return (available_version, available_description, update_url) - else: # Unstable versions, based in commits instead of version numbers. - available_version = available_update["current_version"] - if available_version == current_version: - return (False, False, False) - available_description = available_update["description"] - update_url = available_update ['downloads'][platform.system()+platform.architecture()[0][:2]] - return (available_version, available_description, update_url) +def find_version_data(current_version, available_update): + available_version = available_update["current_version"] + if available_version == current_version: + return (False, False, False) + available_description = available_update["description"] + update_url = available_update ['downloads'][platform.system()+platform.architecture()[0][:2]] + return (available_version, available_description, update_url) def download_update(update_url, update_destination, requests_session, progress_callback=None, chunk_size=io.DEFAULT_BUFFER_SIZE): total_downloaded = total_size = 0 diff --git a/src/update/updater.py b/src/update/updater.py index 9283f65..f5f44e5 100644 --- a/src/update/updater.py +++ b/src/update/updater.py @@ -9,18 +9,14 @@ from . import update from .wxUpdater import * logger = logging.getLogger("updater") -def do_update(update_type="stable"): +def do_update(): # Updates cannot be performed in the source code version of Socializer. if hasattr(sys, "frozen") == False: return - if update_type == "stable": - endpoint = application.update_stable_url - version = application.version - else: - endpoint = application.update_next_url - version = application.update_next_version + endpoint = application.update_url + version = application.update_next_version try: - return update.perform_update(endpoint=endpoint, current_version=version, app_name=application.name, update_type=update_type, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished) + return update.perform_update(endpoint=endpoint, current_version=version, app_name=application.name, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished) except ConnectionError: logger.exception("Update failed.") output.speak("An exception occurred while attempting to update " + application.name + ". If this message persists, contact the " + application.name + " developers. More information about the exception has been written to the error log.",True) diff --git a/src/views/dialogs/configuration.py b/src/views/dialogs/configuration.py index 0b60923..1e1f48b 100644 --- a/src/views/dialogs/configuration.py +++ b/src/views/dialogs/configuration.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals import wx import widgetUtils @@ -18,12 +17,6 @@ class general(wx.Panel, widgetUtils.BaseDialog): sizer.Add(self.use_proxy, 0, wx.ALL, 5) self.debug_logging = wx.CheckBox(self, wx.NewId(), _("Enable debug logging (useful for reporting errors)")) sizer.Add(self.debug_logging, 0, wx.ALL, 5) - lbl4 = wx.StaticText(self, wx.NewId(), _("Update channel")) - self.update_channel = wx.ComboBox(self, wx.NewId(), choices=[_("Stable"), _("Alpha")], value=_("Native"), style=wx.CB_READONLY) - box4 = wx.BoxSizer(wx.HORIZONTAL) - box4.Add(lbl4, 0, wx.ALL, 5) - box4.Add(self.update_channel, 0, wx.ALL, 5) - sizer.Add(box4, 0, wx.ALL, 5) self.SetSizer(sizer) class buffers(wx.Panel, widgetUtils.BaseDialog): diff --git a/src/write_version_data.py b/src/write_version_data.py index 07f1b6f..da7e505 100644 --- a/src/write_version_data.py +++ b/src/write_version_data.py @@ -11,9 +11,20 @@ commit = commit_info["short_id"] print("Got new version info: {commit}".format(commit=commit,)) file = open("application.py", "r", encoding="utf-8") lines = file.readlines() +lines[-2] = 'version = "{}"\n'.format(commit_info["created_at"][:10].replace("-", ".")) lines[-1] = 'update_next_version = "{commit}"'.format(commit=commit,) file.close() file2 = open("application.py", "w", encoding="utf-8") file2.writelines(lines) file2.close() print("Wrote application.py with the new version info.") + +print("Updating next version on installer setup...") +file = open("installer.nsi", "r", encoding="utf-8") +contents = file.read() +contents = contents.replace("0.24", commit_info["created_at"][:10].replace("-", ".")) +file.close() +file2 = open("installer.nsi", "w", encoding="utf-8") +file2.write(contents) +file2.close() +print("done")