Skip to content

Commit 04d2c71

Browse files
committed
HOTFIX:
- Allow SRS to downgrade (beta => release)
1 parent 4291ff6 commit 04d2c71

File tree

1 file changed

+22
-30
lines changed

1 file changed

+22
-30
lines changed

extensions/srs/extension.py

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -156,49 +156,41 @@ async def prepare(self) -> bool:
156156

157157
await self.handle_update()
158158
path = self.get_config_path()
159+
dirty = False
159160
if 'client_export_file_path' not in self.config:
160161
self.config['client_export_file_path'] = os.path.join(os.path.dirname(path), 'clients-list.json')
161-
dirty = self._maybe_update_config('Server Settings', 'SERVER_PORT', 'port')
162-
dirty = self._maybe_update_config('Server Settings', 'CLIENT_EXPORT_FILE_PATH',
163-
'client_export_file_path') or dirty
162+
dirty |= self._maybe_update_config('Server Settings', 'SERVER_PORT', 'port')
163+
dirty |= self._maybe_update_config('Server Settings', 'CLIENT_EXPORT_FILE_PATH',
164+
'client_export_file_path')
164165
self.config['client_export_enabled'] = True
165-
dirty = self._maybe_update_config('General Settings', 'CLIENT_EXPORT_ENABLED',
166-
'client_export_enabled') or dirty
166+
dirty |= self._maybe_update_config('General Settings', 'CLIENT_EXPORT_ENABLED',
167+
'client_export_enabled')
167168
# enable SRS on spectators for slot blocking
168169
self.config['spectators_audio_disabled'] = False
169-
dirty = self._maybe_update_config('General Settings', 'SPECTATORS_AUDIO_DISABLED',
170-
'spectators_audio_disabled') or dirty
170+
dirty |= self._maybe_update_config('General Settings', 'SPECTATORS_AUDIO_DISABLED',
171+
'spectators_audio_disabled')
171172
# disable effects (for music plugin)
172173
# TODO: better alignment with the music plugin!
173-
dirty = self._maybe_update_config('General Settings', 'RADIO_EFFECT_OVERRIDE',
174-
'radio_effect_override') or dirty
175-
dirty = self._maybe_update_config('General Settings', 'GLOBAL_LOBBY_FREQUENCIES',
176-
'global_lobby_frequencies') or dirty
174+
dirty |= self._maybe_update_config('General Settings', 'RADIO_EFFECT_OVERRIDE',
175+
'radio_effect_override')
176+
dirty |= self._maybe_update_config('General Settings', 'GLOBAL_LOBBY_FREQUENCIES',
177+
'global_lobby_frequencies')
177178
extension = self.server.extensions.get('LotAtc')
178179
if extension:
179180
self.config['lotatc'] = True
180181
self.config['lotatc_export_port'] = self.config.get('lotatc_export_port', 10712)
181-
dirty = self._maybe_update_config('General Settings',
182-
'LOTATC_EXPORT_ENABLED',
183-
'lotatc') or dirty
184-
dirty = self._maybe_update_config('General Settings',
185-
'LOTATC_EXPORT_IP',
186-
'127.0.0.1') or dirty
187-
dirty = self._maybe_update_config('General Settings',
188-
'LOTATC_EXPORT_PORT',
189-
'lotatc_export_port') or dirty
182+
dirty |= self._maybe_update_config('General Settings','LOTATC_EXPORT_ENABLED','lotatc')
183+
dirty |= self._maybe_update_config('General Settings','LOTATC_EXPORT_IP','127.0.0.1')
184+
dirty |= self._maybe_update_config('General Settings','LOTATC_EXPORT_PORT',
185+
'lotatc_export_port')
190186
self.config['awacs'] = True
191187

192188
if self.config.get('awacs', True):
193-
dirty = self._maybe_update_config('General Settings',
194-
'EXTERNAL_AWACS_MODE',
195-
'awacs') or dirty
196-
dirty = self._maybe_update_config('External AWACS Mode Settings',
197-
'EXTERNAL_AWACS_MODE_BLUE_PASSWORD',
198-
'blue_password') or dirty
199-
dirty = self._maybe_update_config('External AWACS Mode Settings',
200-
'EXTERNAL_AWACS_MODE_RED_PASSWORD',
201-
'red_password') or dirty
189+
dirty |= self._maybe_update_config('General Settings','EXTERNAL_AWACS_MODE','awacs')
190+
dirty |= self._maybe_update_config('External AWACS Mode Settings',
191+
'EXTERNAL_AWACS_MODE_BLUE_PASSWORD','blue_password')
192+
dirty |= self._maybe_update_config('External AWACS Mode Settings',
193+
'EXTERNAL_AWACS_MODE_RED_PASSWORD','red_password')
202194

203195
if dirty:
204196
with open(path, mode='w', encoding='utf-8') as ini:
@@ -473,7 +465,7 @@ async def check_for_updates(self) -> Optional[str]:
473465
if isinstance(data, list):
474466
data = data[0]
475467
version = data.get('tag_name', '').strip('v')
476-
if parse(version) > parse(self.version):
468+
if parse(version) != parse(self.version):
477469
return version
478470
return None
479471

0 commit comments

Comments
 (0)