mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2026-09-19 14:53:49 +00:00
Initial work on manifest fetching and parsing
This commit is contained in:
@@ -11,6 +11,8 @@ module W3DHubLauncher
|
||||
|
||||
pp self
|
||||
|
||||
@manifests = {}
|
||||
|
||||
setup
|
||||
end
|
||||
|
||||
@@ -24,61 +26,83 @@ module W3DHubLauncher
|
||||
end
|
||||
|
||||
def fetch_manifests(version = @target_version)
|
||||
result = fetch_manifest(version)
|
||||
if result.okay?
|
||||
pp result
|
||||
else
|
||||
pp [:error, result]
|
||||
while (manifest = fetch_manifest(version))
|
||||
@manifests[version] = manifest
|
||||
|
||||
version = manifest.base_version
|
||||
end
|
||||
end
|
||||
|
||||
def fetch_manifest(version)
|
||||
@worker.w3dhub_api.fetch_package_details([{category: "games", subcategory: @application.id, name: "manifest.xml", version: version }])
|
||||
result = @worker.w3dhub_api.fetch_package_details([{category: "games", subcategory: @application.id, name: "manifest.xml", version: version }])
|
||||
|
||||
return false unless result.okay?
|
||||
|
||||
response = JSON.parse(result.data)
|
||||
pp response
|
||||
pp package_details = response["packages"]&.map { |item| Worker::Api::LegacyManifestPackage.new(item) }&.first
|
||||
|
||||
return false unless package_details
|
||||
return false if package_details.error?
|
||||
|
||||
# FIXME: check if locally downloaded manifest is still valid, if present.
|
||||
result = if package_details.download_url
|
||||
@worker.w3dhub_api.download(package_details.download_url, path: "manifest-#{version}.xml")
|
||||
else
|
||||
# TODO xD
|
||||
@worker.w3dhub_api.fetch_package("TODO")
|
||||
end
|
||||
|
||||
pp result
|
||||
|
||||
return Worker::Api::LegacyManifest.new("manifest-#{version}.xml") if result.okay?
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def execute_task
|
||||
show_application_taskbar
|
||||
# def execute_task
|
||||
# show_application_taskbar
|
||||
|
||||
fail_fast
|
||||
return false if failed?
|
||||
# fail_fast
|
||||
# return false if failed?
|
||||
|
||||
fetch_manifests
|
||||
return false if failed?
|
||||
# fetch_manifests
|
||||
# return false if failed?
|
||||
|
||||
build_package_list
|
||||
return false if failed?
|
||||
# build_package_list
|
||||
# return false if failed?
|
||||
|
||||
remove_deleted_files
|
||||
return false if failed?
|
||||
# remove_deleted_files
|
||||
# return false if failed?
|
||||
|
||||
verify_files
|
||||
return false if failed?
|
||||
# verify_files
|
||||
# return false if failed?
|
||||
|
||||
fetch_packages
|
||||
return false if failed?
|
||||
# fetch_packages
|
||||
# return false if failed?
|
||||
|
||||
verify_packages
|
||||
return false if failed?
|
||||
# verify_packages
|
||||
# return false if failed?
|
||||
|
||||
unpack_packages
|
||||
return false if failed?
|
||||
# unpack_packages
|
||||
# return false if failed?
|
||||
|
||||
create_wine_prefix
|
||||
return false if failed?
|
||||
# create_wine_prefix
|
||||
# return false if failed?
|
||||
|
||||
install_dependencies
|
||||
return false if failed?
|
||||
# install_dependencies
|
||||
# return false if failed?
|
||||
|
||||
write_paths_ini
|
||||
return false if failed?
|
||||
# write_paths_ini
|
||||
# return false if failed?
|
||||
|
||||
mark_application_installed
|
||||
return false if failed?
|
||||
# mark_application_installed
|
||||
# return false if failed?
|
||||
|
||||
sleep 1
|
||||
hide_application_taskbar
|
||||
# sleep 1
|
||||
# hide_application_taskbar
|
||||
|
||||
true
|
||||
end
|
||||
# true
|
||||
# end
|
||||
|
||||
Reference in New Issue
Block a user