-
Notifications
You must be signed in to change notification settings - Fork 87
Conversation
let external_release_id = if repository == RepositoryKind::TownlongYak { | ||
addon.file_id().map(ExternalReleaseId::FileId) | ||
} else { | ||
addon | ||
.version() | ||
.map(str::to_string) | ||
.map(ExternalReleaseId::Version) | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how we cache the version that was just installed / updated. When we reload the addon from the cache, it'll use this as the version / file_id to check against the remote API. This resolves issues where the addon .toc version is not comparable to the remote version on the API
@@ -7,7 +7,7 @@ use chrono::prelude::*; | |||
use isahc::ResponseExt; | |||
use serde::{Deserialize, Serialize}; | |||
|
|||
const CATALOG_URL: &str = "https://github.com/ajour/ajour-catalog/raw/master/catalog.json"; | |||
const CATALOG_URL: &str = "https://raw.githubusercontent.com/ajour/ajour-catalog/3ce1414498adbc7167f11fe0dac7cd58e7b55391/catalog.json"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure we change this back before merging. I switched over to test.
// Set the file id / version from the cache entry. This is needed to properly | ||
// validate the installed version against the remote version | ||
match &e.external_release_id { | ||
Some(ExternalReleaseId::FileId(file_id)) => { | ||
repo_package.metadata.file_id = Some(*file_id) | ||
} | ||
Some(ExternalReleaseId::Version(version)) => { | ||
repo_package.metadata.version = Some(version.clone()) | ||
} | ||
None => {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is where we apply that cached remote release version when building addon from cache entry
// Set version & file id of installed addon to that of newly unpacked package. | ||
if let Some(package) = addon.relevant_release_package(global_release_channel) { | ||
version = Some(package.version); | ||
} | ||
if let Some(version) = version { | ||
addon.set_version(version); | ||
addon.set_version(package.version); | ||
|
||
if let Some(file_id) = package.file_id { | ||
addon.set_file_id(file_id); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is where we set version / file id from the newly installed / updated package. This is done prior to updating the cache entry, so cache will always stay up to date with latest external release id when installing / updating
src/gui/mod.rs
Outdated
@@ -1838,6 +1844,7 @@ impl std::fmt::Display for CatalogSource { | |||
catalog::Source::Curse => "Curse", | |||
catalog::Source::Tukui => "Tukui", | |||
catalog::Source::WowI => "WowInterface", | |||
catalog::Source::TownlongYak => "TownlongYak", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we should write: Townlong Yak
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well put a -
in at that point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah lets do that.
I've tested this on both Windows and macOS and it works perfectly. |
Resolves #512
Proposed Changes
Checklist
CHANGELOG.md
if knowledge of this change could be valuable to users