/ patches / nightly.patch
nightly.patch
  1  --- a/yaak/crates-tauri/yaak-app/src/updates.rs
  2  +++ b/yaak/crates-tauri/yaak-app/src/updates.rs
  3  @@ -21,9 +21,7 @@
  4   use crate::error::Error::GenericError;
  5   use crate::is_dev;
  6   
  7  -const MAX_UPDATE_CHECK_HOURS_STABLE: u64 = 12;
  8  -const MAX_UPDATE_CHECK_HOURS_BETA: u64 = 3;
  9  -const MAX_UPDATE_CHECK_HOURS_ALPHA: u64 = 1;
 10  +const MAX_UPDATE_CHECK_HOURS_NIGHTLY: u64 = 2;
 11   
 12   // Create updater struct
 13   pub struct YaakUpdater {
 14  @@ -31,17 +29,13 @@
 15   }
 16   
 17   pub enum UpdateMode {
 18  -    Stable,
 19  -    Beta,
 20  -    Alpha,
 21  +    Nightly,
 22   }
 23   
 24   impl Display for UpdateMode {
 25       fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
 26           let s = match self {
 27  -            UpdateMode::Stable => "stable",
 28  -            UpdateMode::Beta => "beta",
 29  -            UpdateMode::Alpha => "alpha",
 30  +            UpdateMode::Nightly => "nightly",
 31           };
 32           write!(f, "{}", s)
 33       }
 34  @@ -50,9 +44,7 @@
 35   impl UpdateMode {
 36       pub fn new(mode: &str) -> UpdateMode {
 37           match mode {
 38  -            "beta" => UpdateMode::Beta,
 39  -            "alpha" => UpdateMode::Alpha,
 40  -            _ => UpdateMode::Stable,
 41  +            _ => UpdateMode::Nightly,
 42           }
 43       }
 44   }
 45  @@ -84,7 +76,6 @@
 46           }
 47   
 48           let settings = window.db().get_settings();
 49  -        let update_key = format!("{:x}", md5::compute(settings.id));
 50           self.last_check = Some(Instant::now());
 51   
 52           info!("Checking for updates mode={} autodl={}", mode, auto_download);
 53  @@ -110,16 +101,6 @@
 54                       });
 55                   });
 56               })
 57  -            .header("X-Update-Mode", mode.to_string())?
 58  -            .header("X-Update-Key", update_key)?
 59  -            .header(
 60  -                "X-Update-Trigger",
 61  -                match update_trigger {
 62  -                    UpdateTrigger::Background => "background",
 63  -                    UpdateTrigger::User => "user",
 64  -                },
 65  -            )?
 66  -            .header("X-Install-Mode", detect_install_mode().unwrap_or("unknown"))?
 67               .build()?
 68               .check()
 69               .await;
 70  @@ -179,9 +160,7 @@
 71           mode: UpdateMode,
 72       ) -> Result<bool> {
 73           let update_period_seconds = match mode {
 74  -            UpdateMode::Stable => MAX_UPDATE_CHECK_HOURS_STABLE,
 75  -            UpdateMode::Beta => MAX_UPDATE_CHECK_HOURS_BETA,
 76  -            UpdateMode::Alpha => MAX_UPDATE_CHECK_HOURS_ALPHA,
 77  +            UpdateMode::Nightly => MAX_UPDATE_CHECK_HOURS_NIGHTLY,
 78           } * (60 * 60);
 79   
 80           if let Some(i) = self.last_check
 81  --- a/yaak/src-web/components/Settings/SettingsGeneral.tsx
 82  +++ b/yaak/src-web/components/Settings/SettingsGeneral.tsx
 83  @@ -38,11 +38,11 @@
 84               labelPosition="left"
 85               labelClassName="w-[14rem]"
 86               size="sm"
 87  +            disabled
 88               value={settings.updateChannel}
 89               onChange={(updateChannel) => patchModel(settings, { updateChannel })}
 90               options={[
 91  -              { label: 'Stable', value: 'stable' },
 92  -              { label: 'Beta (more frequent)', value: 'beta' },
 93  +              { label: 'Nightly', value: 'nightly' }
 94               ]}
 95             />
 96             <IconButton
 97  --- a/yaak/crates/yaak-models/src/queries/settings.rs
 98  +++ b/yaak/crates/yaak-models/src/queries/settings.rs
 99  @@ -34,7 +34,7 @@
100               proxy: None,
101               theme_dark: "yaak-dark".to_string(),
102               theme_light: "yaak-light".to_string(),
103  -            update_channel: "stable".to_string(),
104  +            update_channel: "nightly".to_string(),
105               autoupdate: true,
106               colored_methods: false,
107               hide_license_badge: false,
108  --- a/yaak/crates/yaak-models/migrations/20240118181105_channel_setting.sql
109  +++ b/yaak/crates/yaak-models/migrations/20240118181105_channel_setting.sql
110  @@ -1 +1 @@
111  -ALTER TABLE settings ADD COLUMN update_channel TEXT DEFAULT 'stable' NOT NULL;
112  +ALTER TABLE settings ADD COLUMN update_channel TEXT DEFAULT 'nightly' NOT NULL;