+
Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

add support for townlong-yak addons #529

Merged
merged 3 commits into from
Feb 7, 2021
Merged

Conversation

tarkah
Copy link
Member

@tarkah tarkah commented Feb 6, 2021

Resolves #512

Proposed Changes

  • Add townlong-yak addon support via the hub api

Checklist

  • Tested on Windows
  • Tested on MacOS
  • Tested on Linux
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users

Comment on lines +211 to +219
let external_release_id = if repository == RepositoryKind::TownlongYak {
addon.file_id().map(ExternalReleaseId::FileId)
} else {
addon
.version()
.map(str::to_string)
.map(ExternalReleaseId::Version)
};

Copy link
Member Author

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";
Copy link
Member Author

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.

Comment on lines +737 to +747
// 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 => {}
}
Copy link
Member Author

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

Comment on lines +760 to 767
// 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);
}
}
Copy link
Member Author

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",
Copy link
Member

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

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah lets do that.

@casperstorm
Copy link
Member

I've tested this on both Windows and macOS and it works perfectly.
I don't really have any comments to the code. Its clean. Good job, once again mate.

@tarkah tarkah marked this pull request as ready for review February 6, 2021 20:46
@casperstorm casperstorm merged commit d06a279 into development Feb 7, 2021
@casperstorm casperstorm deleted the feat/townlong-yak branch February 7, 2021 06:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载