Add password login and collection visibility settings
All checks were successful
Build plugin / build (push) Successful in 1m10s
All checks were successful
Build plugin / build (push) Successful in 1m10s
This commit is contained in:
parent
173aa94ea9
commit
e2a4464d0d
5 changed files with 218 additions and 26 deletions
|
|
@ -558,9 +558,14 @@ func _load_library(caching_flags: int = Cache.FLAGS.LOAD | Cache.FLAGS.SAVE) ->
|
|||
return []
|
||||
|
||||
logger.info("Fetching itch.io library...")
|
||||
var owned: Array = await itch.get_owned_games()
|
||||
var show_purchases: bool = settings_manager.get_value("plugin.itch", "show_purchases", true) as bool
|
||||
var hidden_collections: Dictionary = settings_manager.get_value("plugin.itch", "hidden_collections", {}) as Dictionary
|
||||
|
||||
var owned: Array = []
|
||||
if show_purchases:
|
||||
owned = await itch.get_owned_games()
|
||||
var caves: Variant = await itch.get_caves()
|
||||
var collection_games: Array = await itch.get_collection_games()
|
||||
var collection_groups: Array = await itch.get_collection_groups()
|
||||
|
||||
# Clean up "orphan" caves (butler.db entries whose install folder was wiped
|
||||
# by a plugin update) in the background so a later Install.Queue doesn't
|
||||
|
|
@ -595,16 +600,21 @@ func _load_library(caching_flags: int = Cache.FLAGS.LOAD | Cache.FLAGS.SAVE) ->
|
|||
|
||||
# Collection games aren't necessarily owned (e.g. a free game the user
|
||||
# bookmarked), so merge them in too, deduped against owned games.
|
||||
for g in collection_games:
|
||||
var game: Dictionary = g
|
||||
var game_id: int = game.get("id", 0)
|
||||
if game_id in seen_game_ids:
|
||||
for group in collection_groups:
|
||||
var group_dict: Dictionary = group
|
||||
var col_id: String = str(group_dict.get("id", 0))
|
||||
if hidden_collections.has(col_id):
|
||||
continue
|
||||
var item: Variant = _make_item(game, caves_by_game_id)
|
||||
if item == null:
|
||||
continue
|
||||
seen_game_ids[game_id] = true
|
||||
items.append(item)
|
||||
for g in group_dict.get("games", []):
|
||||
var game: Dictionary = g
|
||||
var game_id: int = game.get("id", 0)
|
||||
if game_id in seen_game_ids:
|
||||
continue
|
||||
var item: Variant = _make_item(game, caves_by_game_id)
|
||||
if item == null:
|
||||
continue
|
||||
seen_game_ids[game_id] = true
|
||||
items.append(item)
|
||||
|
||||
if caching_flags & Cache.FLAGS.SAVE:
|
||||
logger.debug("Saving itch.io apps to cache.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue