Skip to content

Commit

Permalink
Merge pull request #377 from ogri-la/5.4.1
Browse files Browse the repository at this point in the history
* merged master, bumps release, truncated todo

* tukui, support for wotlk-classic  (#376)

* tukui, support for wotlk addons
* catalogue, adds support for tukui-classic-wotlk
* catalogue, fixes apparent duplicate message when 'strict' mode disabled
* gui, search result 'source' column widths fixed
* addon, fixes bug with strict wotlk game track selection not finding addons

* 5.4.1

* updated CHANGELOG

Co-authored-by: Torkus <[email protected]>
  • Loading branch information
torkus and Torkus authored Sep 11, 2022
2 parents 945a7ee + 7dd8fdc commit ffa0166
Show file tree
Hide file tree
Showing 16 changed files with 94 additions and 42 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file. This change
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 5.4.1 - 2022-09-11

### Added

* support for Tukui's WotLK addons
- because of how Tukui partition their addons they need some special handling.

### Changed

* inconsistent 'source' column widths and resizing behaviour in the search addons tab.

### Fixed

* bug with selecting the 'WotLK Classic' game track in strict mode that would empty the list of installed addons.
* minor bug with an error message repeated N times when installing an addon and the selected game track isn't supported
- affected non-strict mode only and was simply the same error message but for each game track it iterated through, i.e. 'no releases found for classic', 'no releases found for classic-tbc', etc.

## 5.4.0 - 2022-08-21

### Added
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ Arch Linux users can install `strongbox` from the [AUR](https://aur.archlinux.or

For other Linux users:

1. download: [./releases/strongbox](https://github.com/ogri-la/strongbox/releases/download/5.4.0/strongbox)
1. download: [./releases/strongbox](https://github.com/ogri-la/strongbox/releases/download/5.4.1/strongbox)
2. make executable: `chmod +x strongbox`
3. run: `./strongbox`

If you're on macOS or having a problem with the binary or just prefer Java `.jar` files (requires Java 11+):

1. download: [./releases/strongbox-5.4.0-standalone.jar](https://github.com/ogri-la/strongbox/releases/download/5.4.0/strongbox-5.4.0-standalone.jar)
2. run: `java -jar strongbox-5.4.0-standalone.jar`
1. download: [./releases/strongbox-5.4.1-standalone.jar](https://github.com/ogri-la/strongbox/releases/download/5.4.1/strongbox-5.4.1-standalone.jar)
2. run: `java -jar strongbox-5.4.1-standalone.jar`

## Usage

Expand Down
8 changes: 0 additions & 8 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ see CHANGELOG.md for a more formal list of changes by release

## done

* wotlk classic support
* add support for wotlk classic
- https://github.com/EsreverWoW/ShestakUI_Classic
- https://www.wowinterface.com/downloads/info26239
- https://www.wowinterface.com/downloads/info26016
- https://www.wowinterface.com/downloads/info25460
- https://www.wowinterface.com/downloads/info25977

## todo

## todo bucket (no particular order)
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>ogri-la</groupId>
<artifactId>strongbox</artifactId>
<packaging>jar</packaging>
<version>5.4.0</version>
<version>5.4.1</version>
<name>strongbox</name>
<description>World Of Warcraft Addon Manager</description>
<url>https://github.com/ogri-la/strongbox</url>
Expand All @@ -18,7 +18,7 @@
<url>https://github.com/ogri-la/strongbox</url>
<connection>scm:git:git://github.com/ogri-la/strongbox.git</connection>
<developerConnection>scm:git:ssh://[email protected]/ogri-la/strongbox.git</developerConnection>
<tag>44a0ffd78b40615794057362ba60b6b5e43e5d88</tag>
<tag>c6f3392893fa103224a84749812347a461834f91</tag>
</scm>
<build>
<sourceDirectory>src</sourceDirectory>
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject ogri-la/strongbox "5.4.0"
(defproject ogri-la/strongbox "5.4.1"
:description "World Of Warcraft Addon Manager"
:url "https://github.com/ogri-la/strongbox"
:license {:name "GNU Affero General Public License (AGPL)"
Expand Down
7 changes: 5 additions & 2 deletions src/strongbox/addon.clj
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@
(let [grouped-toc-data (group-by :-toc/game-track toc-data-list)
priority-map {:retail [:retail :classic :classic-tbc]
:classic [:classic :classic-tbc :retail]
:classic-tbc [:classic-tbc :classic :retail]}
priorities (get priority-map game-track)
:classic-tbc [:classic-tbc :classic :retail]
:classic-wotlk [:classic-wotlk :classic-tbc :classic :retail]
}
safe-fallback [game-track]
priorities (get priority-map game-track safe-fallback)
group (utils/first-nn #(get grouped-toc-data %) priorities)]

(when (and (> (count group) 1)
Expand Down
30 changes: 13 additions & 17 deletions src/strongbox/catalogue.clj
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,16 @@
does *not* support ignoring disabled hosts, see `expand-summary`.
returns `nil` when no release found."
[addon :addon/expandable, game-track ::sp/game-track]
(let [dispatch-map {"curseforge" curseforge-api/expand-summary
"wowinterface" wowinterface-api/expand-summary
"gitlab" gitlab-api/expand-summary
"github" github-api/expand-summary
(let [dispatch-map {"curse" curseforge-api/expand-summary
"wowin" wowinterface-api/expand-summary
"gitla" gitlab-api/expand-summary
"githu" github-api/expand-summary
"tukui" tukui-api/expand-summary
"tukui-classic" tukui-api/expand-summary
"tukui-classic-tbc" tukui-api/expand-summary
nil (fn [_ _] (error "malformed addon:" (utils/pprint addon)))}
key (:source addon)]
key (utils/safe-subs (:source addon) 5)]
(try
(if-not (contains? dispatch-map key)
(error (format "addon '%s' is from an unsupported source '%s'." (:label addon) key))
(error (format "addon '%s' for %s is from an unsupported source '%s'." (:label addon) (sp/game-track-labels-map game-track) (:source addon)))
(let [release-list ((get dispatch-map key) addon game-track)
latest-release (first release-list)
pinned-release (when (and release-list
Expand Down Expand Up @@ -80,7 +78,7 @@
;; "no 'Classic' release found on wowinterface"
;; "no 'Classic (TBC)', 'Classic' or 'Retail' release found on github"
(let [single-template "no '%s' release found on %s."
multi-template "no '%s', '%s' or '%s' release found on %s."
multi-template "no '%s', '%s', '%s' or '%s' release found on %s."
msg (if strict?
(format single-template (sp/game-track-labels-map game-track) (:source addon))
(apply format multi-template (conj (mapv #(sp/game-track-labels-map %) (get track-map game-track))
Expand Down Expand Up @@ -238,18 +236,16 @@
:error nil?)
"given a string from the user, figures out the addon source (github, etc), calls the right module and returns a stub"
[uin string?]
(let [dispatch-map {"github" github-api/parse-user-string
"gitlab" gitlab-api/parse-user-string
"wowinterface" wowinterface-api/parse-user-string
"curseforge" curseforge-api/parse-user-string
"tukui" tukui-api/parse-user-string
"tukui-classic" tukui-api/parse-user-string
"tukui-classic-tbc" tukui-api/parse-user-string}
(let [dispatch-map {"githu" github-api/parse-user-string
"gitla" gitlab-api/parse-user-string
"wowin" wowinterface-api/parse-user-string
"curse" curseforge-api/parse-user-string
"tukui" tukui-api/parse-user-string}
url (some-> uin utils/unmangle-https-url java.net.URL. str)]
(if-not url
(error "bad url")
(let [source (utils/url-to-addon-source url)]
(if-let [f (get dispatch-map source)]
(if-let [f (dispatch-map (utils/safe-subs source 5))]
(when-let [result (f url)]
;; special handling for curseforge, that returns a URL to be matched against catalogue.
(merge {:source source} (if (= source "curseforge") {:url result} {:source-id result})))
Expand Down
8 changes: 4 additions & 4 deletions src/strongbox/http.clj
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
(defn-spec -download (s/or :file ::sp/extant-file, :raw :http/resp, :error :http/error)
"if writing to a file is possible then the output file is returned, else the raw http response.
writing response body to a file is possible when caching is available or `output-file` provided."
[^String url ::sp/url, output-file (s/nilable ::sp/file), message (s/nilable ::sp/short-string), extra-params map?]
[^String url ::sp/url, output-file (s/nilable ::sp/file), message (s/nilable string?), extra-params map?]
(let [cache? (not (nil? *cache*))
encoded-path (url-to-filename url)
alt-output-file (when cache?
Expand Down Expand Up @@ -354,7 +354,7 @@
an optional `message` can be supplied as the second argument that will be displayed on a cache miss."
([url ::sp/url]
(download url nil))
([url ::sp/url, message (s/nilable ::sp/short-string)]
([url ::sp/url, message (s/nilable string?)]
(let [output-file nil
resp (-download url output-file message {})]
(cond
Expand All @@ -369,7 +369,7 @@
an optional `message` can be supplied as the second argument that will be displayed on a cache miss."
([url ::sp/url, output-file ::sp/file]
(download-file url output-file nil))
([url ::sp/url, output-file ::sp/file, message (s/nilable ::sp/short-string)]
([url ::sp/url, output-file ::sp/file, message (s/nilable string?)]
(let [resp (-download url output-file message {:as :stream})]
(if-not (http-error? resp)
output-file
Expand All @@ -381,7 +381,7 @@
"wrapper around `download` that will pause and retry a download several times with an exponentially increasing duration between each attemp"
([url ::sp/url]
(download-with-backoff url nil))
([url ::sp/url, message (s/nilable ::sp/short-string)]
([url ::sp/url, message (s/nilable string?)]
(loop [attempt 1
pause *default-pause*]
(let [result (try
Expand Down
2 changes: 1 addition & 1 deletion src/strongbox/specs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
(s/def :addon/category string?)
(s/def :addon/category-list (s/coll-of :addon/category))

(s/def :addon/source (s/or :known #{"curseforge" "wowinterface" "github" "gitlab" "tukui" "tukui-classic" "tukui-classic-tbc"}
(s/def :addon/source (s/or :known #{"curseforge" "wowinterface" "github" "gitlab" "tukui" "tukui-classic" "tukui-classic-tbc" "tukui-classic-wotlk"}
:unknown string?))
(s/def :addon/source-id (s/or ::integer-id? int? ;; tukui has negative ids
::string-id? string?))
Expand Down
8 changes: 6 additions & 2 deletions src/strongbox/tukui_api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
(def summary-list-url "https://www.tukui.org/api.php?addons")
(def classic-summary-list-url "https://www.tukui.org/api.php?classic-addons")
(def classic-tbc-summary-list-url "https://www.tukui.org/api.php?classic-tbc-addons")
(def classic-wotlk-summary-list-url "https://www.tukui.org/api.php?classic-wotlk-addons")

(def proper-url "https://www.tukui.org/api.php?ui=%s")
(def tukui-proper-url (format proper-url "tukui"))
Expand All @@ -33,6 +34,7 @@
:retail (str "https://www.tukui.org/addons.php?id=" source-id)
:classic (str "https://www.tukui.org/classic-addons.php?id=" source-id)
:classic-tbc (str "https://www.tukui.org/classic-tbc-addons.php?id=" source-id)
:classic-wotlk (str "https://www.tukui.org/classic-wotlk-addons.php?id=" source-id)
nil)

:else nil))
Expand All @@ -47,7 +49,8 @@
(neg? source-id) (format proper-url (:name addon))
(= game-track :retail) summary-list-url
(= game-track :classic) classic-summary-list-url
(= game-track :classic-tbc) classic-tbc-summary-list-url)
(= game-track :classic-tbc) classic-tbc-summary-list-url
(= game-track :classic-wotlk) classic-wotlk-summary-list-url)

;; tukui addons do not share IDs across game tracks like curseforge does.
;; 2020-12-02: Tukui has dropped the per-addon endpoint, all results are now lists of items
Expand Down Expand Up @@ -87,7 +90,8 @@
{:source (case game-track
:retail "tukui"
:classic "tukui-classic"
:classic-tbc "tukui-classic-tbc")
:classic-tbc "tukui-classic-tbc"
:classic-wotlk "tukui-classic-wotlk")
:source-id (-> ti :id utils/to-int)

;; 2020-03: disabled in favour of :tag-list
Expand Down
2 changes: 1 addition & 1 deletion src/strongbox/ui/jfx.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1898,7 +1898,7 @@
(async-handler (partial f addon-summary))
{:style-class (if starred "starred" "unstarred")})}))}}

{:text "source" :min-width 125 :pref-width 125 :max-width 125 :resizable false
{:text "source" :min-width 130 :pref-width 135 :max-width 145
:cell-factory {:fx/cell-type :table-cell
:describe (fn [row]
{:graphic (href-to-hyperlink row)})}
Expand Down
1 change: 1 addition & 0 deletions src/strongbox/utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@
"/addons.php" "tukui"
"/classic-addons.php" "tukui-classic"
"/classic-tbc-addons.php" "tukui-classic-tbc"
"/classic-wotlk-addons.php" "tukui-classic-wotlk"
nil)
nil)))

Expand Down
19 changes: 19 additions & 0 deletions test/fixtures/tukui--classic-wotlk-addon-details.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
{
"id": "6",
"name": "HydraUI",
"small_desc": "A visual interface replacement. HydraUI restyles the default interface, while adding many useful features.",
"author": "Hydra",
"version": "1.75",
"screenshot_url": "https://www.tukui.org/addons/Hydra/1619382889/screenshot.png",
"url": "https://www.tukui.org/classic-wotlk-addons.php?download=6",
"category": "Interfaces",
"downloads": "107070",
"lastupdate": "2022-09-03 06:43:35",
"patch": "3.4.0",
"web_url": "https://www.tukui.org/classic-wotlk-addons.php?id=6",
"last_download": "2022-09-10 13:39:05",
"changelog": "https://www.tukui.org/classic-wotlk-addons.php?id=6&changelog",
"donate_url": "https://www.paypal.me/vuiaddon"
}
]
1 change: 1 addition & 0 deletions test/strongbox/catalogue_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
["https://www.tukui.org/addons.php?id=38" {:source "tukui" :source-id 38}]
["https://www.tukui.org/classic-addons.php?id=3" {:source "tukui-classic" :source-id 3}]
["https://www.tukui.org/classic-tbc-addons.php?id=21" {:source "tukui-classic-tbc" :source-id 21}]
["https://www.tukui.org/classic-wotlk-addons.php?id=21" {:source "tukui-classic-wotlk" :source-id 21}]

;; edge cases that utils/unmangle-url fix
["github.com/Aviana/HealComm" {:source "github" :source-id "Aviana/HealComm"}]
Expand Down
2 changes: 1 addition & 1 deletion test/strongbox/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@
dummy-catalogue (utils/to-json future-data)
fake-routes {"https://raw.githubusercontent.com/ogri-la/strongbox-catalogue/master/short-catalogue.json"
{:get (fn [req] {:status 200 :body dummy-catalogue})}}
expected-messages ["addon 'A New Simple Percent' is from an unsupported source 'gitplex'."
expected-messages ["addon 'A New Simple Percent' for Retail is from an unsupported source 'gitplex'."
"refresh"]

search-term "new"
Expand Down
19 changes: 19 additions & 0 deletions test/strongbox/tukui_api_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,25 @@
(with-fake-routes-in-isolation fake-routes
(is (= expected (tukui-api/download-classic-tbc-summaries)))))))

(deftest parse-addons--classic-wotlk
(testing "parsing classic (wotlk) addons"
(let [fixture (slurp (fixture-path "tukui--classic-wotlk-addon-details.json"))
fake-routes {tukui-api/classic-tbc-summary-list-url
{:get (fn [req] {:status 200 :body fixture})}}

expected [{:description "A visual interface replacement. HydraUI restyles the default interface, while adding many useful features.",
:download-count 107070,
:game-track-list [:classic-tbc],
:label "HydraUI",
:name "hydraui",
:source "tukui-classic-tbc",
:source-id 6,
:tag-list [:interfaces],
:updated-date "2022-09-03T06:43:35Z",
:url "https://www.tukui.org/classic-wotlk-addons.php?id=6"}]]
(with-fake-routes-in-isolation fake-routes
(is (= expected (tukui-api/download-classic-tbc-summaries)))))))

(deftest parse-addons--proper
(testing "parsing tukui/elvui addons proper"
(let [fixture (slurp (fixture-path "tukui--elvui-addon-proper.json"))
Expand Down

0 comments on commit ffa0166

Please sign in to comment.