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

Feature/no self update #711

Merged
merged 5 commits into from
Aug 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions .github/workflows/release_to_draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ on:
workflow_dispatch:
inputs:
tag:
description: 'Specify tag to create'
description: "Specify tag to create"
required: true

jobs:

build:
name: Build
strategy:
Expand All @@ -22,6 +21,10 @@ jobs:
os: windows-latest
make: make binary OPENGL=1
binary_path: target/release/ajour.exe
- target: windows-noselfupdate
os: windows-latest
make: make binary NOSELFUPDATE=1
binary_path: target/release/ajour.exe

- target: linux-wgpu
os: ubuntu-16.04
Expand All @@ -48,6 +51,10 @@ jobs:
os: macos-latest
make: make tar OPENGL=1 MACOS=1
binary_path: target/release/ajour.tar.gz
- target: macos-noselfupdate
os: macos-latest
make: make tar MACOS=1 NOSELFUPDATE=1
binary_path: target/release/ajour.tar.gz

runs-on: ${{ matrix.target.os }}

Expand All @@ -60,7 +67,7 @@ jobs:
override: true

- name: Do we need linuxdeploy?
if: ${{ matrix.target.os == 'ubuntu-16.04' }}
if: ${{ matrix.target.os == 'ubuntu-16.04' }}
run: |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
Expand All @@ -76,7 +83,7 @@ jobs:

- name: Code signing
if: ${{ matrix.target.os == 'windows-latest' }}
env:
env:
codesign_cert: ${{ secrets.CODESIGN_CERT }}
codesign_cert_password: ${{ secrets.CODESIGN_CERT_PASSWORD }}
run: |
Expand Down Expand Up @@ -125,6 +132,10 @@ jobs:
artifact_name: ajour.exe
asset_name: ajour-opengl.exe
asset_type: application/x-dosexec
- artifact: windows-noselfupdate
artifact_name: ajour.exe
asset_name: ajour-noselfupdate.exe
asset_type: application/x-dosexec

- artifact: linux-wgpu
artifact_name: ajour.AppImage
Expand All @@ -151,6 +162,10 @@ jobs:
artifact_name: ajour.tar.gz
asset_name: ajour-opengl-macos.tar.gz
asset_type: application/gzip
- artifact: macos-noselfupdate
artifact_name: ajour.tar.gz
asset_name: ajour-noselfupdate-macos.tar.gz
asset_type: application/gzip

runs-on: ubuntu-latest
env:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ and `Removed`.

## [Unreleased]

### Packaging

- Adds a new cargo feature flag `no-self-update`. When used, Ajour won't check for
newer updates.
- Adds 2 new release assets, one for Windows and Macos, both with this feature
activated. These can be picked up by Chocolatey & Homebrew respectively.

## [1.2.5] - 2021-07-26

### Fixed
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ edition = "2018"
default = ["wgpu"]
wgpu = ["ajour-widgets/wgpu", "iced/wgpu", "iced/default_system_font"]
opengl = ["ajour-widgets/opengl", "iced/glow", "iced/glow_default_system_font"]
no-self-update = ["ajour-core/no-self-update"]

[dependencies]
ajour-core = { version = "1.2.5", path = "crates/core", features=['gui'] }
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ DMG_DIR = $(RELEASE_DIR)/osx

OPENGL ?=
MACOS ?=
NOSELFUPDATE ?=

ifdef MACOS
ENV :=MACOSX_DEPLOYMENT_TARGET="10.11"
Expand All @@ -37,6 +38,10 @@ else
FEATURE_FLAG :=
endif

ifdef NOSELFUPDATE
FEATURE_FLAG +=--features no-self-update
endif

vpath $(TARGET) $(RELEASE_DIR)
vpath $(APP_NAME) $(APP_DIR)
vpath $(DMG_NAME) $(APP_DIR)
Expand Down
1 change: 1 addition & 0 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ edition = "2018"
[features]
default = []
gui = ['iced_native']
no-self-update = []

[[bin]]
name = "fingerprint_addon"
Expand Down
6 changes: 3 additions & 3 deletions crates/core/src/addon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ impl Addon {
fn is_updatable_by_version_comparison(&self, remote_package: &RemotePackage) -> bool {
if let Some(version) = self.version() {
let srv = strip_non_digits(&remote_package.version);
let slv = strip_non_digits(&version);
let slv = strip_non_digits(version);

return !slv.contains(&srv);
}
Expand Down Expand Up @@ -584,13 +584,13 @@ impl PartialEq for Addon {

impl PartialOrd for Addon {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.title().cmp(&other.title()))
Some(self.title().cmp(other.title()))
}
}

impl Ord for Addon {
fn cmp(&self, other: &Self) -> Ordering {
self.title().cmp(&other.title())
self.title().cmp(other.title())
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ pub async fn remove_addon_entries_with_missing_folders(
.iter()
.cloned()
.enumerate()
.filter(|(_, entry)| !entry.folder_names.iter().all(|f| folder_names.contains(&f)))
.filter(|(_, entry)| !entry.folder_names.iter().all(|f| folder_names.contains(f)))
.map(|(idx, _)| idx)
.collect::<Vec<_>>();

Expand Down
7 changes: 2 additions & 5 deletions crates/core/src/fs/addon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,7 @@ pub async fn install_addon(
// Cleanup
std::fs::remove_file(&zip_path)?;

let mut addon_folders: Vec<_> = toc_files
.iter()
.filter_map(|p| parse_toc_path(&p))
.collect();
let mut addon_folders: Vec<_> = toc_files.iter().filter_map(|p| parse_toc_path(p)).collect();
addon_folders.sort();
// Needed since multi-toc can now insert folder name more than once
addon_folders.dedup();
Expand Down Expand Up @@ -195,7 +192,7 @@ mod test {
files.push(path);
}

delete_saved_variables(&folders, &root).unwrap();
delete_saved_variables(&folders, root).unwrap();

let mut exists = 0;
for file in files {
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/fs/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub async fn import_theme(url: String) -> Result<(String, Vec<Theme>), ThemeErro

let query = uri.query().ok_or(ThemeError::MissingQuery)?;

let theme = serde_urlencoded::from_str::<Vec<(String, String)>>(&query)?
let theme = serde_urlencoded::from_str::<Vec<(String, String)>>(query)?
.into_iter()
.find(|(name, _)| name == "theme")
.map(|(_, theme_json)| serde_json::from_str::<Theme>(&theme_json))
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/repository/backend/curse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ pub(crate) async fn batch_fetch_repo_packages(
return Ok(curse_repo_packages);
}

let mut curse_packages = curse::fetch_remote_packages_by_ids(&curse_ids).await?;
let mut curse_packages = curse::fetch_remote_packages_by_ids(curse_ids).await?;

if let Some(fingerprint_info) = fingerprint_info {
// Get repo packages from fingerprint exact matches
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/repository/backend/hub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub(crate) async fn batch_fetch_repo_packages(
return Ok(hub_repo_packages);
}

let hub_packages = hub::fetch_remote_packages(flavor, &hub_ids).await?;
let hub_packages = hub::fetch_remote_packages(flavor, hub_ids).await?;

hub_repo_packages.extend(
hub_packages
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/repository/backend/tukui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub(crate) async fn batch_fetch_repo_packages(

let fetch_tasks: Vec<_> = tukui_ids
.iter()
.map(|id| tukui::fetch_remote_package(&id, &flavor))
.map(|id| tukui::fetch_remote_package(id, &flavor))
.collect();

tukui_repo_packages.extend(
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/repository/backend/wowi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub(crate) async fn batch_fetch_repo_packages(
return Ok(wowi_repo_packages);
}

let wowi_packages = wowi::fetch_remote_packages(&wowi_ids).await?;
let wowi_packages = wowi::fetch_remote_packages(wowi_ids).await?;

wowi_repo_packages.extend(
wowi_packages
Expand Down
35 changes: 15 additions & 20 deletions crates/core/src/utility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ use crate::config::{Flavor, SelfUpdateChannel};
use crate::error::DownloadError;
#[cfg(target_os = "macos")]
use crate::error::FilesystemError;
use crate::network::{download_file, request_async};
use crate::network::download_file;

use isahc::AsyncReadResponseExt;
use regex::Regex;
use retry::delay::Fibonacci;
use retry::{retry, Error as RetryError, OperationResult};
Expand Down Expand Up @@ -58,7 +57,16 @@ pub struct ReleaseAsset {
pub download_url: String,
}

#[cfg(feature = "no-self-update")]
pub async fn get_latest_release(_channel: SelfUpdateChannel) -> Option<Release> {
None
}

#[cfg(not(feature = "no-self-update"))]
pub async fn get_latest_release(channel: SelfUpdateChannel) -> Option<Release> {
use crate::network::request_async;
use isahc::AsyncReadResponseExt;

log::debug!("checking for application update");

let mut resp = request_async(
Expand Down Expand Up @@ -323,25 +331,12 @@ mod tests {
let root_alternate_path = PathBuf::from(r"/Applications/Wow");
let root_path = PathBuf::from(r"/Applications/World of Warcraft");

assert_eq!(
root_path.eq(&wow_path_resolution(Some(classic_addon_path)).unwrap()),
true
);
assert_eq!(
root_path.eq(&wow_path_resolution(Some(retail_addon_path)).unwrap()),
true
);
assert_eq!(
root_path.eq(&wow_path_resolution(Some(retail_interface_path)).unwrap()),
true
);
assert_eq!(
root_path.eq(&wow_path_resolution(Some(classic_interface_path)).unwrap()),
true
);
assert_eq!(
assert!(root_path.eq(&wow_path_resolution(Some(classic_addon_path)).unwrap()),);
assert!(root_path.eq(&wow_path_resolution(Some(retail_addon_path)).unwrap()),);
assert!(root_path.eq(&wow_path_resolution(Some(retail_interface_path)).unwrap()),);
assert!(root_path.eq(&wow_path_resolution(Some(classic_interface_path)).unwrap()),);
assert!(
root_alternate_path.eq(&wow_path_resolution(Some(classic_alternate_path)).unwrap()),
true
);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/widgets/src/renderer/table_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where
};

let (content, mouse_interaction) =
content.draw(self, &defaults, content_layout, cursor_position, viewport);
content.draw(self, defaults, content_layout, cursor_position, viewport);

(
if style.background.is_some() {
Expand Down
2 changes: 1 addition & 1 deletion src/gui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2051,10 +2051,10 @@ impl Default for ScaleState {
}
}

#[allow(clippy::upper_case_acronyms)]
#[derive(Debug, Clone)]
pub enum BackupFolderKind {
AddOns,
#[allow(clippy::upper_case_acronyms)]
WTF,
Config,
Screenshots,
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载